about summary refs log tree commit diff stats
path: root/src/wrapped/generated
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-03-03 16:43:42 +0100
committerptitSeb <sebastien.chev@gmail.com>2021-03-03 16:43:42 +0100
commitf4829a8ce42b1abbcc8621802d6c6fad3a56cd5d (patch)
tree211276c3587721126ded00be46487bf23b605591 /src/wrapped/generated
parentf73fbd3cee38b4c0086c934d73972375c9c8c7d6 (diff)
downloadbox64-f4829a8ce42b1abbcc8621802d6c6fad3a56cd5d.tar.gz
box64-f4829a8ce42b1abbcc8621802d6c6fad3a56cd5d.zip
More infrastructure added to elf and x64 emu
Diffstat (limited to 'src/wrapped/generated')
-rw-r--r--src/wrapped/generated/functions_list.txt15
-rw-r--r--src/wrapped/generated/wrapper.c102
-rw-r--r--src/wrapped/generated/wrapper.h50
3 files changed, 167 insertions, 0 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
new file mode 100644
index 00000000..147507f1
--- /dev/null
+++ b/src/wrapped/generated/functions_list.txt
@@ -0,0 +1,15 @@
+#() vFE
+#() vFv
+#() pFE
+#() pFp
+#() vFpp
+#() iFEp
+#() pFEp
+#() iFEpp
+#() pFEpi
+#() pFEpp
+#() iFEpip
+#() pFEppi
+#() pFEppp
+#() iFipppi
+#() pFEv -> pFE
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); }
diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h
new file mode 100644
index 00000000..19ccf6b3
--- /dev/null
+++ b/src/wrapped/generated/wrapper.h
@@ -0,0 +1,50 @@
+/*****************************************************************
+ * File automatically generated by rebuild_wrappers.py (v1.2.0.09)
+ *****************************************************************/
+#ifndef __WRAPPER_H_
+#define __WRAPPER_H_
+#include <stdint.h>
+#include <string.h>
+
+typedef struct x64emu_s x64emu_t;
+
+// the generic wrapper pointer functions
+typedef void (*wrapper_t)(x64emu_t* emu, uintptr_t fnc);
+
+// list of defined wrapper
+// v = void, i = int32, u = uint32, U/I= (u)int64
+// l = signed long, L = unsigned long (long is an int with the size of a pointer)
+// p = pointer, P = callback
+// f = float, d = double, D = long double, K = fake long double
+// V = vaargs, E = current x86emu struct, e = ref to current x86emu struct
+// 0 = constant 0, 1 = constant 1
+// o = stdout
+// C = unsigned byte c = char
+// W = unsigned short w = short
+// O = libc O_ flags bitfield
+// S = _IO_2_1_stdXXX_ pointer (or FILE*)
+// Q = ...
+// 2 = struct of 2 uint
+// P = Vulkan struture pointer
+// G = a single GValue pointer
+// N = ... automatically sending 1 arg
+// M = ... automatically sending 2 args
+
+void vFE(x64emu_t *emu, uintptr_t fnc);
+void vFv(x64emu_t *emu, uintptr_t fnc);
+void pFE(x64emu_t *emu, uintptr_t fnc);
+void pFp(x64emu_t *emu, uintptr_t fnc);
+void vFpp(x64emu_t *emu, uintptr_t fnc);
+void iFEp(x64emu_t *emu, uintptr_t fnc);
+void pFEp(x64emu_t *emu, uintptr_t fnc);
+void iFEpp(x64emu_t *emu, uintptr_t fnc);
+void pFEpi(x64emu_t *emu, uintptr_t fnc);
+void pFEpp(x64emu_t *emu, uintptr_t fnc);
+void iFEpip(x64emu_t *emu, uintptr_t fnc);
+void pFEppi(x64emu_t *emu, uintptr_t fnc);
+void pFEppp(x64emu_t *emu, uintptr_t fnc);
+void iFipppi(x64emu_t *emu, uintptr_t fnc);
+
+void pFEv(x64emu_t *emu, uintptr_t fnc);
+
+#endif //__WRAPPER_H_