[BOX32] Added more 32bits wrapped function and reworked 32bits memory allocator

This commit is contained in:
ptitSeb 2024-10-03 19:36:42 +02:00
parent 0e91ad3ed3
commit 9e853e487d
14 changed files with 528 additions and 461 deletions

View File

@ -1166,8 +1166,8 @@ def generate_files(root: str, files: Iterable[str], ver: str, gbls: SortedGlobal
"from_ptri(double, R_ESP + {p}), ", # d
"LD2localLD(from_ptrv(R_ESP + {p})), ", # D
"FromLD(from_ptrv(R_ESP + {p})), ", # K
"to_long(from_ptri(long_t, R_ESP + {p})), ", # l
"to_ulong(from_ptri(ulong_t, R_ESP + {p})), ", # L
"from_long(from_ptri(long_t, R_ESP + {p})), ", # l
"from_ulong(from_ptri(ulong_t, R_ESP + {p})), ", # L
"from_ptriv(R_ESP + {p}), ", # p
"from_hash(from_ptri(ptr_t, R_ESP + {p})), ", # h
"from_hash_d(from_ptri(ptr_t, R_ESP + {p})), ", # H

View File

@ -1579,14 +1579,14 @@ void loadProtectionFromMap()
box64_mapclean = 1;
}
int isAddrInPrereserve(uintptr_t addr);
int isAddrInPrereserve(uintptr_t addr, size_t len);
void freeProtection(uintptr_t addr, size_t size)
{
size = ALIGN(size);
addr &= ~(box64_pagesize-1);
dynarec_log(LOG_DEBUG, "freeProtection %p:%p\n", (void*)addr, (void*)(addr+size-1));
LOCK_PROT();
if(!isAddrInPrereserve(addr)) {
if(!isAddrInPrereserve(addr, size)) {
rb_unset(mapallmem, addr, addr+size);
rb_unset(mmapmem, addr, addr+size);
}
@ -1612,14 +1612,28 @@ int getMmapped(uintptr_t addr)
#define MEDIUM (void*)0x40000000
#define HIGH (void*)0x60000000
void* find31bitBlockNearHint(void* hint, size_t size, uintptr_t mask)
void* find31bitBlockNearHint(void* hint_, size_t size, uintptr_t mask)
{
uint32_t prot;
if(hint<LOWEST) hint = WINE_LOWEST;
uintptr_t hint = (uintptr_t)hint_;
if(hint_<LOWEST) hint = (uintptr_t)WINE_LOWEST;
uintptr_t bend = 0;
uintptr_t cur = (uintptr_t)hint;
uintptr_t upper = 0xc0000000LL;
if(cur>upper) upper = 0x100000000LL;
if(!mask) mask = 0xffff;
while(bend<0xc0000000LL) {
while(cur<upper) {
if(!rb_get_end(mapallmem, cur, &prot, &bend)) {
if(bend-cur>=size)
return (void*)cur;
}
// granularity 0x10000
cur = (bend+mask)&~mask;
}
if(hint_)
return NULL;
cur = (uintptr_t)LOWEST;
while(cur<(uintptr_t)hint) {
if(!rb_get_end(mapallmem, cur, &prot, &bend)) {
if(bend-cur>=size)
return (void*)cur;

View File

@ -212,10 +212,10 @@ void x86Int3(x64emu_t* emu, uintptr_t* addr)
snprintf(buff, 255, "%04d|%p: Calling %s(%d, %p, %d)", tid, from_ptrv(*(ptr_t*)from_ptr(R_ESP)), (char *)s, *(int*)from_ptr(R_ESP+4), p16, *(int*)from_ptr(R_ESP+12));
perr = 1;
} else if(!strcmp(s, "mmap64")) {
snprintf(buff, 255, "%04d|%p: Calling %s(%p, 0x%x, %d, 0x%x, %d, %ld)", tid, from_ptrv(*(ptr_t*)from_ptr(R_ESP)), (char *)s, from_ptrv(*(ptr_t*)from_ptr(R_ESP+4)), *(ulong_t*)from_ptr(R_ESP+8), *(int*)from_ptr(R_ESP+12), *(int*)from_ptr(R_ESP+16), *(int*)from_ptr(R_ESP+20), *(int64_t*)from_ptr(R_ESP+24));
snprintf(buff, 255, "%04d|%p: Calling %s(%p, 0x%x, %d, 0x%x, %d, %ld)", tid, from_ptrv(*(ptr_t*)from_ptr(R_ESP)), (char *)s, from_ptrv(*(ptr_t*)from_ptr(R_ESP+4)), from_ptri(ulong_t, R_ESP+8), from_ptri(int, R_ESP+12), from_ptri(int, R_ESP+16), from_ptri(int, R_ESP+20),from_ptri(int64_t, R_ESP+24));
perr = 3;
} else if(!strcmp(s, "mmap")) {
snprintf(buff, 255, "%04d|%p: Calling %s(%p, 0x%x, %d, 0x%x, %d, %d)", tid, from_ptrv(*(ptr_t*)from_ptr(R_ESP)), (char *)s, from_ptrv(*(ptr_t*)from_ptr(R_ESP+4)), *(ulong_t*)from_ptr(R_ESP+8), *(int*)from_ptr(R_ESP+12), *(int*)from_ptr(R_ESP+16), *(int*)from_ptr(R_ESP+20), *(int*)from_ptr(R_ESP+24));
snprintf(buff, 255, "%04d|%p: Calling %s(%p, 0x%x, %d, 0x%x, %d, %d)", tid, from_ptrv(*(ptr_t*)from_ptr(R_ESP)), (char *)s, from_ptrv(*(ptr_t*)from_ptr(R_ESP+4)), from_ptri(ulong_t, R_ESP+8), from_ptri(int, R_ESP+12), from_ptri(int, R_ESP+16), from_ptri(int, R_ESP+20), from_ptri(int, R_ESP+24));
perr = 3;
} else if(strstr(s, "strcasecmp")==s || strstr(s, "__strcasecmp")==s) {
snprintf(buff, 255, "%04d|%p: Calling %s(\"%s\", \"%s\")", tid, from_ptrv(*(ptr_t*)from_ptr(R_ESP)), (char *)s, (char *)from_ptrv(*(ptr_t*)from_ptr(R_ESP+4)), (char *)from_ptrv(*(ptr_t*)from_ptr(R_ESP+8)));

View File

@ -49,8 +49,25 @@ unsigned long real_getauxval(unsigned long type)
return 0;
}
#ifdef BOX32
EXPORT unsigned long my32_getauxval(x64emu_t* emu, unsigned long type)
{
ptr_t* p = (ptr_t*)emu->context->auxval_start;
while(*p) {
if(*p == type)
return p[1];
p+=2;
}
return 0;
}
#endif
EXPORT unsigned long my_getauxval(x64emu_t* emu, unsigned long type)
{
#ifdef BOX32
if(box64_is32bits)
return my32_getauxval(emu, type);
#endif
uintptr_t* p = emu->context->auxval_start;
while(*p) {
if(*p == type)

View File

@ -94,13 +94,13 @@ void* get_wine_prereserve()
}
extern int box64_quit;
int isAddrInPrereserve(uintptr_t addr)
int isAddrInPrereserve(uintptr_t addr, size_t len)
{
if(!wine_preloaded || box64_quit)
return 0;
int idx = 0;
while(my_wine_reserve[idx].addr && my_wine_reserve[idx].size) {
if(addr>=(uintptr_t)my_wine_reserve[idx].addr && addr<((uintptr_t)my_wine_reserve[idx].addr+my_wine_reserve[idx].size))
if((addr>=(uintptr_t)my_wine_reserve[idx].addr) && (addr+len)<((uintptr_t)my_wine_reserve[idx].addr+my_wine_reserve[idx].size))
return 1;
++idx;
}

View File

@ -2916,7 +2916,7 @@ EXPORT int my_readlinkat(x64emu_t* emu, int fd, void* path, void* buf, size_t bu
#define MAP_32BIT 0x40
#endif
extern int have48bits;
EXPORT void* my_mmap64(x64emu_t* emu, void *addr, unsigned long length, int prot, int flags, int fd, ssize_t offset)
EXPORT void* my_mmap64(x64emu_t* emu, void *addr, size_t length, int prot, int flags, int fd, ssize_t offset)
{
(void)emu;
if(prot&PROT_WRITE)
@ -2926,7 +2926,7 @@ EXPORT void* my_mmap64(x64emu_t* emu, void *addr, unsigned long length, int prot
#ifndef NOALIGN
void* old_addr = addr;
new_flags&=~MAP_32BIT; // remove MAP_32BIT
if(flags&MAP_32BIT) {
if((flags&MAP_32BIT) && !(flags&MAP_FIXED)) {
// MAP_32BIT only exist on x86_64!
addr = find31bitBlockNearHint(old_addr, length, 0);
} else if (box64_wine || 1) { // other mmap should be restricted to 47bits
@ -3018,7 +3018,7 @@ EXPORT void* my_mmap64(x64emu_t* emu, void *addr, unsigned long length, int prot
}
return ret;
}
EXPORT void* my_mmap(x64emu_t* emu, void *addr, unsigned long length, int prot, int flags, int fd, ssize_t offset) __attribute__((alias("my_mmap64")));
EXPORT void* my_mmap(x64emu_t* emu, void *addr, size_t length, int prot, int flags, int fd, ssize_t offset) __attribute__((alias("my_mmap64")));
EXPORT void* my_mremap(x64emu_t* emu, void* old_addr, size_t old_size, size_t new_size, int flags, void* new_addr)
{
@ -3070,10 +3070,10 @@ EXPORT void* my_mremap(x64emu_t* emu, void* old_addr, size_t old_size, size_t ne
return ret;
}
EXPORT int my_munmap(x64emu_t* emu, void* addr, unsigned long length)
EXPORT int my_munmap(x64emu_t* emu, void* addr, size_t length)
{
(void)emu;
if((emu || box64_is32bits) && (box64_log>=LOG_DEBUG || box64_dynarec_log>=LOG_DEBUG)) {printf_log(LOG_NONE, "munmap(%p, %lu)\n", addr, length);}
if((emu || box64_is32bits) && (box64_log>=LOG_DEBUG || box64_dynarec_log>=LOG_DEBUG)) {printf_log(LOG_NONE, "munmap(%p, 0x%lx)\n", addr, length);}
int ret = internal_munmap(addr, length);
#ifdef DYNAREC
if(!ret && box64_dynarec && length) {
@ -3089,7 +3089,7 @@ EXPORT int my_munmap(x64emu_t* emu, void* addr, unsigned long length)
EXPORT int my_mprotect(x64emu_t* emu, void *addr, unsigned long len, int prot)
{
(void)emu;
if(emu && (box64_log>=LOG_DEBUG || box64_dynarec_log>=LOG_DEBUG)) {printf_log(LOG_NONE, "mprotect(%p, %lu, 0x%x)\n", addr, len, prot);}
if(emu && (box64_log>=LOG_DEBUG || box64_dynarec_log>=LOG_DEBUG)) {printf_log(LOG_NONE, "mprotect(%p, 0x%lx, 0x%x)\n", addr, len, prot);}
if(prot&PROT_WRITE)
prot|=PROT_READ; // PROT_READ is implicit with PROT_WRITE on x86_64
int ret = mprotect(addr, len, prot);

View File

@ -59,6 +59,23 @@ void to_struct_LL(ptr_t d, const struct_LL_t *src) {
*(ulong_t*)dest = to_ulong(src->L1); dest += 4;
}
void from_struct_llll(struct_llll_t *dest, ptr_t s) {
if(!s) return;
uint8_t* src = (uint8_t*)from_ptrv(s);
dest->l0 = from_long(*(ulong_t*)src); src += 4;
dest->l1 = from_long(*(ulong_t*)src); src += 4;
dest->l2 = from_long(*(ulong_t*)src); src += 4;
dest->l3 = from_long(*(ulong_t*)src); src += 4;
}
void to_struct_llll(ptr_t d, const struct_llll_t *src) {
if (!src) return;
uint8_t* dest = (uint8_t*)from_ptrv(d);
*(ulong_t*)dest = to_long(src->l0); dest += 4;
*(ulong_t*)dest = to_long(src->l1); dest += 4;
*(ulong_t*)dest = to_long(src->l2); dest += 4;
*(ulong_t*)dest = to_long(src->l3); dest += 4;
}
void from_struct_LLLL(struct_LLLL_t *dest, ptr_t s) {
if(!s) return;
uint8_t* src = (uint8_t*)from_ptrv(s);

View File

@ -31,6 +31,14 @@ typedef struct struct_LL_s {
} struct_LL_t;
void from_struct_LL(struct_LL_t *dest, ptr_t src);
void to_struct_LL(ptr_t dest, const struct_LL_t *src);
typedef struct struct_llll_s {
long l0;
long l1;
long l2;
long l3;
} struct_llll_t;
void from_struct_llll(struct_llll_t *dest, ptr_t src);
void to_struct_llll(ptr_t dest, const struct_llll_t *src);
typedef struct struct_LLLL_s {
unsigned long L0;
unsigned long L1;

View File

@ -78,6 +78,7 @@
#() iFBp_ -> iFB
#() LFrl_ -> LFB
#() pFrl_ -> pFB
#() iFBllll_ -> iFB
#() vFbuuipWCCp_ -> vFB
#() LFriiiiiiiiilt_ -> LFB
#() pFriiiiiiiiilt_ -> pFB
@ -147,6 +148,7 @@
#() iFpL -> iFpL
#() iFpp -> iFpp
#() iFpV -> iFpV
#() iFpO -> iFpO
#() iFpS -> iFpS
#() iFhi -> iFhi
#() iFhp -> iFhp
@ -351,6 +353,7 @@
#() iFpUU -> iFpUU
#() iFpfu -> iFpfu
#() iFpLi -> iFpLi
#() iFpLu -> iFpLu
#() iFpLp -> iFpLp
#() iFppi -> iFppi
#() iFppu -> iFppu
@ -571,9 +574,12 @@
#() iFiIIi -> iFiIIi
#() iFilli -> iFilli
#() iFipii -> iFipii
#() iFipip -> iFipip
#() iFipui -> iFipui
#() iFipup -> iFipup
#() iFippi -> iFippi
#() iFippL -> iFippL
#() iFipON -> iFipON
#() iFuiup -> iFuiup
#() iFuupi -> iFuupi
#() iFpiiL -> iFpiiL
@ -585,6 +591,7 @@
#() iFppui -> iFppui
#() iFppLi -> iFppLi
#() iFpppi -> iFpppi
#() iFpppL -> iFpppL
#() iFpppp -> iFpppp
#() iFSpiL -> iFSpiL
#() iFXiip -> iFXiip
@ -605,6 +612,7 @@
#() lFEppL -> lFEppL
#() lFiipL -> lFiipL
#() lFipLi -> lFipLi
#() lFipLI -> lFipLI
#() lFipLl -> lFipLl
#() lFpuip -> lFpuip
#() LFEpLp -> LFEpLp
@ -641,6 +649,7 @@
#() lFiibl_L -> lFiiBL
#() LFpbp_Lp -> LFpBLp
#() iFEpprLL_ -> iFEppB
#() iFpurLL_p -> iFpuBp
#() vFXLrpLiL_L -> vFXLBL
#() iFuirLL_BLL_ -> iFuiBB
#() iFXLpBLWWWcc_ -> iFXLpB
@ -743,6 +752,7 @@
#() vFppppp -> vFppppp
#() iFEiiip -> iFEiiip
#() iFEipii -> iFEipii
#() iFEippL -> iFEippL
#() iFEpipp -> iFEpipp
#() iFEpupu -> iFEpupu
#() iFEpLpp -> iFEpLpp
@ -759,6 +769,7 @@
#() iFiiipp -> iFiiipp
#() iFiLLLL -> iFiLLLL
#() iFipLLi -> iFipLLi
#() iFippLi -> iFippLi
#() iFuiuup -> iFuiuup
#() iFpippp -> iFpippp
#() iFpCCCC -> iFpCCCC
@ -863,6 +874,7 @@
#() vFppupii -> vFppupii
#() vFpppppp -> vFpppppp
#() vFXLiiii -> vFXLiiii
#() iFEiippi -> iFEiippi
#() iFEuppLp -> iFEuppLp
#() iFEpiLpp -> iFEpiLpp
#() iFEpuuup -> iFEpuuup
@ -944,6 +956,7 @@
#() vFpddiidd -> vFpddiidd
#() iFEpLiipV -> iFEpLiipV
#() iFEpLiLpV -> iFEpLiLpV
#() iFEpppppp -> iFEpppppp
#() iFEXLpppp -> iFEXLpppp
#() iFuiiiuup -> iFuiiiuup
#() iFpWCiWCi -> iFpWCiWCi
@ -1235,6 +1248,7 @@ wrappedlibc:
- vFpi:
- vFpu:
- iFip:
- futimens
- futimes
- iFup:
- getrlimit
@ -1304,6 +1318,8 @@ wrappedlibc:
- iFipii:
- iFippi:
- utimensat
- iFippL:
- readlinkat
- iFpipp:
- iFpLpp:
- iFpLpV:
@ -1312,6 +1328,7 @@ wrappedlibc:
- iFSvpp:
- iFSvpV:
- LFpBp_iv:
- iFiippi:
- iFuppLp:
- getgrgid_r
- getpwuid_r
@ -1325,6 +1342,8 @@ wrappedlibc:
- iFpLvvpp:
- iFpLiipV:
- iFpLiLpV:
- iFpppppp:
- posix_spawn
- pFpLiiiI:
- pFpLiiil:
- iFpippppp:

View File

@ -78,6 +78,7 @@ typedef int32_t (*iFivpV_t)(int32_t, void, void*, ...);
typedef int32_t (*iFiiip_t)(int32_t, int32_t, int32_t, void*);
typedef int32_t (*iFipii_t)(int32_t, void*, int32_t, int32_t);
typedef int32_t (*iFippi_t)(int32_t, void*, void*, int32_t);
typedef int32_t (*iFippL_t)(int32_t, void*, void*, uintptr_t);
typedef int32_t (*iFpipp_t)(void*, int32_t, void*, void*);
typedef int32_t (*iFpLpp_t)(void*, uintptr_t, void*, void*);
typedef int32_t (*iFpLpV_t)(void*, uintptr_t, void*, ...);
@ -85,6 +86,7 @@ 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 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 (*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*);
@ -94,6 +96,7 @@ typedef void* (*pFppLLp_t)(void*, void*, uintptr_t, uintptr_t, void*);
typedef int32_t (*iFpLvvpp_t)(void*, uintptr_t, void, void, void*, void*);
typedef int32_t (*iFpLiipV_t)(void*, uintptr_t, int32_t, int32_t, void*, ...);
typedef int32_t (*iFpLiLpV_t)(void*, uintptr_t, int32_t, uintptr_t, void*, ...);
typedef int32_t (*iFpppppp_t)(void*, void*, void*, void*, void*, void*);
typedef void* (*pFpLiiiI_t)(void*, uintptr_t, int32_t, int32_t, int32_t, int64_t);
typedef void* (*pFpLiiil_t)(void*, uintptr_t, int32_t, int32_t, int32_t, intptr_t);
typedef int32_t (*iFpippppp_t)(void*, int32_t, void*, void*, void*, void*, void*);
@ -123,6 +126,7 @@ typedef int32_t (*iFpLiLppp_t)(void*, uintptr_t, int32_t, uintptr_t, void*, void
GO(getmntent, pFS_t) \
GO(getifaddrs, iFbp__t) \
GO(asctime, pFriiiiiiiiilt__t) \
GO(futimens, iFip_t) \
GO(futimes, iFip_t) \
GO(getrlimit, iFup_t) \
GO(setrlimit, iFup_t) \
@ -151,10 +155,12 @@ typedef int32_t (*iFpLiLppp_t)(void*, uintptr_t, int32_t, uintptr_t, void*, void
GO(wcstol, lFpBp_i_t) \
GO(wcstoul, LFpBp_i_t) \
GO(utimensat, iFippi_t) \
GO(readlinkat, iFippL_t) \
GO(getaddrinfo, iFpppp_t) \
GO(getgrgid_r, iFuppLp_t) \
GO(getpwuid_r, iFuppLp_t) \
GO(getgrnam_r, iFpppLp_t) \
GO(getpwnam_r, iFpppLp_t)
GO(getpwnam_r, iFpppLp_t) \
GO(posix_spawn, iFpppppp_t)
#endif // __wrappedlibcTYPES32_H_

File diff suppressed because it is too large Load Diff

View File

@ -119,6 +119,7 @@ void XFv_32(x64emu_t *emu, uintptr_t fnc);
void iFBp__32(x64emu_t *emu, uintptr_t fnc);
void LFrl__32(x64emu_t *emu, uintptr_t fnc);
void pFrl__32(x64emu_t *emu, uintptr_t fnc);
void iFBllll__32(x64emu_t *emu, uintptr_t fnc);
void vFbuuipWCCp__32(x64emu_t *emu, uintptr_t fnc);
void LFriiiiiiiiilt__32(x64emu_t *emu, uintptr_t fnc);
void pFriiiiiiiiilt__32(x64emu_t *emu, uintptr_t fnc);
@ -188,6 +189,7 @@ void iFpl_32(x64emu_t *emu, uintptr_t fnc);
void iFpL_32(x64emu_t *emu, uintptr_t fnc);
void iFpp_32(x64emu_t *emu, uintptr_t fnc);
void iFpV_32(x64emu_t *emu, uintptr_t fnc);
void iFpO_32(x64emu_t *emu, uintptr_t fnc);
void iFpS_32(x64emu_t *emu, uintptr_t fnc);
void iFhi_32(x64emu_t *emu, uintptr_t fnc);
void iFhp_32(x64emu_t *emu, uintptr_t fnc);
@ -392,6 +394,7 @@ void iFpuU_32(x64emu_t *emu, uintptr_t fnc);
void iFpUU_32(x64emu_t *emu, uintptr_t fnc);
void iFpfu_32(x64emu_t *emu, uintptr_t fnc);
void iFpLi_32(x64emu_t *emu, uintptr_t fnc);
void iFpLu_32(x64emu_t *emu, uintptr_t fnc);
void iFpLp_32(x64emu_t *emu, uintptr_t fnc);
void iFppi_32(x64emu_t *emu, uintptr_t fnc);
void iFppu_32(x64emu_t *emu, uintptr_t fnc);
@ -612,9 +615,12 @@ void iFiiII_32(x64emu_t *emu, uintptr_t fnc);
void iFiIIi_32(x64emu_t *emu, uintptr_t fnc);
void iFilli_32(x64emu_t *emu, uintptr_t fnc);
void iFipii_32(x64emu_t *emu, uintptr_t fnc);
void iFipip_32(x64emu_t *emu, uintptr_t fnc);
void iFipui_32(x64emu_t *emu, uintptr_t fnc);
void iFipup_32(x64emu_t *emu, uintptr_t fnc);
void iFippi_32(x64emu_t *emu, uintptr_t fnc);
void iFippL_32(x64emu_t *emu, uintptr_t fnc);
void iFipON_32(x64emu_t *emu, uintptr_t fnc);
void iFuiup_32(x64emu_t *emu, uintptr_t fnc);
void iFuupi_32(x64emu_t *emu, uintptr_t fnc);
void iFpiiL_32(x64emu_t *emu, uintptr_t fnc);
@ -626,6 +632,7 @@ void iFppip_32(x64emu_t *emu, uintptr_t fnc);
void iFppui_32(x64emu_t *emu, uintptr_t fnc);
void iFppLi_32(x64emu_t *emu, uintptr_t fnc);
void iFpppi_32(x64emu_t *emu, uintptr_t fnc);
void iFpppL_32(x64emu_t *emu, uintptr_t fnc);
void iFpppp_32(x64emu_t *emu, uintptr_t fnc);
void iFSpiL_32(x64emu_t *emu, uintptr_t fnc);
void iFXiip_32(x64emu_t *emu, uintptr_t fnc);
@ -646,6 +653,7 @@ void lFEipi_32(x64emu_t *emu, uintptr_t fnc);
void lFEppL_32(x64emu_t *emu, uintptr_t fnc);
void lFiipL_32(x64emu_t *emu, uintptr_t fnc);
void lFipLi_32(x64emu_t *emu, uintptr_t fnc);
void lFipLI_32(x64emu_t *emu, uintptr_t fnc);
void lFipLl_32(x64emu_t *emu, uintptr_t fnc);
void lFpuip_32(x64emu_t *emu, uintptr_t fnc);
void LFEpLp_32(x64emu_t *emu, uintptr_t fnc);
@ -682,6 +690,7 @@ void UFpBp_ii_32(x64emu_t *emu, uintptr_t fnc);
void lFiibl_L_32(x64emu_t *emu, uintptr_t fnc);
void LFpbp_Lp_32(x64emu_t *emu, uintptr_t fnc);
void iFEpprLL__32(x64emu_t *emu, uintptr_t fnc);
void iFpurLL_p_32(x64emu_t *emu, uintptr_t fnc);
void vFXLrpLiL_L_32(x64emu_t *emu, uintptr_t fnc);
void iFuirLL_BLL__32(x64emu_t *emu, uintptr_t fnc);
void iFXLpBLWWWcc__32(x64emu_t *emu, uintptr_t fnc);
@ -784,6 +793,7 @@ void vFppppu_32(x64emu_t *emu, uintptr_t fnc);
void vFppppp_32(x64emu_t *emu, uintptr_t fnc);
void iFEiiip_32(x64emu_t *emu, uintptr_t fnc);
void iFEipii_32(x64emu_t *emu, uintptr_t fnc);
void iFEippL_32(x64emu_t *emu, uintptr_t fnc);
void iFEpipp_32(x64emu_t *emu, uintptr_t fnc);
void iFEpupu_32(x64emu_t *emu, uintptr_t fnc);
void iFEpLpp_32(x64emu_t *emu, uintptr_t fnc);
@ -800,6 +810,7 @@ void iFiiipu_32(x64emu_t *emu, uintptr_t fnc);
void iFiiipp_32(x64emu_t *emu, uintptr_t fnc);
void iFiLLLL_32(x64emu_t *emu, uintptr_t fnc);
void iFipLLi_32(x64emu_t *emu, uintptr_t fnc);
void iFippLi_32(x64emu_t *emu, uintptr_t fnc);
void iFuiuup_32(x64emu_t *emu, uintptr_t fnc);
void iFpippp_32(x64emu_t *emu, uintptr_t fnc);
void iFpCCCC_32(x64emu_t *emu, uintptr_t fnc);
@ -904,6 +915,7 @@ void vFpdddii_32(x64emu_t *emu, uintptr_t fnc);
void vFppupii_32(x64emu_t *emu, uintptr_t fnc);
void vFpppppp_32(x64emu_t *emu, uintptr_t fnc);
void vFXLiiii_32(x64emu_t *emu, uintptr_t fnc);
void iFEiippi_32(x64emu_t *emu, uintptr_t fnc);
void iFEuppLp_32(x64emu_t *emu, uintptr_t fnc);
void iFEpiLpp_32(x64emu_t *emu, uintptr_t fnc);
void iFEpuuup_32(x64emu_t *emu, uintptr_t fnc);
@ -985,6 +997,7 @@ void vFpipipiu_32(x64emu_t *emu, uintptr_t fnc);
void vFpddiidd_32(x64emu_t *emu, uintptr_t fnc);
void iFEpLiipV_32(x64emu_t *emu, uintptr_t fnc);
void iFEpLiLpV_32(x64emu_t *emu, uintptr_t fnc);
void iFEpppppp_32(x64emu_t *emu, uintptr_t fnc);
void iFEXLpppp_32(x64emu_t *emu, uintptr_t fnc);
void iFuiiiuup_32(x64emu_t *emu, uintptr_t fnc);
void iFpWCiWCi_32(x64emu_t *emu, uintptr_t fnc);

View File

@ -824,20 +824,16 @@ EXPORT int my32_sprintf(x64emu_t* emu, void* buff, void * fmt, void * b) {
}
EXPORT int my32___sprintf_chk(x64emu_t* emu, void* buff, void * fmt, void * b) __attribute__((alias("my32_sprintf")));
#if 0
EXPORT int my32_asprintf(x64emu_t* emu, void** buff, void * fmt, void * b) {
#ifndef NOALIGN
EXPORT int my32_asprintf(x64emu_t* emu, ptr_t* buff, void * fmt, void * b) {
// need to align on arm
myStackAlign32((const char*)fmt, b, emu->scratch);
PREPARE_VALIST_32;
void* f = vasprintf;
return ((iFppp_t)f)(buff, fmt, VARARGS_32);
#else
return vasprintf((char**)buff, (char*)fmt, b);
#endif
char* res = NULL;
int ret = vasprintf(&res, fmt, VARARGS_32);
*buff = to_ptrv(res);
return ret;
}
EXPORT int my32___asprintf(x64emu_t* emu, void** buff, void * fmt, void * b) __attribute__((alias("my32_asprintf")));
#endif
EXPORT int my32_vsprintf(x64emu_t* emu, void* buff, void * fmt, uint32_t * b) {
// need to align on arm
@ -889,12 +885,14 @@ EXPORT int my32_vsnprintf(x64emu_t* emu, void* buff, size_t s, void * fmt, void
}
EXPORT int my32___vsnprintf(x64emu_t* emu, void* buff, size_t s, void * fmt, void * b) __attribute__((alias("my32_vsnprintf")));
EXPORT int my32___vsnprintf_chk(x64emu_t* emu, void* buff, size_t s, void * fmt, void * b) __attribute__((alias("my32_vsnprintf")));
EXPORT int my32_vasprintf(x64emu_t* emu, void* strp, void* fmt, void* b)
EXPORT int my32_vasprintf(x64emu_t* emu, ptr_t* strp, void* fmt, void* b)
{
// need to align on arm
myStackAlign32((const char*)fmt, (uint32_t*)b, emu->scratch);
PREPARE_VALIST_32;
int r = vasprintf(strp, fmt, VARARGS_32);
char* res = NULL;
int r = vasprintf(&res, fmt, VARARGS_32);
*strp = to_ptrv(res);
return r;
}
EXPORT int my32___vasprintf_chk(x64emu_t* emu, void* strp, int flags, void* fmt, void* b)
@ -1181,15 +1179,15 @@ EXPORT int my32___fxstatat(x64emu_t* emu, int v, int d, void* path, void* buf, i
r = FillStatFromStat64(v, &st, buf);
return r;
}
#endif
EXPORT int my32___fxstatat64(x64emu_t* emu, int v, int d, void* path, void* buf, int flags)
{
struct stat64 st;
int r = fstatat64(d, path, &st, flags);
UnalignStat64(&st, buf);
UnalignStat64_32(&st, buf);
return r;
}
#if 0
EXPORT int my32__IO_file_stat(x64emu_t* emu, void* f, void* buf)
{
struct stat64 st;
@ -1965,17 +1963,94 @@ EXPORT int32_t my32_execvp(x64emu_t* emu, const char* path, ptr_t argv[])
newargv[i+1] = from_ptrv(argv[i]);
return execv(fullpath, (void*)newargv);
}
#if 0
// execvp should use PATH to search for the program first
EXPORT int32_t my32_posix_spawnp(x64emu_t* emu, pid_t* pid, const char* path,
const posix_spawn_file_actions_t *actions, const posix_spawnattr_t* attrp, char* const argv[], char* const envp[])
typedef struct
{
// need to use BOX32_PATH / PATH here...
char* fullpath = ResolveFile(path, &my_context->box32_path);
int __allocated;
int __used;
ptr_t __actions;//struct __spawn_action *
int __pad[16];
} posix_spawn_file_actions_32_t;
EXPORT int32_t my32_posix_spawn(x64emu_t* emu, pid_t* pid, const char* fullpath,
const posix_spawn_file_actions_32_t *actions_s, const posix_spawnattr_t* attrp, ptr_t const argv[], ptr_t const envp[])
{
posix_spawn_file_actions_t actions_l = {0};
posix_spawn_file_actions_t *actions = NULL;
if(actions_s) {
actions = &actions_l;
actions->__allocated = actions_s->__allocated;
actions->__used = actions_s->__used;
actions->__actions = from_ptrv(actions_s->__actions);
}
// use fullpath...
int self = isProcSelf(fullpath, "exe");
int x86 = FileIsX86ELF(fullpath);
int x64 = my_context->box64path?FileIsX64ELF(path):0;
int x64 = FileIsX64ELF(fullpath);
char** newenvp = NULL;
// hack to update the environ var if needed
if(envp == from_ptrv(my_context->envv32) && environ)
newenvp = environ;
else {
int n=0;
while(envp[n]) ++n;
const char** newenvp = (const char**)calloc(n+1, sizeof(char*));
for(int i=0; i<=n; ++i)
newenvp[i+1] = from_ptrv(envp[i]);
}
printf_log(LOG_DEBUG, "posix_spawn(%p, \"%s\", %p, %p, %p, %p), IsX86=%d / fullpath=\"%s\"\n", pid, fullpath, actions, attrp, argv, envp, x86, fullpath);
if ((x86 || self)) {
// count argv...
int i=0;
while(argv[i]) ++i;
char** newargv = (char**)calloc(i+2, sizeof(char*));
newargv[0] = x64?emu->context->box64path:emu->context->box64path;
for (int j=0; j<i; ++j)
newargv[j+1] = from_ptrv(argv[j]);
if(self) newargv[1] = emu->context->fullpath;
printf_log(LOG_DEBUG, " => posix_spawn(%p, \"%s\", %p, %p, %p [\"%s\", \"%s\"...:%d], %p)\n", pid, newargv[0], actions, attrp, newargv, newargv[1], i?newargv[2]:"", i, envp);
int ret = posix_spawnp(pid, newargv[0], actions, attrp, newargv, newenvp);
printf_log(LOG_DEBUG, "posix_spawn returned %d\n", ret);
//free(newargv);
return ret;
}
// count argv and create the 64bits argv version
int n=0;
while(argv[n]) ++n;
char** newargv = (char**)calloc(n+1, sizeof(char*));
for(int i=0; i<=n; ++i)
newargv[i+1] = from_ptrv(argv[i]);
return posix_spawn(pid, fullpath, actions, attrp, newargv, newenvp);
}
EXPORT int32_t my32_posix_spawnp(x64emu_t* emu, pid_t* pid, const char* path,
const posix_spawn_file_actions_32_t *actions_s, const posix_spawnattr_t* attrp, ptr_t const argv[], ptr_t const envp[])
{
posix_spawn_file_actions_t actions_l = {0};
posix_spawn_file_actions_t *actions = NULL;
if(actions_s) {
actions = &actions_l;
actions->__allocated = actions_s->__allocated;
actions->__used = actions_s->__used;
actions->__actions = from_ptrv(actions_s->__actions);
}
// need to use BOX32_PATH / PATH here...
char* fullpath = ResolveFile(path, &my_context->box64_path);
// use fullpath...
int self = isProcSelf(fullpath, "exe");
int x86 = FileIsX86ELF(fullpath);
int x64 = FileIsX64ELF(fullpath);
char** newenvp = NULL;
// hack to update the environ var if needed
if(envp == from_ptrv(my_context->envv32) && environ)
newenvp = environ;
else {
int n=0;
while(envp[n]) ++n;
const char** newenvp = (const char**)calloc(n+1, sizeof(char*));
for(int i=0; i<=n; ++i)
newenvp[i+1] = from_ptrv(envp[i]);
}
printf_log(LOG_DEBUG, "posix_spawnp(%p, \"%s\", %p, %p, %p, %p), IsX86=%d / fullpath=\"%s\"\n", pid, path, actions, attrp, argv, envp, x86, fullpath);
free(fullpath);
if ((x86 || self)) {
@ -1985,18 +2060,23 @@ EXPORT int32_t my32_posix_spawnp(x64emu_t* emu, pid_t* pid, const char* path,
char** newargv = (char**)calloc(i+2, sizeof(char*));
newargv[0] = x64?emu->context->box64path:emu->context->box64path;
for (int j=0; j<i; ++j)
newargv[j+1] = argv[j];
newargv[j+1] = from_ptrv(argv[j]);
if(self) newargv[1] = emu->context->fullpath;
printf_log(LOG_DEBUG, " => posix_spawnp(%p, \"%s\", %p, %p, %p [\"%s\", \"%s\"...:%d], %p)\n", pid, newargv[0], actions, attrp, newargv, newargv[1], i?newargv[2]:"", i, envp);
int ret = posix_spawnp(pid, newargv[0], actions, attrp, newargv, envp);
int ret = posix_spawnp(pid, newargv[0], actions, attrp, newargv, newenvp);
printf_log(LOG_DEBUG, "posix_spawnp returned %d\n", ret);
//free(newargv);
return ret;
}
// fullpath is gone, so the search will only be on PATH, not on BOX32_PATH (is that an issue?)
return posix_spawnp(pid, path, actions, attrp, argv, envp);
// count argv and create the 64bits argv version
int n=0;
while(argv[n]) ++n;
char** newargv = (char**)calloc(n+1, sizeof(char*));
for(int i=0; i<=n; ++i)
newargv[i+1] = from_ptrv(argv[i]);
return posix_spawnp(pid, path, actions, attrp, newargv, newenvp);
}
#endif
EXPORT void my32__Jv_RegisterClasses() {}
EXPORT int32_t my32___cxa_thread_atexit_impl(x64emu_t* emu, void* dtor, void* obj, void* dso)
@ -2129,23 +2209,6 @@ EXPORT void* my32_mallinfo(x86emu_t* emu, void* p)
}
#if 0
EXPORT int32_t my32_getrandom(x64emu_t* emu, void* buf, uint32_t buflen, uint32_t flags)
{
// not always implemented on old linux version...
library_t* lib = my_lib;
if(!lib) return 0;
void* f = dlsym(lib->priv.w.lib, "getrandom");
if(f)
return ((iFpuu_t)f)(buf, buflen, flags);
// do what should not be done, but it's better then nothing....
FILE * rnd = fopen("/dev/urandom", "rb");
uint32_t r = fread(buf, 1, buflen, rnd);
fclose(rnd);
return r;
}
#endif
EXPORT void* my32_getpwuid(x64emu_t* emu, uint32_t uid)
{
static struct i386_passwd ret;
@ -2748,172 +2811,45 @@ EXPORT void* my32_getmntent(x64emu_t* emu, void* f)
return &ret;
}
EXPORT void* my32_mmap(x64emu_t* emu, void *addr, size_t length, int prot, int flags, int fd, int offset)
{
if(prot&PROT_WRITE)
prot|=PROT_READ; // PROT_READ is implicit with PROT_WRITE on i386
#ifdef __x86_64__
flags |= MAP_32BIT;
#endif
if(box64_log<LOG_DEBUG) {dynarec_log(LOG_DEBUG, "mmap(%p, %zu, 0x%x, 0x%x, %d, %d) =>", addr, length, prot, flags, fd, offset);}
void* new_addr = addr?addr:find32bitBlock(length);
void* ret = mmap(new_addr, length, prot, flags, fd, offset);
if(!addr && ret!=new_addr && ret!=(void*)-1) {
munmap(ret, length);
loadProtectionFromMap(); // reload map, because something went wrong previously
new_addr = find31bitBlockNearHint(addr, length, 0); // is this the best way?
ret = mmap(new_addr, length, prot, flags, fd, offset);
}
if(box64_log<LOG_DEBUG) {dynarec_log(LOG_DEBUG, "%p\n", ret);}
#ifdef DYNAREC
if(box64_dynarec && ret!=(void*)-1) {
if(flags&0x100000 && addr!=ret)
{
// program used MAP_FIXED_NOREPLACE but the host linux didn't support it
// and responded with a different address, so ignore it
} else {
if(prot& PROT_EXEC)
addDBFromAddressRange((uintptr_t)ret, length);
else
cleanDBFromAddressRange((uintptr_t)ret, length, prot?0:1);
}
}
#endif
if(ret!=(void*)-1)
setProtection((uintptr_t)ret, length, prot);
return ret;
}
void* my_mmap64(x64emu_t* emu, void *addr, size_t length, int prot, int flags, int fd, ssize_t offset);
void* my_mremap(x64emu_t* emu, void* old_addr, size_t old_size, size_t new_size, int flags, void* new_addr);
int my_munmap(x64emu_t* emu, void* addr, size_t length);
int my_mprotect(x64emu_t* emu, void *addr, size_t len, int prot);
EXPORT void* my32_mmap64(x64emu_t* emu, void *addr, size_t length, int prot, int flags, int fd, int64_t offset)
{
if(prot&PROT_WRITE)
prot|=PROT_READ; // PROT_READ is implicit with PROT_WRITE on i386
if(box64_log<LOG_DEBUG) {dynarec_log(LOG_DEBUG, "mmap64(%p, %zu, 0x%x, 0x%x, %d, %ld) =>", addr, length, prot, flags, fd, offset);}
void* new_addr = (flags&MAP_FIXED)?addr:find31bitBlockNearHint(addr, length, 0);
void* ret = mmap64(new_addr, length, prot, flags, fd, offset);
if(!addr && ret!=new_addr && ret!=(void*)-1) {
munmap(ret, length);
loadProtectionFromMap(); // reload map, because something went wrong previously
new_addr = find31bitBlockNearHint(addr, length, 0);
ret = mmap64(new_addr, length, prot, flags, fd, offset);
} else if(addr && ret!=(void*)-1 && ret!=new_addr &&
((uintptr_t)ret&0xffff) && !(flags&MAP_FIXED) && box64_wine) {
munmap(ret, length);
loadProtectionFromMap(); // reload map, because something went wrong previously
new_addr = find31bitBlockNearHint(addr, length, 0);
ret = mmap64(new_addr, length, prot, flags, fd, offset);
if(ret!=(void*)-1 && ret!=addr && ((uintptr_t)ret&0xffff) && box64_wine) {
// addr is probably too high, start again with a low address
munmap(ret, length);
loadProtectionFromMap(); // reload map, because something went wrong previously
new_addr = find31bitBlockNearHint(NULL, length, 0); // is this the best way?
ret = mmap64(new_addr, length, prot, flags, fd, offset);
if(ret!=(void*)-1 && (uintptr_t)ret&0xffff) {
munmap(ret, length);
ret = (void*)-1;
}
}
void* ret = my_mmap64(emu, addr, length, prot, flags|MAP_32BIT, fd, offset);
if((ret!=MAP_FAILED && ((uintptr_t)ret>0xffffffff) || ((uintptr_t)ret+length>0xffffffff))) {
my_munmap(emu, ret, length);
errno = EEXIST;
return MAP_FAILED;
}
if(box64_log<LOG_DEBUG) {dynarec_log(LOG_DEBUG, "%p\n", ret);}
#ifdef DYNAREC
if(box64_dynarec && ret!=(void*)-1) {
if(flags&0x100000 && addr!=ret)
{
// program used MAP_FIXED_NOREPLACE but the host linux didn't support it
// and responded with a different address, so ignore it
} else {
if(prot& PROT_EXEC)
addDBFromAddressRange((uintptr_t)ret, length);
else
cleanDBFromAddressRange((uintptr_t)ret, length, prot?0:1);
}
if((ret!=MAP_FAILED) && addr && (ret<addr)) {
my_munmap(emu, ret, length);
errno = EEXIST;
return MAP_FAILED;
}
#endif
if(ret!=(void*)-1)
setProtection((uintptr_t)ret, length, prot);
return ret;
}
EXPORT void* my32_mmap(x64emu_t* emu, void *addr, size_t length, int prot, int flags, int fd, int offset)
{
return my32_mmap64(emu, addr, length, prot, flags|MAP_32BIT, fd, offset);
}
EXPORT void* my32_mremap(x64emu_t* emu, void* old_addr, size_t old_size, size_t new_size, int flags, void* new_addr)
{
dynarec_log(/*LOG_DEBUG*/LOG_NONE, "mremap(%p, %zu, %zu, %d, %p)=>", old_addr, old_size, new_size, flags, new_addr);
void* ret = mremap(old_addr, old_size, new_size, flags, new_addr);
dynarec_log(/*LOG_DEBUG*/LOG_NONE, "%p\n", ret);
if(ret==(void*)-1)
return ret; // failed...
uint32_t prot = getProtection((uintptr_t)old_addr)&~PROT_CUSTOM;
if(ret==old_addr) {
if(old_size && old_size<new_size) {
setProtection((uintptr_t)ret+old_size, new_size-old_size, prot);
#ifdef DYNAREC
if(box64_dynarec)
addDBFromAddressRange((uintptr_t)ret+old_size, new_size-old_size);
#endif
} else if(old_size && new_size<old_size) {
freeProtection((uintptr_t)ret+new_size, old_size-new_size);
#ifdef DYNAREC
if(box64_dynarec)
cleanDBFromAddressRange((uintptr_t)ret+new_size, new_size-old_size, 1);
#endif
} else if(!old_size) {
setProtection((uintptr_t)ret, new_size, prot);
#ifdef DYNAREC
if(box64_dynarec)
addDBFromAddressRange((uintptr_t)ret, new_size);
#endif
}
} else {
if(old_size
#ifdef MREMAP_DONTUNMAP
&& !(flags&MREMAP_DONTUNMAP)
#endif
) {
freeProtection((uintptr_t)old_addr, old_size);
#ifdef DYNAREC
if(box64_dynarec)
cleanDBFromAddressRange((uintptr_t)old_addr, old_size, 1);
#endif
}
setProtection((uintptr_t)ret, new_size, prot); // should copy the protection from old block
#ifdef DYNAREC
if(box64_dynarec)
addDBFromAddressRange((uintptr_t)ret, new_size);
#endif
}
return ret;
return my_mremap(emu, old_addr, old_size, new_size, flags, new_addr);
}
EXPORT int my32_munmap(x64emu_t* emu, void* addr, unsigned long length)
{
dynarec_log(LOG_DEBUG, "munmap(%p, %lu)\n", addr, length);
#ifdef DYNAREC
if(box64_dynarec) {
cleanDBFromAddressRange((uintptr_t)addr, length, 1);
}
#endif
int ret = munmap(addr, length);
if(!ret)
freeProtection((uintptr_t)addr, length);
return ret;
return my_munmap(emu, addr, length);
}
EXPORT int my32_mprotect(x64emu_t* emu, void *addr, unsigned long len, int prot)
{
dynarec_log(LOG_DEBUG, "mprotect(%p, %lu, 0x%x)\n", addr, len, prot);
if(prot&PROT_WRITE)
prot|=PROT_READ; // PROT_READ is implicit with PROT_WRITE on i386
int ret = mprotect(addr, len, prot);
#ifdef DYNAREC
if(box64_dynarec) {
if(prot& PROT_EXEC)
addDBFromAddressRange((uintptr_t)addr, len);
else
cleanDBFromAddressRange((uintptr_t)addr, len, 0);
}
#endif
if(!ret)
updateProtection((uintptr_t)addr, len, prot);
return ret;
return my_mprotect(emu, addr, len, prot);
}
#if 0
#ifndef ANDROID
@ -3041,6 +2977,16 @@ EXPORT int my32_futimes(x64emu_t* emu, int fd, uint32_t* times)
return futimes(fd, tm);
}
EXPORT int my32_futimens(x64emu_t* emu, int fd, uint32_t* times)
{
struct timespec tm[2];
tm[0].tv_sec = times[0];
tm[0].tv_nsec = times[1];
tm[1].tv_sec = times[2];
tm[1].tv_nsec = times[3];
return futimens(fd, tm);
}
EXPORT long my32_strtol(const char* s, char** endp, int base)
{
long ret = strtol(s, endp, base);

View File

@ -9,6 +9,7 @@
// struct timeval is: LL
// struct itimerval is LLLL
// struct tm is: iiiiiiiiilt
// struct tms is: llll
// struct rusage is LLLLLLLLLLLLLLLLLL (2 timeval + 14 longs)
// time_t is: L
// socklen_t is u
@ -77,7 +78,7 @@ GOM(alphasort64, iFEpp)
//GOW(argz_stringify, vFpLi)
GOM(asctime, pFriiiiiiiiilt_) //%noE
GOW(asctime_r, pFriiiiiiiiilt_p)
//GOWM(asprintf, iFEppV) //%%
GOWM(asprintf, iFEppV) //%%
//GOM(__asprintf, iFEppV) //%%
//GOM(__asprintf_chk, iFEpipV) //%%
// __assert
@ -348,7 +349,7 @@ GO(__fgets_chk, pFpLiS)
// __fgetws_chk
//GO(fgetws_unlocked, pFpip)
// __fgetws_unlocked_chk
//GO(fgetxattr, iFippu)
GO(fgetxattr, iFippL)
GO(fileno, iFS)
GOW(fileno_unlocked, iFS)
GOW(finite, iFd)
@ -397,7 +398,7 @@ GOM(freeaddrinfo, vFEp)
GO(freeifaddrs, vFp)
GOW(freelocale, vFA)
GO(__freelocale, vFA)
//GO(fremovexattr, iFip)
GO(fremovexattr, iFip)
GO(freopen, SFppS)
GO(freopen64, SFppS)
// frexp // Weak
@ -410,7 +411,7 @@ GO(fseeko64, iFSIi)
//GO(__fsetlocking, iFpi)
//GO(fsetpos, iFpp)
//GO(fsetpos64, iFpp)
//GO(fsetxattr, iFippui)
GO(fsetxattr, iFippLi)
GOWM(fstatfs, iFip) //%%,noE
GOWM(fstatfs64, iFip) //%%,noE
//GO(fstatvfs, iFip)
@ -432,7 +433,7 @@ GOW(ftruncate64, iFiI)
//GOM(ftw, iFEppi) //%%
//GOM(ftw64, iFEppi) //%%
//GOW(funlockfile, vFp)
//GO(futimens, iFip)
GOM(futimens, iFEip)
GOWM(futimes, iFEip)
//GO(futimesat, iFippp)
// fwide
@ -446,7 +447,7 @@ GOW(fwrite, LFpLLS)
GOM(__fxstat, iFEiip) //%%
GOM(__fxstat64, iFEiip) //%% need reaalign of struct stat64
//GOM(__fxstatat, iFEiippi) //%%
//GOM(__fxstatat64, iFEiippi) //%% struct stat64 again
GOM(__fxstatat64, iFEiippi) //%% struct stat64 again
// __gai_sigqueue
GO(gai_strerror, tFi)
// __gconv_get_alias_db
@ -546,7 +547,7 @@ GO(__getpid, uFv)
// getpmsg
GOW(getppid, iFv)
GO(getpriority, iFuu)
//GOM(getrandom, iFEpuu) //%%
GO(getrandom, iFpLu)
GOM(getprotobyname, pFEp)
//GO(getprotobyname_r, iFpppup)
//GO(getprotobynumber, pFi)
@ -617,7 +618,7 @@ GO(getwchar_unlocked, uFv)
//GOW(getwc_unlocked, iFp)
//GO(getwd, pFp)
// __getwd_chk
//GO(getxattr, iFpppu)
GO(getxattr, iFpppL)
//GOM(glob, iFEpipp) //%%
//GOM(glob64, iFEpipp) //%%
//GO(globfree, vFp)
@ -1105,7 +1106,7 @@ GO(memset, pFpiL)
GO(__memset_chk, pFpiLL)
GO(mincore, iFpLp)
GOW(mkdir, iFpu)
//GO(mkdirat, iFipu)
GO(mkdirat, iFipu)
GO(mkdtemp, pFp)
GO(mkfifo, iFpu)
//GO(mkfifoat, iFipu)
@ -1206,7 +1207,7 @@ GOWM(open64, iFEpON) //%%
//GO(__open64_2, iFpO)
//GOW(openat, iFipON)
// __openat_2
//GOW(openat64, iFipON)
GOW(openat64, iFipON)
//GO(__openat64_2, iFipON)
// __open_catalog
GOW(opendir, pFp)
@ -1230,7 +1231,7 @@ GO(perror, vFp)
// personality // Weak
GOW(pipe, iFp)
// __pipe
//GOW(pipe2, iFpO) // assuming this works the same as pipe, so pointer for array of 2 int
GOW(pipe2, iFpO) // assuming this works the same as pipe, so pointer for array of 2 int
// pivot_root
// pmap_getmaps
// pmap_getport
@ -1247,7 +1248,7 @@ GO(posix_fallocate64, iFiII)
// posix_madvise
GOW(posix_memalign, iFBp_LL)
// posix_openpt // Weak
//GO(posix_spawn, iFpppppp)
GOM(posix_spawn, iFEpppppp)
// posix_spawnattr_destroy
// posix_spawnattr_getflags
// posix_spawnattr_getpgroup
@ -1267,11 +1268,11 @@ GOW(posix_memalign, iFBp_LL)
//GO(posix_spawn_file_actions_addopen, iFpipii)
//GO(posix_spawn_file_actions_destroy, iFp)
//GO(posix_spawn_file_actions_init, iFp)
//GOM(posix_spawnp, iFEpppppp) //%%
//GO(ppoll, iFpupp)
GOM(posix_spawnp, iFEpppppp) //%%
GO(ppoll, iFpurLL_p)
GOW(prctl, iFiLLLL)
GOW(pread, lFipLl)
//GOW(pread64, lFipLI)
GOW(pread64, lFipLI)
// __pread64 // Weak
// __pread64_chk
//GOM(preadv64, lFEipiI) //%% not always present
@ -1313,7 +1314,7 @@ GO(putwchar_unlocked, uFi)
//GO(putwc_unlocked, iFip)
// pvalloc // Weak
// pwrite // Weak
//GOW(pwrite64, lFipLI)
GOW(pwrite64, lFipLI)
// __pwrite64 // Weak
//GOM(pwritev64, lFEipiI) //%% not always present
// qecvt
@ -1351,7 +1352,7 @@ GOWM(readdir, pFEp) //%%
GO(readdir64, pFp) // check if alignement is correct
//GOM(readdir_r, iFEppp) //%% should also be weak
GOM(readlink, lFEppL) //%%
//GOM(readlinkat, iFEippL)
GOM(readlinkat, iFEippL)
// __readlinkat_chk
// __readlink_chk
//GO(readv, lFipi)
@ -1384,7 +1385,7 @@ GO(remove, iFp)
//GO(removexattr, iFpp)
// remque
GO(rename, iFpp)
//GO(renameat, iFipip)
GO(renameat, iFipip)
//GO(renameat2, iFipipu)
// _res // type B
//GOW(re_search, iFppiiip)
@ -1762,7 +1763,7 @@ GOM(swprintf, iFEpLpV) //%%
GOM(__swprintf_chk, iFEpLiLpV) //%%
GOM(swscanf, iFEppV)
GOW(symlink, iFpp)
//GO(symlinkat, iFpip)
GO(symlinkat, iFpip)
GO(sync, vFv)
GO(syncfs, iFi)
// sync_file_range
@ -1806,7 +1807,7 @@ GO(timegm, LFriiiiiiiiilt_)
GO(timerfd_create, iFii)
//GO(timerfd_gettime, iFip)
//GO(timerfd_settime, iFiipp)
//GOW(times, iFp)
GOW(times, iFBllll_)
DATAM(timezone, 4)
//DATAB(__timezone, 4) // type B
GO(tmpfile, pFv)
@ -1857,7 +1858,7 @@ GOWM(uname, iFp) //%%,noE
GOW(ungetc, iFiS)
GO(ungetwc, uFuS)
GOW(unlink, iFp)
//GO(unlinkat, iFipi)
GO(unlinkat, iFipi)
GO(unlockpt, iFi)
GOW(unsetenv, iFp)
// unshare
@ -2112,7 +2113,7 @@ GO(xdr_void, iFv)
// xencrypt
GO(__xmknod, iFipup)
//GO(__xmknodat, iFiipip)
//GO(__xpg_basename, pFp)
GO(__xpg_basename, pFp)
// __xpg_sigpause // Weak
GO(__xpg_strerror_r, tFipu)
// xprt_register