diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-03-03 16:43:42 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-03-03 16:43:42 +0100 |
| commit | f4829a8ce42b1abbcc8621802d6c6fad3a56cd5d (patch) | |
| tree | 211276c3587721126ded00be46487bf23b605591 /src/wrapped/generated/wrapper.c | |
| parent | f73fbd3cee38b4c0086c934d73972375c9c8c7d6 (diff) | |
| download | box64-f4829a8ce42b1abbcc8621802d6c6fad3a56cd5d.tar.gz box64-f4829a8ce42b1abbcc8621802d6c6fad3a56cd5d.zip | |
More infrastructure added to elf and x64 emu
Diffstat (limited to 'src/wrapped/generated/wrapper.c')
| -rw-r--r-- | src/wrapped/generated/wrapper.c | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c new file mode 100644 index 00000000..6598ae7e --- /dev/null +++ b/src/wrapped/generated/wrapper.c @@ -0,0 +1,102 @@ +/***************************************************************** + * File automatically generated by rebuild_wrappers.py (v1.2.0.09) + *****************************************************************/ +#include <stdio.h> +#include <stdlib.h> +#include <stdint.h> + +#include "wrapper.h" +#include "emu/x64emu_private.h" +#include "emu/x87emu_private.h" +#include "regs.h" +#include "x64emu.h" + +typedef union ui64_s { + int64_t i; + uint64_t u; + uint32_t d[2]; +} ui64_t; + +typedef struct _2uint_struct_s { + uint32_t a; + uint32_t b; +} _2uint_struct_t; + +extern void* my__IO_2_1_stderr_; +extern void* my__IO_2_1_stdin_ ; +extern void* my__IO_2_1_stdout_; + +static void* io_convert(void* v) +{ + if(!v) + return v; + if(v==my__IO_2_1_stderr_) + return stderr; + if(v==my__IO_2_1_stdin_) + return stdin; + if(v==my__IO_2_1_stdout_) + return stdout; + return v; +} + +typedef struct my_GValue_s +{ + int g_type; + union { + int v_int; + int64_t v_int64; + uint64_t v_uint64; + float v_float; + double v_double; + void* v_pointer; + } data[2]; +} my_GValue_t; + +static void alignGValue(my_GValue_t* v, void* value) +{ + v->g_type = *(int*)value; + memcpy(v->data, value+4, 2*sizeof(double)); +} +static void unalignGValue(void* value, my_GValue_t* v) +{ + *(int*)value = v->g_type; + memcpy(value+4, v->data, 2*sizeof(double)); +} + +void* VulkanFromx86(void* src, void** save); +void VulkanTox86(void* src, void* save); + +#define ST0val ST0.d + +int of_convert(int); +typedef void (*vFE_t)(x64emu_t*); +typedef void (*vFv_t)(void); +typedef void* (*pFE_t)(x64emu_t*); +typedef void* (*pFp_t)(void*); +typedef void (*vFpp_t)(void*, void*); +typedef int32_t (*iFEp_t)(x64emu_t*, void*); +typedef void* (*pFEp_t)(x64emu_t*, void*); +typedef int32_t (*iFEpp_t)(x64emu_t*, void*, void*); +typedef void* (*pFEpi_t)(x64emu_t*, void*, int32_t); +typedef void* (*pFEpp_t)(x64emu_t*, void*, void*); +typedef int32_t (*iFEpip_t)(x64emu_t*, void*, int32_t, void*); +typedef void* (*pFEppi_t)(x64emu_t*, void*, void*, int32_t); +typedef void* (*pFEppp_t)(x64emu_t*, void*, void*, void*); +typedef int32_t (*iFipppi_t)(int32_t, void*, void*, void*, int32_t); + +void vFE(x64emu_t *emu, uintptr_t fcn) { vFE_t fn = (vFE_t)fcn; fn(emu); } +void vFv(x64emu_t *emu, uintptr_t fcn) { vFv_t fn = (vFv_t)fcn; fn(); } +void pFE(x64emu_t *emu, uintptr_t fcn) { pFE_t fn = (pFE_t)fcn; R_RAX=(uintptr_t)fn(emu); } +void pFp(x64emu_t *emu, uintptr_t fcn) { pFp_t fn = (pFp_t)fcn; R_RAX=(uintptr_t)fn(*(void**)(R_RSP + 4)); } +void vFpp(x64emu_t *emu, uintptr_t fcn) { vFpp_t fn = (vFpp_t)fcn; fn(*(void**)(R_RSP + 4), *(void**)(R_RSP + 12)); } +void iFEp(x64emu_t *emu, uintptr_t fcn) { iFEp_t fn = (iFEp_t)fcn; R_RAX=fn(emu, *(void**)(R_RSP + 4)); } +void pFEp(x64emu_t *emu, uintptr_t fcn) { pFEp_t fn = (pFEp_t)fcn; R_RAX=(uintptr_t)fn(emu, *(void**)(R_RSP + 4)); } +void iFEpp(x64emu_t *emu, uintptr_t fcn) { iFEpp_t fn = (iFEpp_t)fcn; R_RAX=fn(emu, *(void**)(R_RSP + 4), *(void**)(R_RSP + 12)); } +void pFEpi(x64emu_t *emu, uintptr_t fcn) { pFEpi_t fn = (pFEpi_t)fcn; R_RAX=(uintptr_t)fn(emu, *(void**)(R_RSP + 4), *(int32_t*)(R_RSP + 12)); } +void pFEpp(x64emu_t *emu, uintptr_t fcn) { pFEpp_t fn = (pFEpp_t)fcn; R_RAX=(uintptr_t)fn(emu, *(void**)(R_RSP + 4), *(void**)(R_RSP + 12)); } +void iFEpip(x64emu_t *emu, uintptr_t fcn) { iFEpip_t fn = (iFEpip_t)fcn; R_RAX=fn(emu, *(void**)(R_RSP + 4), *(int32_t*)(R_RSP + 12), *(void**)(R_RSP + 16)); } +void pFEppi(x64emu_t *emu, uintptr_t fcn) { pFEppi_t fn = (pFEppi_t)fcn; R_RAX=(uintptr_t)fn(emu, *(void**)(R_RSP + 4), *(void**)(R_RSP + 12), *(int32_t*)(R_RSP + 20)); } +void pFEppp(x64emu_t *emu, uintptr_t fcn) { pFEppp_t fn = (pFEppp_t)fcn; R_RAX=(uintptr_t)fn(emu, *(void**)(R_RSP + 4), *(void**)(R_RSP + 12), *(void**)(R_RSP + 20)); } +void iFipppi(x64emu_t *emu, uintptr_t fcn) { iFipppi_t fn = (iFipppi_t)fcn; R_RAX=fn(*(int32_t*)(R_RSP + 4), *(void**)(R_RSP + 8), *(void**)(R_RSP + 16), *(void**)(R_RSP + 24), *(int32_t*)(R_RSP + 32)); } + +void pFEv(x64emu_t *emu, uintptr_t fcn) { pFE_t fn = (pFE_t)fcn; R_RAX=(uintptr_t)fn(emu); } |