mirror of
https://github.com/ptitSeb/box86.git
synced 2025-02-18 21:57:53 +00:00
Fix some border case (v/s/f)printf plus added a few wrapped functions
This commit is contained in:
parent
3db9dfd7ea
commit
cb7f4d373e
@ -66,8 +66,8 @@ void myStackAlign(const char* fmt, uint32_t* st, uint32_t* mystack)
|
||||
case 'p':
|
||||
case 'S':
|
||||
case 's': state = 30; break; // pointers
|
||||
case '$':
|
||||
case '*': ++p; break; // should issue a warning, it's not handled...
|
||||
case '$': ++p; break; // should issue a warning, it's not handled...
|
||||
case '*': *(mystack++) = *(st++); ++p; break; // fetch an int in the stack....
|
||||
case ' ': state=0; ++p; break;
|
||||
default:
|
||||
state=20; // other stuff, put an int...
|
||||
|
@ -250,8 +250,7 @@ EXPORT int my_vsprintf(x86emu_t* emu, void* buff, void * fmt, void * b, va_list
|
||||
int r = ((iFppp_t)f)(buff, fmt, emu->scratch);
|
||||
return r;
|
||||
#else
|
||||
void* f = vsprintf;
|
||||
int r = ((iFppp_t)f)(buff, fmt, *(uint32_t**)b);
|
||||
return vsprintf(buff, fmt, V);
|
||||
#endif
|
||||
}
|
||||
EXPORT int my___vsprintf_chk(x86emu_t* emu, void* buff, void * fmt, void * b, va_list V) __attribute__((alias("my_vsprintf")));
|
||||
@ -264,9 +263,7 @@ EXPORT int my_vsnprintf(x86emu_t* emu, void* buff, uint32_t s, void * fmt, void
|
||||
int r = ((iFpupp_t)f)(buff, s, fmt, emu->scratch);
|
||||
return r;
|
||||
#else
|
||||
void* f = vsnprintf;
|
||||
int r = ((iFpupp_t)f)(buff, s, fmt, *(uint32_t**)b);
|
||||
return r;
|
||||
return vsnprintf(buff, s, fmt, V);
|
||||
#endif
|
||||
}
|
||||
EXPORT int my___vsnprintf(x86emu_t* emu, void* buff, uint32_t s, void * fmt, void * b, va_list V) __attribute__((alias("my_vsnprintf")));
|
||||
|
@ -909,7 +909,7 @@ GO(isupper, iFi)
|
||||
// iswcntrl // Weak
|
||||
// __iswcntrl_l
|
||||
// iswcntrl_l // Weak
|
||||
// iswctype // Weak
|
||||
GOW(iswctype, iFiu)
|
||||
// __iswctype
|
||||
GO(__iswctype_l, iFiup)
|
||||
// iswctype_l // Weak
|
||||
@ -1680,7 +1680,7 @@ GO(strtoumax, UFppi)
|
||||
// strtouq // Weak
|
||||
// strverscmp // Weak
|
||||
// __strverscmp
|
||||
// strxfrm
|
||||
GO(strxfrm, uFppu)
|
||||
GO(__strxfrm_l, uFppup)
|
||||
GO(strxfrm_l, uFppup)
|
||||
// stty
|
||||
@ -1961,7 +1961,7 @@ GO(wcstombs, uFppu)
|
||||
// wcstouq // Weak
|
||||
// wcswcs // Weak
|
||||
// wcswidth
|
||||
// wcsxfrm
|
||||
GO(wcsxfrm, uFppu)
|
||||
GOW(wcsxfrm_l, uFppup)
|
||||
GO(__wcsxfrm_l, uFppup)
|
||||
GO(wctob, iFi)
|
||||
@ -1970,7 +1970,7 @@ GO(wctomb, iFpi)
|
||||
// wctrans // Weak
|
||||
// __wctrans_l
|
||||
// wctrans_l // Weak
|
||||
// wctype // Weak
|
||||
GOW(wctype, uFp)
|
||||
GO(__wctype_l, uFpp)
|
||||
GOW(wctype_l, uFpp)
|
||||
// wcwidth
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <string.h>
|
||||
#define _GNU_SOURCE /* See feature_test_macros(7) */
|
||||
#include <dlfcn.h>
|
||||
#include <complex.h>
|
||||
|
||||
#include "wrappedlibs.h"
|
||||
|
||||
@ -10,6 +11,19 @@
|
||||
#include "bridge.h"
|
||||
#include "library_private.h"
|
||||
#include "x86emu.h"
|
||||
#include "debug.h"
|
||||
|
||||
EXPORT void* my_clog(void* p, double real, double img)
|
||||
{
|
||||
*(double complex*)p = clog(real+img*I);
|
||||
return p;
|
||||
}
|
||||
|
||||
EXPORT void* my_csqrt(void* p, double real, double img)
|
||||
{
|
||||
*(double complex*)p = csqrt(real+img*I);
|
||||
return p;
|
||||
}
|
||||
|
||||
const char* libmName = "libm.so.6";
|
||||
#define LIBNAME libm
|
||||
|
@ -73,7 +73,7 @@ GOW(ceilf, fFf)
|
||||
// cimag // Weak
|
||||
// cimagf // Weak
|
||||
// cimagl // Weak
|
||||
// clog // Weak
|
||||
GOS(clog, pFpdd) // return a double complex, that is a struct
|
||||
// clog10 // Weak
|
||||
// __clog10
|
||||
// clog10f // Weak
|
||||
@ -111,7 +111,7 @@ GOW(coshf, fFf)
|
||||
// csinhf // Weak
|
||||
// csinhl // Weak
|
||||
// csinl // Weak
|
||||
// csqrt // Weak
|
||||
GOS(csqrt, pFpdd)
|
||||
// csqrtf // Weak
|
||||
// csqrtl // Weak
|
||||
// ctan // Weak
|
||||
|
@ -260,6 +260,7 @@ typedef void* (*pFpCu_t)(void*, uint8_t, uint32_t);
|
||||
typedef void* (*pFpui_t)(void*, uint32_t, int32_t);
|
||||
typedef void* (*pFpuu_t)(void*, uint32_t, uint32_t);
|
||||
typedef void* (*pFpup_t)(void*, uint32_t, void*);
|
||||
typedef void* (*pFpdd_t)(void*, double, double);
|
||||
typedef void* (*pFppi_t)(void*, void*, int32_t);
|
||||
typedef void* (*pFppu_t)(void*, void*, uint32_t);
|
||||
typedef void* (*pFppp_t)(void*, void*, void*);
|
||||
@ -1035,6 +1036,7 @@ void pFpCu(x86emu_t *emu, uintptr_t fcn) { pFpCu_t fn = (pFpCu_t)fcn; R_EAX=(uin
|
||||
void pFpui(x86emu_t *emu, uintptr_t fcn) { pFpui_t fn = (pFpui_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(uint32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12)); }
|
||||
void pFpuu(x86emu_t *emu, uintptr_t fcn) { pFpuu_t fn = (pFpuu_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(uint32_t*)(R_ESP + 8), *(uint32_t*)(R_ESP + 12)); }
|
||||
void pFpup(x86emu_t *emu, uintptr_t fcn) { pFpup_t fn = (pFpup_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(uint32_t*)(R_ESP + 8), *(void**)(R_ESP + 12)); }
|
||||
void pFpdd(x86emu_t *emu, uintptr_t fcn) { pFpdd_t fn = (pFpdd_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(double*)(R_ESP + 8), *(double*)(R_ESP + 16)); }
|
||||
void pFppi(x86emu_t *emu, uintptr_t fcn) { pFppi_t fn = (pFppi_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(int32_t*)(R_ESP + 12)); }
|
||||
void pFppu(x86emu_t *emu, uintptr_t fcn) { pFppu_t fn = (pFppu_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(uint32_t*)(R_ESP + 12)); }
|
||||
void pFppp(x86emu_t *emu, uintptr_t fcn) { pFppp_t fn = (pFppp_t)fcn; R_EAX=(uintptr_t)fn(*(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12)); }
|
||||
|
@ -259,6 +259,7 @@ void pFpCu(x86emu_t *emu, uintptr_t fnc);
|
||||
void pFpui(x86emu_t *emu, uintptr_t fnc);
|
||||
void pFpuu(x86emu_t *emu, uintptr_t fnc);
|
||||
void pFpup(x86emu_t *emu, uintptr_t fnc);
|
||||
void pFpdd(x86emu_t *emu, uintptr_t fnc);
|
||||
void pFppi(x86emu_t *emu, uintptr_t fnc);
|
||||
void pFppu(x86emu_t *emu, uintptr_t fnc);
|
||||
void pFppp(x86emu_t *emu, uintptr_t fnc);
|
||||
|
Loading…
x
Reference in New Issue
Block a user