diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-10-19 11:05:40 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-10-19 11:05:40 +0200 |
| commit | 42345af443611e2db864ad355cc9ad528f38c119 (patch) | |
| tree | f329384a2bf82a0427b07a2526c3b74862051dff /src | |
| parent | a5797da100bebf3941cecfb0fe0ed094f963f108 (diff) | |
| download | box64-42345af443611e2db864ad355cc9ad528f38c119.tar.gz box64-42345af443611e2db864ad355cc9ad528f38c119.zip | |
[BOX32][WRAPPER] Added 32bits wrapped regex libc functions
Diffstat (limited to 'src')
| -rwxr-xr-x | src/include/myalign32.h | 46 | ||||
| -rwxr-xr-x | src/libtools/myalign32.c | 30 | ||||
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 10 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedlibctypes32.h | 7 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.c | 6 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.h | 3 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc.c | 39 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc_private.h | 8 |
8 files changed, 145 insertions, 4 deletions
diff --git a/src/include/myalign32.h b/src/include/myalign32.h index 505f6cbe..b7d49cbd 100755 --- a/src/include/myalign32.h +++ b/src/include/myalign32.h @@ -542,4 +542,50 @@ struct i386_group ptr_t gr_mem; // char ** } __attribute__((packed, aligned(4))); +typedef struct my_regex_s +{ + void* buffer; //struct re_dfa_t + size_t allocated; + size_t used; + unsigned long int syntax; + char* fastmap; + unsigned char* translate; + size_t re_nsub; + unsigned flags; + /* + unsigned can_be_null : 1; + unsigned regs_allocated : 2; + unsigned fastmap_accurate : 1; + unsigned no_sub : 1; + unsigned not_bol : 1; + unsigned not_eol : 1; + unsigned newline_anchor : 1; + */ +} my_regex_t; + +typedef struct my_regex_32_s +{ + ptr_t buffer; //struct re_dfa_t + ulong_t allocated; + ulong_t used; + ulong_t syntax; + ptr_t fastmap; //char* + ptr_t translate; //unsigned char* + ulong_t re_nsub; + unsigned flags; + /* + unsigned can_be_null : 1; + unsigned regs_allocated : 2; + unsigned fastmap_accurate : 1; + unsigned no_sub : 1; + unsigned not_bol : 1; + unsigned not_eol : 1; + unsigned newline_anchor : 1; + */ +} my_regex_32_t; + +void convert_regext_to_32(void* d, void* s); +void convert_regext_to_64(void* d, void* s); + + #endif//__MY_ALIGN32__H_ \ No newline at end of file diff --git a/src/libtools/myalign32.c b/src/libtools/myalign32.c index 7f41aa68..dc5677f0 100755 --- a/src/libtools/myalign32.c +++ b/src/libtools/myalign32.c @@ -1572,3 +1572,33 @@ void AlignFlock_32(void* dest, void* source) #undef GO } #undef TRANSFERT + +void convert_regext_to_32(void* d, void* s) +{ + my_regex_32_t* dst = d; + my_regex_t* src = s; + + dst->buffer = to_ptrv(src->buffer); + dst->allocated = to_ulong(src->allocated); + dst->used = to_ulong(src->used); + dst->syntax = to_ulong(src->syntax); + dst->fastmap = to_ptrv(src->fastmap); + dst->translate = to_ptrv(src->translate); + dst->re_nsub = to_ulong(src->re_nsub); + dst->flags = src->flags; +} + +void convert_regext_to_64(void* d, void* s) +{ + my_regex_t* dst = d; + my_regex_32_t* src = s; + + dst->buffer = from_ptrv(src->buffer); + dst->allocated = from_ulong(src->allocated); + dst->used = from_ulong(src->used); + dst->syntax = from_ulong(src->syntax); + dst->fastmap = from_ptrv(src->fastmap); + dst->translate = from_ptrv(src->translate); + dst->re_nsub = from_ulong(src->re_nsub); + dst->flags = src->flags; +} diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index ea90095d..bf846e64 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -712,6 +712,7 @@ #() iFEpuu -> iFEpuu #() iFEpup -> iFEpup #() iFEpLi -> iFEpLi +#() iFEppi -> iFEppi #() iFEppu -> iFEppu #() iFEppL -> iFEppL #() iFEppp -> iFEppp @@ -1025,6 +1026,7 @@ #() iFXpipi -> iFXpipi #() iFXpppp -> iFXpppp #() IFXpIII -> IFXpIII +#() uFEippu -> uFEippu #() uFpLLLS -> uFpLLLS #() UFuiCiu -> UFuiCiu #() lFpuipC -> lFpuipC @@ -1154,6 +1156,7 @@ #() iFEplluu -> iFEplluu #() iFEpLlpp -> iFEpLlpp #() iFEppipp -> iFEppipp +#() iFEppupi -> iFEppupi #() iFEppllp -> iFEppllp #() iFEpppLp -> iFEpppLp #() iFEXLilp -> iFEXLilp @@ -1595,6 +1598,7 @@ wrappedlibc: - vFv: - vFp: - freeaddrinfo + - regfree - iFv: - iFi: - __close_nocancel @@ -1691,6 +1695,8 @@ wrappedlibc: - iFpii: - posix_spawn_file_actions_adddup2 - iFpLi: +- iFppi: + - regcomp - iFppp: - vswscanf - iFppV: @@ -1735,6 +1741,8 @@ wrappedlibc: - getaddrinfo - iFSvpp: - iFSvpV: +- uFippu: + - regerror - LFpBp_iv: - iFiippi: - iFipppp: @@ -1746,6 +1754,8 @@ wrappedlibc: - iFpiLpp: - iFpipOi: - posix_spawn_file_actions_addopen +- iFppupi: + - regexec - iFpppLp: - getgrnam_r - getpwnam_r diff --git a/src/wrapped32/generated/wrappedlibctypes32.h b/src/wrapped32/generated/wrappedlibctypes32.h index 7f8d7aab..a301146b 100644 --- a/src/wrapped32/generated/wrappedlibctypes32.h +++ b/src/wrapped32/generated/wrappedlibctypes32.h @@ -62,6 +62,7 @@ typedef int32_t (*iFiiN_t)(int32_t, int32_t, ...); typedef int32_t (*iFipp_t)(int32_t, void*, void*); typedef int32_t (*iFpii_t)(void*, int32_t, int32_t); typedef int32_t (*iFpLi_t)(void*, uintptr_t, int32_t); +typedef int32_t (*iFppi_t)(void*, void*, int32_t); typedef int32_t (*iFppp_t)(void*, void*, void*); typedef int32_t (*iFppV_t)(void*, void*, ...); typedef int32_t (*iFpON_t)(void*, int32_t, ...); @@ -90,6 +91,7 @@ typedef int32_t (*iFpLpV_t)(void*, uintptr_t, void*, ...); typedef int32_t (*iFpppp_t)(void*, void*, void*, void*); typedef int32_t (*iFSvpp_t)(void*, void, void*, void*); typedef int32_t (*iFSvpV_t)(void*, void, void*, ...); +typedef uint32_t (*uFippu_t)(int32_t, void*, void*, uint32_t); typedef uintptr_t (*LFpBp_iv_t)(void*, struct_p_t*, int32_t, void); typedef int32_t (*iFiippi_t)(int32_t, int32_t, void*, void*, int32_t); typedef int32_t (*iFipppp_t)(int32_t, void*, void*, void*, void*); @@ -97,6 +99,7 @@ typedef int32_t (*iFuppLp_t)(uint32_t, void*, void*, uintptr_t, void*); typedef int32_t (*iFpvvpV_t)(void*, void, void, void*, ...); typedef int32_t (*iFpiLpp_t)(void*, int32_t, uintptr_t, void*, void*); typedef int32_t (*iFpipOi_t)(void*, int32_t, void*, int32_t, int32_t); +typedef int32_t (*iFppupi_t)(void*, void*, uint32_t, void*, int32_t); typedef int32_t (*iFpppLp_t)(void*, void*, void*, uintptr_t, void*); typedef void* (*pFpLLiN_t)(void*, uintptr_t, uintptr_t, int32_t, ...); typedef void* (*pFppLLp_t)(void*, void*, uintptr_t, uintptr_t, void*); @@ -113,6 +116,7 @@ typedef int32_t (*iFpLiLppp_t)(void*, uintptr_t, int32_t, uintptr_t, void*, void #define SUPER() ADDED_FUNCTIONS() \ GO(freeaddrinfo, vFp_t) \ + GO(regfree, vFp_t) \ GO(__close_nocancel, iFi_t) \ GO(posix_spawn_file_actions_destroy, iFp_t) \ GO(posix_spawn_file_actions_init, iFp_t) \ @@ -160,6 +164,7 @@ typedef int32_t (*iFpLiLppp_t)(void*, uintptr_t, int32_t, uintptr_t, void*, void GO(vsyslog, vFipp_t) \ GO(_ITM_addUserCommitAction, vFpup_t) \ GO(posix_spawn_file_actions_adddup2, iFpii_t) \ + GO(regcomp, iFppi_t) \ GO(vswscanf, iFppp_t) \ GO(__isoc99_fscanf, iFppV_t) \ GO(swscanf, iFppV_t) \ @@ -176,10 +181,12 @@ typedef int32_t (*iFpLiLppp_t)(void*, uintptr_t, int32_t, uintptr_t, void*, void GO(utimensat, iFippi_t) \ GO(readlinkat, iFippL_t) \ GO(getaddrinfo, iFpppp_t) \ + GO(regerror, uFippu_t) \ GO(getopt_long, iFipppp_t) \ GO(getgrgid_r, iFuppLp_t) \ GO(getpwuid_r, iFuppLp_t) \ GO(posix_spawn_file_actions_addopen, iFpipOi_t) \ + GO(regexec, iFppupi_t) \ GO(getgrnam_r, iFpppLp_t) \ GO(getpwnam_r, iFpppLp_t) \ GO(gethostbyname_r, iFpppupp_t) \ diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index 21c36577..a72c33be 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -802,6 +802,7 @@ typedef int32_t (*iFEpui_t)(x64emu_t*, void*, uint32_t, int32_t); typedef int32_t (*iFEpuu_t)(x64emu_t*, void*, uint32_t, uint32_t); typedef int32_t (*iFEpup_t)(x64emu_t*, void*, uint32_t, void*); typedef int32_t (*iFEpLi_t)(x64emu_t*, void*, uintptr_t, int32_t); +typedef int32_t (*iFEppi_t)(x64emu_t*, void*, void*, int32_t); typedef int32_t (*iFEppu_t)(x64emu_t*, void*, void*, uint32_t); typedef int32_t (*iFEppL_t)(x64emu_t*, void*, void*, uintptr_t); typedef int32_t (*iFEppp_t)(x64emu_t*, void*, void*, void*); @@ -1115,6 +1116,7 @@ typedef int32_t (*iFXLppi_t)(void*, uintptr_t, void*, void*, int32_t); typedef int32_t (*iFXpipi_t)(void*, void*, int32_t, void*, int32_t); typedef int32_t (*iFXpppp_t)(void*, void*, void*, void*, void*); typedef int64_t (*IFXpIII_t)(void*, void*, int64_t, int64_t, int64_t); +typedef uint32_t (*uFEippu_t)(x64emu_t*, int32_t, void*, void*, uint32_t); typedef uint32_t (*uFpLLLS_t)(void*, uintptr_t, uintptr_t, uintptr_t, void*); typedef uint64_t (*UFuiCiu_t)(uint32_t, int32_t, uint8_t, int32_t, uint32_t); typedef intptr_t (*lFpuipC_t)(void*, uint32_t, int32_t, void*, uint8_t); @@ -1244,6 +1246,7 @@ typedef int32_t (*iFEpuuup_t)(x64emu_t*, void*, uint32_t, uint32_t, uint32_t, vo typedef int32_t (*iFEplluu_t)(x64emu_t*, void*, intptr_t, intptr_t, uint32_t, uint32_t); typedef int32_t (*iFEpLlpp_t)(x64emu_t*, void*, uintptr_t, intptr_t, void*, void*); typedef int32_t (*iFEppipp_t)(x64emu_t*, void*, void*, int32_t, void*, void*); +typedef int32_t (*iFEppupi_t)(x64emu_t*, void*, void*, uint32_t, void*, int32_t); typedef int32_t (*iFEppllp_t)(x64emu_t*, void*, void*, intptr_t, intptr_t, void*); typedef int32_t (*iFEpppLp_t)(x64emu_t*, void*, void*, void*, uintptr_t, void*); typedef int32_t (*iFEXLilp_t)(x64emu_t*, void*, uintptr_t, int32_t, intptr_t, void*); @@ -2305,6 +2308,7 @@ void iFEpui_32(x64emu_t *emu, uintptr_t fcn) { iFEpui_t fn = (iFEpui_t)fcn; R_EA void iFEpuu_32(x64emu_t *emu, uintptr_t fcn) { iFEpuu_t fn = (iFEpuu_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 12)); } void iFEpup_32(x64emu_t *emu, uintptr_t fcn) { iFEpup_t fn = (iFEpup_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); } void iFEpLi_32(x64emu_t *emu, uintptr_t fcn) { iFEpLi_t fn = (iFEpLi_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12)); } +void iFEppi_32(x64emu_t *emu, uintptr_t fcn) { iFEppi_t fn = (iFEppi_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12)); } void iFEppu_32(x64emu_t *emu, uintptr_t fcn) { iFEppu_t fn = (iFEppu_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(uint32_t, R_ESP + 12)); } void iFEppL_32(x64emu_t *emu, uintptr_t fcn) { iFEppL_t fn = (iFEppL_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ulong(from_ptri(ulong_t, R_ESP + 12))); } void iFEppp_32(x64emu_t *emu, uintptr_t fcn) { iFEppp_t fn = (iFEppp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12)); } @@ -2618,6 +2622,7 @@ void iFXLppi_32(x64emu_t *emu, uintptr_t fcn) { iFXLppi_t fn = (iFXLppi_t)fcn; R void iFXpipi_32(x64emu_t *emu, uintptr_t fcn) { iFXpipi_t fn = (iFXpipi_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16), from_ptri(int32_t, R_ESP + 20)); } void iFXpppp_32(x64emu_t *emu, uintptr_t fcn) { iFXpppp_t fn = (iFXpppp_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20)); } void IFXpIII_32(x64emu_t *emu, uintptr_t fcn) { IFXpIII_t fn = (IFXpIII_t)fcn; ui64_t r; r.i = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptri(int64_t, R_ESP + 12), from_ptri(int64_t, R_ESP + 20), from_ptri(int64_t, R_ESP + 28)); R_EAX = r.d[0]; R_EDX = r.d[1]; } +void uFEippu_32(x64emu_t *emu, uintptr_t fcn) { uFEippu_t fn = (uFEippu_t)fcn; R_EAX = (uint32_t)fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(uint32_t, R_ESP + 16)); } void uFpLLLS_32(x64emu_t *emu, uintptr_t fcn) { uFpLLLS_t fn = (uFpLLLS_t)fcn; R_EAX = (uint32_t)fn(from_ptriv(R_ESP + 4), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ulong(from_ptri(ulong_t, R_ESP + 16)), io_convert32(from_ptriv(R_ESP + 20))); } void UFuiCiu_32(x64emu_t *emu, uintptr_t fcn) { UFuiCiu_t fn = (UFuiCiu_t)fcn; ui64_t r; r.u = (uint64_t)fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(uint8_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20)); R_EAX = r.d[0]; R_EDX = r.d[1]; } void lFpuipC_32(x64emu_t *emu, uintptr_t fcn) { lFpuipC_t fn = (lFpuipC_t)fcn; R_EAX = to_long(fn(from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16), from_ptri(uint8_t, R_ESP + 20))); } @@ -2747,6 +2752,7 @@ void iFEpuuup_32(x64emu_t *emu, uintptr_t fcn) { iFEpuuup_t fn = (iFEpuuup_t)fcn void iFEplluu_32(x64emu_t *emu, uintptr_t fcn) { iFEplluu_t fn = (iFEplluu_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_long(from_ptri(long_t, R_ESP + 8)), from_long(from_ptri(long_t, R_ESP + 12)), from_ptri(uint32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20)); } void iFEpLlpp_32(x64emu_t *emu, uintptr_t fcn) { iFEpLlpp_t fn = (iFEpLlpp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_long(from_ptri(long_t, R_ESP + 12)), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20)); } void iFEppipp_32(x64emu_t *emu, uintptr_t fcn) { iFEppipp_t fn = (iFEppipp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20)); } +void iFEppupi_32(x64emu_t *emu, uintptr_t fcn) { iFEppupi_t fn = (iFEppupi_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), from_ptriv(R_ESP + 16), from_ptri(int32_t, R_ESP + 20)); } void iFEppllp_32(x64emu_t *emu, uintptr_t fcn) { iFEppllp_t fn = (iFEppllp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_long(from_ptri(long_t, R_ESP + 12)), from_long(from_ptri(long_t, R_ESP + 16)), from_ptriv(R_ESP + 20)); } void iFEpppLp_32(x64emu_t *emu, uintptr_t fcn) { iFEpppLp_t fn = (iFEpppLp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ptriv(R_ESP + 20)); } void iFEXLilp_32(x64emu_t *emu, uintptr_t fcn) { iFEXLilp_t fn = (iFEXLilp_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12), from_long(from_ptri(long_t, R_ESP + 16)), from_ptriv(R_ESP + 20)); } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index a4ef1dcb..abc2e583 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -753,6 +753,7 @@ void iFEpui_32(x64emu_t *emu, uintptr_t fnc); void iFEpuu_32(x64emu_t *emu, uintptr_t fnc); void iFEpup_32(x64emu_t *emu, uintptr_t fnc); void iFEpLi_32(x64emu_t *emu, uintptr_t fnc); +void iFEppi_32(x64emu_t *emu, uintptr_t fnc); void iFEppu_32(x64emu_t *emu, uintptr_t fnc); void iFEppL_32(x64emu_t *emu, uintptr_t fnc); void iFEppp_32(x64emu_t *emu, uintptr_t fnc); @@ -1066,6 +1067,7 @@ void iFXLppi_32(x64emu_t *emu, uintptr_t fnc); void iFXpipi_32(x64emu_t *emu, uintptr_t fnc); void iFXpppp_32(x64emu_t *emu, uintptr_t fnc); void IFXpIII_32(x64emu_t *emu, uintptr_t fnc); +void uFEippu_32(x64emu_t *emu, uintptr_t fnc); void uFpLLLS_32(x64emu_t *emu, uintptr_t fnc); void UFuiCiu_32(x64emu_t *emu, uintptr_t fnc); void lFpuipC_32(x64emu_t *emu, uintptr_t fnc); @@ -1195,6 +1197,7 @@ void iFEpuuup_32(x64emu_t *emu, uintptr_t fnc); void iFEplluu_32(x64emu_t *emu, uintptr_t fnc); void iFEpLlpp_32(x64emu_t *emu, uintptr_t fnc); void iFEppipp_32(x64emu_t *emu, uintptr_t fnc); +void iFEppupi_32(x64emu_t *emu, uintptr_t fnc); void iFEppllp_32(x64emu_t *emu, uintptr_t fnc); void iFEpppLp_32(x64emu_t *emu, uintptr_t fnc); void iFEXLilp_32(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped32/wrappedlibc.c b/src/wrapped32/wrappedlibc.c index e120f7bc..148d46cd 100755 --- a/src/wrapped32/wrappedlibc.c +++ b/src/wrapped32/wrappedlibc.c @@ -39,6 +39,7 @@ #include <grp.h> #include <sys/sysinfo.h> #include <sys/time.h> +#include <regex.h> #include "wrappedlibs.h" @@ -2957,6 +2958,44 @@ EXPORT ssize_t my32_process_vm_writev(x64emu_t* emu, int pid, struct i386_iovec* AlignIOV_32(remove_iovec_l+i, remote_iovec+i); return process_vm_writev(pid, local_iovec_l, liovect, remove_iovec_l, riovect, flags); } + +EXPORT int my32_regcomp(x64emu_t* emu, void* p, const char* r, int flags) +{ + regex_t p_l = {0}; + int ret = regcomp(&p_l, r, flags); + convert_regext_to_32(p, &p_l); + return ret; +} + +EXPORT int my32_regexec(x64emu_t* emu, void* p, const char* s, size_t nmatch, void* pmatch, int flags) +{ + regmatch_t pmatch_l[nmatch]; + regex_t p_l; + convert_regext_to_64(&p_l, p); + memset(pmatch_l, 0, sizeof(pmatch_l)); + int ret = regexec(&p_l, s, nmatch, pmatch_l, flags); + convert_regext_to_32(p, &p_l); + for(int i=0; i<nmatch; ++i) + to_struct_LL(to_ptrv(pmatch)+i*8, (struct_LL_t*)&pmatch_l[i]); + return ret; +} + +EXPORT size_t my32_regerror(x64emu_t* emu, int code, void* p, char* buff, size_t size) +{ + regex_t p_l; + convert_regext_to_64(&p_l, p); + size_t ret = regerror(code, &p_l, buff, size); + convert_regext_to_32(p, &p_l); + return ret; +} + +EXPORT void my32_regfree(x64emu_t* emu, void* p) +{ + regex_t p_l; + convert_regext_to_64(&p_l, p); + regfree(&p_l); +} + #if 0 #ifndef __NR_memfd_create #define MFD_CLOEXEC 0x0001U diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h index 9bfdf013..593bc6cd 100755 --- a/src/wrapped32/wrappedlibc_private.h +++ b/src/wrapped32/wrappedlibc_private.h @@ -1371,10 +1371,10 @@ GOW(recvfrom, lFipLipp) //GOM(recvmmsg, iFEipuup) //%% actual recvmmsg is glibc 2.12+. The syscall is Linux 2.6.33+, so use syscall... GOWM(recvmsg, lFEipi) // re_exec // Weak -//GOW(regcomp, iFppi) -//GOW(regerror, uFippu) -//GO(regexec, iFppupi) -//GOW(regfree, vFp) +GOWM(regcomp, iFEppi) +GOWM(regerror, uFEippu) +GOM(regexec, iFEppupi) +GOWM(regfree, vFEp) GOM(__register_atfork, iFEpppp) //%% // register_printf_function // Weak // registerrpc |