From b4851d8dd52dba587e55818b2e20b15f8624e955 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Tue, 2 Mar 2021 17:55:55 +0100 Subject: Added bridge handling --- src/include/box64context.h | 7 +++++++ src/include/bridge.h | 25 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100755 src/include/bridge.h (limited to 'src/include') diff --git a/src/include/box64context.h b/src/include/box64context.h index 0ffd0651..9eca567e 100755 --- a/src/include/box64context.h +++ b/src/include/box64context.h @@ -9,6 +9,8 @@ typedef struct cleanup_s cleanup_t; typedef struct x64emu_s x64emu_t; typedef struct zydis_s zydis_t; typedef struct zydis_dec_s zydis_dec_t; +typedef struct lib_s lib_t; +typedef struct bridge_s bridge_t; typedef struct kh_threadstack_s kh_threadstack_t; typedef void* (*procaddess_t)(const char* name); @@ -58,7 +60,12 @@ typedef struct box64context_s { uintptr_t ep; // entry point + lib_t *maplib; // lib and symbols handling + lib_t *local_maplib; // libs and symbols openned has local (only collection of libs, no symbols) + kh_threadstack_t *stacksizes; // stack sizes attributes for thread (temporary) + bridge_t *system; // other bridges + uintptr_t vsyscall; // vsyscall bridge value pthread_mutex_t mutex_thread; diff --git a/src/include/bridge.h b/src/include/bridge.h new file mode 100755 index 00000000..dfe402f9 --- /dev/null +++ b/src/include/bridge.h @@ -0,0 +1,25 @@ +#ifndef __BRIDGE_H_ +#define __BRIDGE_H_ +#include + +typedef struct x64emu_s x64emu_t; +typedef struct bridge_s bridge_t; +typedef struct box64context_s box64context_t; +typedef void (*wrapper_t)(x64emu_t* emu, uintptr_t fnc); + +bridge_t *NewBridge(); +void FreeBridge(bridge_t** bridge); + +uintptr_t AddBridge(bridge_t* bridge, wrapper_t w, void* fnc, int N); +uintptr_t CheckBridged(bridge_t* bridge, void* fnc); +uintptr_t AddCheckBridge(bridge_t* bridge, wrapper_t w, void* fnc, int N); +uintptr_t AddAutomaticBridge(x64emu_t* emu, bridge_t* bridge, wrapper_t w, void* fnc, int N); +void* GetNativeFnc(uintptr_t fnc); +void* GetNativeFncOrFnc(uintptr_t fnc); + +int hasAlternate(void* addr); +void* getAlternate(void* addr); +void addAlternate(void* addr, void* alt); +void cleanAlternate(); + +#endif //__BRIDGE_H_ \ No newline at end of file -- cgit 1.4.1