diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index d28a29624..953b588d0 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -55,7 +55,6 @@ #() dFd -> dFd #() dFp -> dFp #() lFv -> lFv -#() lFi -> lFi #() lFu -> lFu #() lFl -> lFl #() lFp -> lFp @@ -188,6 +187,7 @@ #() dFdp -> dFdp #() dFll -> dFll #() dFpp -> dFpp +#() lFEi -> lFEi #() lFEV -> lFEV #() lFES -> lFES #() lFii -> lFii @@ -1177,6 +1177,9 @@ wrappedlibc: - uFS: - getwc - UFp: +- lFi: + - __sysconf + - sysconf - lFp: - atol - lFV: diff --git a/src/wrapped32/generated/wrappedlibctypes32.h b/src/wrapped32/generated/wrappedlibctypes32.h index f0538b7d1..e43ab6408 100644 --- a/src/wrapped32/generated/wrappedlibctypes32.h +++ b/src/wrapped32/generated/wrappedlibctypes32.h @@ -21,6 +21,7 @@ typedef int32_t (*iFO_t)(int32_t); typedef uint32_t (*uFp_t)(void*); typedef uint32_t (*uFS_t)(void*); typedef uint64_t (*UFp_t)(void*); +typedef intptr_t (*lFi_t)(int32_t); typedef intptr_t (*lFp_t)(void*); typedef intptr_t (*lFV_t)(...); typedef intptr_t (*lFS_t)(void*); @@ -103,6 +104,8 @@ typedef int32_t (*iFpLiLppp_t)(void*, uintptr_t, int32_t, uintptr_t, void*, void GO(__close_nocancel, iFi_t) \ GO(sysinfo, iFp_t) \ GO(getwc, uFS_t) \ + GO(__sysconf, lFi_t) \ + GO(sysconf, lFi_t) \ GO(atol, lFp_t) \ GO(ftell, lFS_t) \ GO(__ctype_b_loc, pFv_t) \ diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index 3ce091800..06924ed81 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -145,7 +145,6 @@ typedef double (*dFi_t)(int32_t); typedef double (*dFd_t)(double); typedef double (*dFp_t)(void*); typedef intptr_t (*lFv_t)(void); -typedef intptr_t (*lFi_t)(int32_t); typedef intptr_t (*lFu_t)(uint32_t); typedef intptr_t (*lFl_t)(intptr_t); typedef intptr_t (*lFp_t)(void*); @@ -278,6 +277,7 @@ typedef double (*dFdD_t)(double, long double); typedef double (*dFdp_t)(double, void*); typedef double (*dFll_t)(intptr_t, intptr_t); typedef double (*dFpp_t)(void*, void*); +typedef intptr_t (*lFEi_t)(x64emu_t*, int32_t); typedef intptr_t (*lFEV_t)(x64emu_t*, void*); typedef intptr_t (*lFES_t)(x64emu_t*, void*); typedef intptr_t (*lFii_t)(int32_t, int32_t); @@ -1235,7 +1235,6 @@ void dFi_32(x64emu_t *emu, uintptr_t fcn) { dFi_t fn = (dFi_t)fcn; double db = f void dFd_32(x64emu_t *emu, uintptr_t fcn) { dFd_t fn = (dFd_t)fcn; double db = fn(from_ptri(double, R_ESP + 4)); fpu_do_push(emu); ST0val = db; } void dFp_32(x64emu_t *emu, uintptr_t fcn) { dFp_t fn = (dFp_t)fcn; double db = fn(from_ptriv(R_ESP + 4)); fpu_do_push(emu); ST0val = db; } void lFv_32(x64emu_t *emu, uintptr_t fcn) { lFv_t fn = (lFv_t)fcn; R_EAX = to_long(fn()); } -void lFi_32(x64emu_t *emu, uintptr_t fcn) { lFi_t fn = (lFi_t)fcn; R_EAX = to_long(fn(from_ptri(int32_t, R_ESP + 4))); } void lFu_32(x64emu_t *emu, uintptr_t fcn) { lFu_t fn = (lFu_t)fcn; R_EAX = to_long(fn(from_ptri(uint32_t, R_ESP + 4))); } void lFl_32(x64emu_t *emu, uintptr_t fcn) { lFl_t fn = (lFl_t)fcn; R_EAX = to_long(fn(to_long(from_ptri(long_t, R_ESP + 4)))); } void lFp_32(x64emu_t *emu, uintptr_t fcn) { lFp_t fn = (lFp_t)fcn; R_EAX = to_long(fn(from_ptriv(R_ESP + 4))); } @@ -1368,6 +1367,7 @@ void dFdD_32(x64emu_t *emu, uintptr_t fcn) { dFdD_t fn = (dFdD_t)fcn; double db void dFdp_32(x64emu_t *emu, uintptr_t fcn) { dFdp_t fn = (dFdp_t)fcn; double db = fn(from_ptri(double, R_ESP + 4), from_ptriv(R_ESP + 12)); fpu_do_push(emu); ST0val = db; } void dFll_32(x64emu_t *emu, uintptr_t fcn) { dFll_t fn = (dFll_t)fcn; double db = fn(to_long(from_ptri(long_t, R_ESP + 4)), to_long(from_ptri(long_t, R_ESP + 8))); fpu_do_push(emu); ST0val = db; } void dFpp_32(x64emu_t *emu, uintptr_t fcn) { dFpp_t fn = (dFpp_t)fcn; double db = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8)); fpu_do_push(emu); ST0val = db; } +void lFEi_32(x64emu_t *emu, uintptr_t fcn) { lFEi_t fn = (lFEi_t)fcn; R_EAX = to_long(fn(emu, from_ptri(int32_t, R_ESP + 4))); } void lFEV_32(x64emu_t *emu, uintptr_t fcn) { lFEV_t fn = (lFEV_t)fcn; R_EAX = to_long(fn(emu, from_ptrv(R_ESP + 4))); } void lFES_32(x64emu_t *emu, uintptr_t fcn) { lFES_t fn = (lFES_t)fcn; R_EAX = to_long(fn(emu, io_convert32(from_ptriv(R_ESP + 4)))); } void lFii_32(x64emu_t *emu, uintptr_t fcn) { lFii_t fn = (lFii_t)fcn; R_EAX = to_long(fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8))); } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index cb95d1d29..50f7f7561 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -96,7 +96,6 @@ void dFi_32(x64emu_t *emu, uintptr_t fnc); void dFd_32(x64emu_t *emu, uintptr_t fnc); void dFp_32(x64emu_t *emu, uintptr_t fnc); void lFv_32(x64emu_t *emu, uintptr_t fnc); -void lFi_32(x64emu_t *emu, uintptr_t fnc); void lFu_32(x64emu_t *emu, uintptr_t fnc); void lFl_32(x64emu_t *emu, uintptr_t fnc); void lFp_32(x64emu_t *emu, uintptr_t fnc); @@ -229,6 +228,7 @@ void dFdD_32(x64emu_t *emu, uintptr_t fnc); void dFdp_32(x64emu_t *emu, uintptr_t fnc); void dFll_32(x64emu_t *emu, uintptr_t fnc); void dFpp_32(x64emu_t *emu, uintptr_t fnc); +void lFEi_32(x64emu_t *emu, uintptr_t fnc); void lFEV_32(x64emu_t *emu, uintptr_t fnc); void lFES_32(x64emu_t *emu, uintptr_t fnc); void lFii_32(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped32/wrappedlibc.c b/src/wrapped32/wrappedlibc.c index 1c533b53f..e26894f73 100755 --- a/src/wrapped32/wrappedlibc.c +++ b/src/wrapped32/wrappedlibc.c @@ -1658,6 +1658,23 @@ EXPORT FILE* my32_fopen64(x64emu_t* emu, const char* path, const char* mode) return fopen64(path, mode); } +#ifndef _SC_NPROCESSORS_ONLN +#define _SC_NPROCESSORS_ONLN 84 +#endif +#ifndef _SC_NPROCESSORS_CONF +#define _SC_NPROCESSORS_CONF 83 +#endif +EXPORT long my32_sysconf(x64emu_t* emu, int what) { + if(what==_SC_NPROCESSORS_ONLN) { + return getNCpu(); + } + if(what==_SC_NPROCESSORS_CONF) { + return getNCpu(); + } + return sysconf(what); +} +EXPORT long my32___sysconf(x64emu_t* emu, int what) __attribute__((alias("my32_sysconf"))); + #if 0 EXPORT int my32_mkstemps64(x64emu_t* emu, char* template, int suffixlen) { diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h index 1b2831e54..dd9cb9cf5 100755 --- a/src/wrapped32/wrappedlibc_private.h +++ b/src/wrapped32/wrappedlibc_private.h @@ -1768,8 +1768,8 @@ GO(sync, vFv) GO(syncfs, iFi) // sync_file_range GOM(syscall, lFEV) //%% -GOW(sysconf, lFi) -GO(__sysconf, lFi) +GOWM(sysconf, lFEi) +GOM(__sysconf, lFEi) // sysctl // Weak //GO(__sysctl, iFp) //DATA(_sys_errlist, 4)