about summary refs log tree commit diff stats
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/box64context.h34
-rw-r--r--src/include/box64stack.h9
-rw-r--r--src/include/bridge.h10
-rw-r--r--src/include/callback.h7
-rw-r--r--src/include/custommem.h6
-rw-r--r--src/include/debug.h9
-rw-r--r--src/include/dictionnary.h2
-rw-r--r--src/include/dynablock.h6
-rw-r--r--src/include/dynarec_native.h15
-rw-r--r--src/include/dynarec_rv64.h2
-rw-r--r--src/include/elfloader.h3
-rw-r--r--src/include/fileutils.h4
-rw-r--r--src/include/globalsymbols.h16
-rw-r--r--src/include/gtkclass.h20
-rw-r--r--src/include/librarian.h6
-rw-r--r--src/include/library.h2
-rw-r--r--src/include/myalign.h2
-rw-r--r--src/include/rcfile.h2
-rw-r--r--src/include/regs.h2
-rw-r--r--src/include/sdl1rwops.h2
-rw-r--r--src/include/sdl2rwops.h2
-rw-r--r--src/include/signals.h2
-rw-r--r--src/include/symbols.h7
-rw-r--r--src/include/threads.h12
-rw-r--r--src/include/wine_tools.h4
-rw-r--r--src/include/x64emu.h14
-rw-r--r--src/include/x64run.h2
-rw-r--r--src/include/x64tls.h3
-rw-r--r--src/include/x64trace.h5
29 files changed, 130 insertions, 80 deletions
diff --git a/src/include/box64context.h b/src/include/box64context.h
index 3fe285dc..aa8c95b6 100644
--- a/src/include/box64context.h
+++ b/src/include/box64context.h
@@ -8,6 +8,11 @@
 #include "dynarec/native_lock.h"
 #endif
 
+#ifdef DYNAREC
+// disabling for now, seems to have a negative impact on performances
+//#define USE_CUSTOM_MUTEX
+#endif
+
 typedef struct elfheader_s elfheader_t;
 typedef struct cleanup_s cleanup_t;
 typedef struct x64emu_s x64emu_t;
@@ -18,6 +23,7 @@ typedef struct bridge_s bridge_t;
 typedef struct dlprivate_s dlprivate_t;
 typedef struct kh_symbolmap_s kh_symbolmap_t;
 typedef struct kh_defaultversion_s kh_defaultversion_t;
+typedef struct kh_mapsymbols_s kh_mapsymbols_t;
 typedef struct library_s library_t;
 typedef struct linkmap_s linkmap_t;
 typedef struct kh_threadstack_s kh_threadstack_t;
@@ -64,8 +70,10 @@ void add1lib_neededlib(needed_libs_t* needed, library_t* lib, const char* name);
 typedef struct base_segment_s {
     uintptr_t       base;
     uint64_t        limit;
-    int             present;
     pthread_key_t   key;
+    uint8_t         present;
+    uint8_t         is32bits;
+    uint8_t         key_init;
 } base_segment_t;
 
 typedef struct box64context_s {
@@ -110,9 +118,11 @@ typedef struct box64context_s {
     lib_t               *maplib;        // lib and symbols handling
     lib_t               *local_maplib;  // libs and symbols openned has local (only collection of libs, no symbols)
     dic_t               *versym;        // dictionnary of versioned symbols
+    kh_mapsymbols_t     *globdata;      // GLOBAL_DAT relocation for COPY mapping in main elf
 
     kh_threadstack_t    *stacksizes;    // stack sizes attributes for thread (temporary)
     bridge_t            *system;        // other bridges
+    uintptr_t           exit_bridge;    // exit bridge value
     uintptr_t           vsyscall;       // vsyscall bridge value
     uintptr_t           vsyscalls[3];   // the 3 x86 VSyscall pseudo bridges (mapped at 0xffffffffff600000+)
     dlprivate_t         *dlprivate;     // dlopen library map
@@ -129,14 +139,25 @@ typedef struct box64context_s {
     pthread_mutex_t     mutex_thread;
     pthread_mutex_t     mutex_bridge;
     #else
+    #ifdef USE_CUSTOM_MUTEX
     uint32_t            mutex_dyndump;
     uint32_t            mutex_trace;
     uint32_t            mutex_tls;
     uint32_t            mutex_thread;
     uint32_t            mutex_bridge;
+    #else
+    pthread_mutex_t     mutex_dyndump;
+    pthread_mutex_t     mutex_trace;
+    pthread_mutex_t     mutex_tls;
+    pthread_mutex_t     mutex_thread;
+    pthread_mutex_t     mutex_bridge;
+    #endif
     uintptr_t           max_db_size;    // the biggest (in x86_64 instructions bytes) built dynablock
     int                 trace_dynarec;
     pthread_mutex_t     mutex_lock;     // this is for the Test interpreter
+    #ifdef __riscv
+    uint32_t            mutex_16b;
+    #endif
     #endif
 
     library_t           *libclib;       // shortcut to libc library (if loaded, so probably yes)
@@ -157,7 +178,7 @@ typedef struct box64context_s {
     pthread_key_t       tlskey;     // then tls key to have actual tlsdata
     void*               tlsdata;    // the initial global tlsdata
     int64_t             tlssize;    // wanted size of tlsdata
-    base_segment_t      segtls[4];  // only handling 0/1/2 descriptors (3 is internal use)
+    base_segment_t      segtls[16];
 
     uintptr_t           *auxval_start;
 
@@ -166,6 +187,7 @@ typedef struct box64context_s {
     int                 clean_cap;
 
     zydis_dec_t         *dec;           // trace
+    zydis_dec_t         *dec32;         // trace
 
     int                 forked;         //  how many forks... cleanup only when < 0
 
@@ -192,12 +214,12 @@ typedef struct box64context_s {
 
 } box64context_t;
 
-#ifndef DYNAREC
+#ifndef USE_CUSTOM_MUTEX
 #define mutex_lock(A)       pthread_mutex_lock(A)
 #define mutex_trylock(A)    pthread_mutex_trylock(A)
 #define mutex_unlock(A)     pthread_mutex_unlock(A)
 #else
-int GetTID();
+int GetTID(void);
 #define mutex_lock(A)       {uint32_t tid = (uint32_t)GetTID(); while(native_lock_storeifnull_d(A, tid)) sched_yield();}
 #define mutex_trylock(A)    native_lock_storeifnull_d(A, (uint32_t)GetTID())
 #define mutex_unlock(A)     native_lock_storeifref_d(A, 0, (uint32_t)GetTID())
@@ -223,10 +245,10 @@ int AddTLSPartition(box64context_t* context, int tlssize);
 
 // defined in fact in threads.c
 void thread_set_emu(x64emu_t* emu);
-x64emu_t* thread_get_emu();
+x64emu_t* thread_get_emu(void);
 
 // unlock mutex that are locked by current thread (for signal handling). Return a mask of unlock mutex
-int unlockMutex();
+int unlockMutex(void);
 // relock the muxtex that were unlocked
 void relockMutex(int locks);
 
diff --git a/src/include/box64stack.h b/src/include/box64stack.h
index 997e0646..0607f23f 100644
--- a/src/include/box64stack.h
+++ b/src/include/box64stack.h
@@ -9,11 +9,4 @@ typedef struct x64emu_s x64emu_t;
 int CalcStackSize(box64context_t *context);
 void SetupInitialStack(x64emu_t *emu);
 
-uint16_t Pop16(x64emu_t *emu);
-void Push16(x64emu_t *emu, uint16_t v);
-uint32_t Pop32(x64emu_t *emu);
-void Push32(x64emu_t *emu, uint32_t v);
-uint64_t Pop64(x64emu_t *emu);
-void Push64(x64emu_t *emu, uint64_t v);
-
-#endif //__BOX64_STACK_H_
\ No newline at end of file
+#endif //__BOX64_STACK_H_
diff --git a/src/include/bridge.h b/src/include/bridge.h
index 9859ae85..0c238089 100644
--- a/src/include/bridge.h
+++ b/src/include/bridge.h
@@ -7,13 +7,13 @@ 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();
+bridge_t *NewBridge(void);
 void FreeBridge(bridge_t** bridge);
 
 uintptr_t AddBridge(bridge_t* bridge, wrapper_t w, void* fnc, int N, const char* name);
 uintptr_t CheckBridged(bridge_t* bridge, void* fnc);
 uintptr_t AddCheckBridge(bridge_t* bridge, wrapper_t w, void* fnc, int N, const char* name);
-uintptr_t AddAutomaticBridge(x64emu_t* emu, 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, const char* name);
 void* GetNativeFnc(uintptr_t fnc);
 void* GetNativeFncOrFnc(uintptr_t fnc);
 
@@ -22,13 +22,13 @@ uintptr_t AddVSyscall(bridge_t* bridge, int num);
 int hasAlternate(void* addr);
 void* getAlternate(void* addr);
 void addAlternate(void* addr, void* alt);
-void cleanAlternate();
+void cleanAlternate(void);
 
 #ifdef HAVE_TRACE
 const char* getBridgeName(void* addr);
 #endif
 
-void init_bridge_helper();
-void fini_bridge_helper();
+void init_bridge_helper(void);
+void fini_bridge_helper(void);
 
 #endif //__BRIDGE_H_
\ No newline at end of file
diff --git a/src/include/callback.h b/src/include/callback.h
index eecbc3d2..48d360c5 100644
--- a/src/include/callback.h
+++ b/src/include/callback.h
@@ -5,13 +5,14 @@
 
 typedef struct x64emu_s x64emu_t;
 
-uint64_t RunFunction(box64context_t *context, uintptr_t fnc, int nargs, ...);
+uint64_t RunFunction(uintptr_t fnc, int nargs, ...);
+uint64_t RunFunctionFmt(uintptr_t fnc, const char* fmt, ...);
 // save all modified register
-uint64_t RunSafeFunction(box64context_t *context, uintptr_t fnc, int nargs, ...);
+uint64_t RunSafeFunction(uintptr_t fnc, int nargs, ...);
 // use emu state to run function
 uint64_t RunFunctionWithEmu(x64emu_t *emu, int QuitOnLongJumpExit, uintptr_t fnc, int nargs, ...);
 // using the Windows x64 calling convention
-uint64_t RunFunctionWindows(box64context_t *context, uintptr_t fnc, int nargs, ...);
+uint64_t RunFunctionWindows(uintptr_t fnc, int nargs, ...);
 
 
 #endif //__CALLBACK_H__
\ No newline at end of file
diff --git a/src/include/custommem.h b/src/include/custommem.h
index e7623db2..13e73c4f 100644
--- a/src/include/custommem.h
+++ b/src/include/custommem.h
@@ -32,7 +32,7 @@ int setJumpTableIfRef64(void* addr, void* jmp, void* ref); // return 1 if write
 void setJumpTableDefault64(void* addr);
 void setJumpTableDefaultRef64(void* addr, void* jmp);
 int isJumpTableDefault64(void* addr);
-uintptr_t getJumpTable64();
+uintptr_t getJumpTable64(void);
 uintptr_t getJumpTableAddress64(uintptr_t addr);
 uintptr_t getJumpAddress64(uintptr_t addr);
 
@@ -64,7 +64,7 @@ void freeProtection(uintptr_t addr, size_t size);
 void refreshProtection(uintptr_t addr);
 uint32_t getProtection(uintptr_t addr);
 int getMmapped(uintptr_t addr);
-void loadProtectionFromMap();
+void loadProtectionFromMap(void);
 #ifdef DYNAREC
 void protectDB(uintptr_t addr, size_t size);
 void unprotectDB(uintptr_t addr, size_t size, int mark);    // if mark==0, the blocks are not marked as potentially dirty
@@ -79,7 +79,7 @@ void* find47bitBlock(size_t size);
 void* find47bitBlockNearHint(void* hint, size_t size);
 
 // unlock mutex that are locked by current thread (for signal handling). Return a mask of unlock mutex
-int unlockCustommemMutex();
+int unlockCustommemMutex(void);
 // relock the muxtex that were unlocked
 void relockCustommemMutex(int locks);
 
diff --git a/src/include/debug.h b/src/include/debug.h
index 37146e02..8397d6c5 100644
--- a/src/include/debug.h
+++ b/src/include/debug.h
@@ -23,16 +23,23 @@ extern int box64_dynarec_x87double;
 extern int box64_dynarec_safeflags;
 extern int box64_dynarec_callret;
 extern int box64_dynarec_bleeding_edge;
+extern int box64_dynarec_jvm;
 extern int box64_dynarec_hotpage;
 extern int box64_dynarec_fastpage;
 extern int box64_dynarec_wait;
 extern int box64_dynarec_test;
+extern int box64_dynarec_missing;
 #ifdef ARM64
 extern int arm64_asimd;
 extern int arm64_aes;
 extern int arm64_pmull;
 extern int arm64_crc32;
 extern int arm64_atomics;
+#elif defined(RV64)
+extern int rv64_zba;
+extern int rv64_zbb;
+extern int rv64_zbc;
+extern int rv64_zbs;
 #endif
 #endif
 extern int box64_libcef;
@@ -96,7 +103,7 @@ void printf_ftrace(const char* fmt, ...);
 #define EXPORTDYN 
 #endif
 
-void init_malloc_hook();
+void init_malloc_hook(void);
 extern size_t(*box_malloc_usable_size)(void*);
 #ifdef ANDROID
 extern void*(*__libc_malloc)(size_t);
diff --git a/src/include/dictionnary.h b/src/include/dictionnary.h
index e2ec1466..efa5e1cc 100644
--- a/src/include/dictionnary.h
+++ b/src/include/dictionnary.h
@@ -4,7 +4,7 @@
 

 typedef void dic_t;

 

-dic_t *NewDictionnary();

+dic_t *NewDictionnary(void);

 void FreeDictionnary(dic_t **dic);

 

 const char* AddDictionnary(dic_t* dic, const char* s);

diff --git a/src/include/dynablock.h b/src/include/dynablock.h
index 4e9d0b36..757ca4ae 100644
--- a/src/include/dynablock.h
+++ b/src/include/dynablock.h
@@ -15,10 +15,10 @@ dynablock_t* InvalidDynablock(dynablock_t* db, int need_lock);
 dynablock_t* FindDynablockFromNativeAddress(void* addr);    // defined in box64context.h
 
 // Handling of Dynarec block (i.e. an exectable chunk of x64 translated code)
-dynablock_t* DBGetBlock(x64emu_t* emu, uintptr_t addr, int create);   // return NULL if block is not found / cannot be created. Don't create if create==0
-dynablock_t* DBAlternateBlock(x64emu_t* emu, uintptr_t addr, uintptr_t filladdr);
+dynablock_t* DBGetBlock(x64emu_t* emu, uintptr_t addr, int create, int is32bits);   // return NULL if block is not found / cannot be created. Don't create if create==0
+dynablock_t* DBAlternateBlock(x64emu_t* emu, uintptr_t addr, uintptr_t filladdr, int is32bits);
 
 // for use in signal handler
-void cancelFillBlock();
+void cancelFillBlock(void);
 
 #endif //__DYNABLOCK_H_
\ No newline at end of file
diff --git a/src/include/dynarec_native.h b/src/include/dynarec_native.h
index eff5a6bf..05bfc3b5 100644
--- a/src/include/dynarec_native.h
+++ b/src/include/dynarec_native.h
@@ -5,9 +5,22 @@ typedef struct dynablock_s dynablock_t;
 typedef struct x64emu_s x64emu_t;
 typedef struct instsize_s instsize_t;
 
+//#define USE_CUSTOM_MEM
+#ifdef USE_CUSTOM_MEM
+#define dynaMalloc customMalloc
+#define dynaCalloc customCalloc
+#define dynaRealloc customRealloc
+#define dynaFree customFree
+#else
+#define dynaMalloc box_malloc
+#define dynaCalloc box_calloc
+#define dynaRealloc box_realloc
+#define dynaFree box_free
+#endif
+
 void addInst(instsize_t* insts, size_t* size, int x64_size, int native_size);
 
 void CancelBlock64(int need_lock);
-void* FillBlock64(dynablock_t* block, uintptr_t addr);
+void* FillBlock64(dynablock_t* block, uintptr_t addr, int alternate, int is32bits);
 
 #endif //__DYNAREC_ARM_H_
\ No newline at end of file
diff --git a/src/include/dynarec_rv64.h b/src/include/dynarec_rv64.h
index 9abb704b..dd3b734e 100644
--- a/src/include/dynarec_rv64.h
+++ b/src/include/dynarec_rv64.h
@@ -4,7 +4,7 @@
 typedef struct dynablock_s dynablock_t;
 typedef struct x64emu_s x64emu_t;
 
-void CancelBlock64();
+void CancelBlock64(void);
 void* FillBlock64(dynablock_t* block, uintptr_t addr);
 
 #endif //__DYNAREC_RV64_H_
\ No newline at end of file
diff --git a/src/include/elfloader.h b/src/include/elfloader.h
index d5b54145..ca8839df 100644
--- a/src/include/elfloader.h
+++ b/src/include/elfloader.h
@@ -25,6 +25,7 @@ int CalcLoadAddr(elfheader_t* head);
 int AllocElfMemory(box64context_t* context, elfheader_t* head, int mainbin);
 void FreeElfMemory(elfheader_t* head);
 int LoadElfMemory(FILE* f, box64context_t* context, elfheader_t* head);
+int isElfHasNeededVer(elfheader_t* head, const char* libname, elfheader_t* verneeded);
 int ReloadElfMemory(FILE* f, box64context_t* context, elfheader_t* head);
 int RelocateElf(lib_t *maplib, lib_t* local_maplib, int bindnow, elfheader_t* head);
 int RelocateElfPlt(lib_t *maplib, lib_t* local_maplib, int bindnow, elfheader_t* head);
@@ -64,6 +65,8 @@ const char* GetParentSymbolVersion(elfheader_t* h, int index);
 const char* VersionedName(const char* name, int ver, const char* vername);
 int SameVersionedSymbol(const char* name1, int ver1, const char* vername1, const char* name2, int ver2, const char* vername2);
 int GetVersionIndice(elfheader_t* h, const char* vername);
+int GetNeededVersionCnt(elfheader_t* h, const char* libname);
+const char* GetNeededVersionString(elfheader_t* h, const char* libname, int idx);
 
 kh_mapsymbols_t* GetMapSymbols(elfheader_t* h);
 kh_mapsymbols_t* GetWeakSymbols(elfheader_t* h);
diff --git a/src/include/fileutils.h b/src/include/fileutils.h
index c666f0be..2e983c74 100644
--- a/src/include/fileutils.h
+++ b/src/include/fileutils.h
@@ -19,13 +19,13 @@ int FileIsX64ELF(const char* filename);
 int FileIsShell(const char* filename);
 
 // return temp folder (will return /tmp if nothing is correct)
-const char* GetTmpDir();
+const char* GetTmpDir(void);
 
 // will lower case the string and return a copy. Nothing fancy here, just A..Z transformed to a..z, rest is untouched
 char* LowerCase(const char* s);
 
 #if defined(RPI) || defined(RK3399) || defined(RK3326)
-void sanitize_mojosetup_gtk_background();
+void sanitize_mojosetup_gtk_background(void);
 #endif
 
 #endif //__FILEUTILS_H_
\ No newline at end of file
diff --git a/src/include/globalsymbols.h b/src/include/globalsymbols.h
index fc2753ef..d0eb3012 100644
--- a/src/include/globalsymbols.h
+++ b/src/include/globalsymbols.h
@@ -2,18 +2,18 @@
 #define _GLOBAL_SYMBOLS_H_

 

 //GTK stuff

-void my_checkGlobalGdkDisplay();

-void my_setGlobalGThreadsInit();

+void my_checkGlobalGdkDisplay(void);

+void my_setGlobalGThreadsInit(void);

 

-//void** my_GetGTKDisplay();

-void** my_GetGthreadsGotInitialized();  // defined in wrappedgthread2

+//void** my_GetGTKDisplay(void);

+void** my_GetGthreadsGotInitialized(void);  // defined in wrappedgthread2

 

 // NCurse / TInfo

-void my_checkGlobalTInfo();

-void my_updateGlobalTInfo();

+void my_checkGlobalTInfo(void);

+void my_updateGlobalTInfo(void);

 

 // getopt

-void my_checkGlobalOpt();

-void my_updateGlobalOpt();

+void my_checkGlobalOpt(void);

+void my_updateGlobalOpt(void);

 

 #endif //_GLOBAL_SYMBOLS_H_
\ No newline at end of file
diff --git a/src/include/gtkclass.h b/src/include/gtkclass.h
index 23822088..8a88a0d2 100644
--- a/src/include/gtkclass.h
+++ b/src/include/gtkclass.h
@@ -778,6 +778,22 @@ typedef struct my_GstAllocatorClass_s {
   void*    _gst_reserved[4];
 } my_GstAllocatorClass_t;
 
+typedef struct my_GstTaskPoolClass_s {
+  my_GstObjectClass_t parent_class;
+  void      (*prepare)  (void* pool, void* error);
+  void      (*cleanup)  (void* pool);
+  void*     (*push)     (void* pool, void* func, void* user_data, void* error);
+  void      (*join)     (void* pool, void* id);
+  void      (*dispose_handle) (void* pool, void* id);
+  void*     _gst_reserved[4-1];
+} my_GstTaskPoolClass_t;
+
+typedef struct my_GDBusProxyClass_s {
+  my_GObjectClass_t parent_class;
+  void (*g_properties_changed) (void* proxy, void* changed_properties, const char* const* invalidated_properties);
+  void (*g_signal)             (void* proxy, const char* sender_name, const char* signal_name, void* parameters);
+  void* padding[32];
+} my_GDBusProxyClass_t;
 
 // GTypeValueTable
 typedef struct my_GTypeValueTable_s {
@@ -831,7 +847,7 @@ my_GTypeInfo_t* findFreeGTypeInfo(my_GTypeInfo_t* fcts, size_t parent);
 my_GtkTypeInfo_t* findFreeGtkTypeInfo(my_GtkTypeInfo_t* fcts, size_t parent);
 
 void InitGTKClass(bridge_t *bridge);
-void FiniGTKClass();
+void FiniGTKClass(void);
 
 #define GTKCLASSES()                \
 GTKCLASS(GObject)                   \
@@ -884,6 +900,8 @@ GTKCLASS(AtkObject)                 \
 GTKCLASS(AtkUtil)                   \
 GTKCLASS(GstObject)                 \
 GTKCLASS(GstAllocator)              \
+GTKCLASS(GstTaskPool)               \
+GTKCLASS(GDBusProxy)                \
 
 #define GTKCLASS(A) void Set##A##ID(size_t id);
 GTKCLASSES()
diff --git a/src/include/librarian.h b/src/include/librarian.h
index 2ff059df..80e108ca 100644
--- a/src/include/librarian.h
+++ b/src/include/librarian.h
@@ -16,15 +16,17 @@ typedef char* cstr_t;
 
 lib_t *NewLibrarian(box64context_t* context, int ownlibs);
 void FreeLibrarian(lib_t **maplib, x64emu_t* emu);
-dlprivate_t *NewDLPrivate();
+dlprivate_t *NewDLPrivate(void);
 void FreeDLPrivate(dlprivate_t **lib);
 
 box64context_t* GetLibrarianContext(lib_t* maplib);
 kh_mapsymbols_t* GetGlobalData(lib_t* maplib);
-int AddNeededLib(lib_t* maplib, int local, int bindnow, needed_libs_t* needed, box64context_t* box64, x64emu_t* emu); // 0=success, 1=error
+int AddNeededLib(lib_t* maplib, int local, int bindnow, needed_libs_t* needed, elfheader_t* verneeded, box64context_t* box64, x64emu_t* emu); // 0=success, 1=error
 void RemoveNeededLib(lib_t* maplib, int local, needed_libs_t* needed, box64context_t* box64, x64emu_t* emu);
 library_t* GetLibMapLib(lib_t* maplib, const char* name);
 library_t* GetLibInternal(const char* name);
+void promoteLocalLibGlobal(library_t* lib);
+int isLibLocal(library_t* lib);
 uintptr_t FindGlobalSymbol(lib_t *maplib, const char* name, int version, const char* vername);
 int GetNoSelfSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end, elfheader_t* self, size_t size, int version, const char* vername, const char* globdefver, const char* weakdefver);
 int GetGlobalSymbolStartEnd(lib_t *maplib, const char* name, uintptr_t* start, uintptr_t* end, elfheader_t *self, int version, const char* vername, const char* globdefver, const char* weakdefver);
diff --git a/src/include/library.h b/src/include/library.h
index ff48b691..b08927e0 100644
--- a/src/include/library.h
+++ b/src/include/library.h
@@ -15,7 +15,7 @@ typedef struct elfheader_s     elfheader_t;
 #define LIB_EMULATED    1
 #define LIB_UNNKNOW     -1
 
-library_t *NewLibrary(const char* path, box64context_t* box64);
+library_t *NewLibrary(const char* path, box64context_t* box64, elfheader_t* verneeded);
 int AddSymbolsLibrary(lib_t* maplib, library_t* lib, x64emu_t* emu);
 int FinalizeLibrary(library_t* lib, lib_t* local_maplib, int bindnow, x64emu_t* emu);
 
diff --git a/src/include/myalign.h b/src/include/myalign.h
index 1a0f60bf..247ea1b9 100644
--- a/src/include/myalign.h
+++ b/src/include/myalign.h
@@ -214,4 +214,4 @@ void AlignSemidDs(void *dest, const void* source);
 
 uintptr_t getVArgs(x64emu_t* emu, int pos, uintptr_t* b, int N);
 
-#endif  //__MY_ALIGN__H_
\ No newline at end of file
+#endif  //__MY_ALIGN__H_
diff --git a/src/include/rcfile.h b/src/include/rcfile.h
index c194e9ae..ebad7048 100644
--- a/src/include/rcfile.h
+++ b/src/include/rcfile.h
@@ -2,7 +2,7 @@
 #define __RCFILE_H__
 
 void LoadRCFile(const char* filename);
-void DeleteParams();
+void DeleteParams(void);
 void ApplyParams(const char* name);
 
 #endif //__RCFILE_H__
\ No newline at end of file
diff --git a/src/include/regs.h b/src/include/regs.h
index 7a4ced73..a80b393e 100644
--- a/src/include/regs.h
+++ b/src/include/regs.h
@@ -17,7 +17,7 @@ enum {
 #define _DI _RDI
 
 enum {
-    _CS, _DS, _SS, _ES, _FS, _GS
+    _ES, _CS, _SS, _DS, _FS, _GS
 };
 
 
diff --git a/src/include/sdl1rwops.h b/src/include/sdl1rwops.h
index 46b73519..76fd890f 100644
--- a/src/include/sdl1rwops.h
+++ b/src/include/sdl1rwops.h
@@ -4,7 +4,7 @@
 typedef struct SDL1_RWops_s SDL1_RWops_t;   // the actual SDL1 SDL_RWops
 typedef struct x64emu_s x64emu_t;
 
-typedef SDL1_RWops_t* (*sdl1_allocrw)();
+typedef SDL1_RWops_t* (*sdl1_allocrw)(void);
 typedef void (*sdl1_freerw)(SDL1_RWops_t*);
 
 // each function will be added to dictionary, and each native functions will be wrapped so they run in emulated world
diff --git a/src/include/sdl2rwops.h b/src/include/sdl2rwops.h
index f03f17c2..1b13c091 100644
--- a/src/include/sdl2rwops.h
+++ b/src/include/sdl2rwops.h
@@ -4,7 +4,7 @@
 typedef struct SDL2_RWops_s SDL2_RWops_t;   // the actual SDL2 SDL_RWops
 typedef struct x64emu_s x64emu_t;
 
-typedef SDL2_RWops_t* (*sdl2_allocrw)();
+typedef SDL2_RWops_t* (*sdl2_allocrw)(void);
 typedef void (*sdl2_freerw)(SDL2_RWops_t*);
 
 typedef struct SDL2RWSave_s {
diff --git a/src/include/signals.h b/src/include/signals.h
index 22e96d15..f3697f48 100644
--- a/src/include/signals.h
+++ b/src/include/signals.h
@@ -34,7 +34,7 @@ int my___sigaction(x64emu_t* emu, int signum, const x64_sigaction_t *act, x64_si
 int my_syscall_rt_sigaction(x64emu_t* emu, int signum, const x64_sigaction_restorer_t *act, x64_sigaction_restorer_t *oldact, int sigsetsize);
 
 void init_signal_helper(box64context_t* context);
-void fini_signal_helper();
+void fini_signal_helper(void);
 
 void emit_signal(x64emu_t* emu, int sig, void* addr, int code);
 
diff --git a/src/include/symbols.h b/src/include/symbols.h
index b00a354b..32e54b20 100644
--- a/src/include/symbols.h
+++ b/src/include/symbols.h
@@ -9,14 +9,15 @@ typedef struct versymbols_s versymbols_t;
 
 KHASH_MAP_DECLARE_STR(mapsymbols, versymbols_t)
 
-kh_mapsymbols_t* NewMapSymbols();
+kh_mapsymbols_t* NewMapSymbols(void);
 void FreeMapSymbols(kh_mapsymbols_t** map);
 
 // replace if already there
 void AddSymbol(kh_mapsymbols_t *mapsymbols, const char* name, uintptr_t addr, uint32_t sz, int ver, const char* vername);
 uintptr_t FindSymbol(kh_mapsymbols_t *mapsymbols, const char* name, int ver, const char* vername, int local, const char* defver);
+// Update addr and sz of existing symbols
+void ForceUpdateSymbol(kh_mapsymbols_t *mapsymbols, const char* name, uintptr_t addr, uint32_t sz);
 // don't add if already there
-
 void AddUniqueSymbol(kh_mapsymbols_t *mapsymbols, const char* name, uintptr_t addr, uint32_t sz, int ver, const char* vername);
 int GetSymbolStartEnd(kh_mapsymbols_t* mapsymbols, const char* name, uintptr_t* start, uintptr_t* end, int ver, const char* vername, int local, const char* defver);
 int GetSizedSymbolStartEnd(kh_mapsymbols_t* mapsymbols, const char* name, uintptr_t* start, uintptr_t* end, size_t size, int ver, const char* vername, int local, const char* defver);
@@ -24,7 +25,7 @@ const char* GetSymbolName(kh_mapsymbols_t* mapsymbols, void* p, uintptr_t* offs,
 
 // default version handling
 KHASH_MAP_DECLARE_STR(defaultversion, const char*)
-kh_defaultversion_t* NewDefaultVersion();
+kh_defaultversion_t* NewDefaultVersion(void);
 void FreeDefaultVersion(kh_defaultversion_t** def);
 
 void AddDefaultVersion(kh_defaultversion_t* def, const char* symname, const char* vername);
diff --git a/src/include/threads.h b/src/include/threads.h
index d094dc0b..af58046b 100644
--- a/src/include/threads.h
+++ b/src/include/threads.h
@@ -4,25 +4,15 @@
 typedef struct box64context_s box64context_t;
 typedef struct x64emu_s x64emu_t;
 
-typedef struct emu_jmpbuf_s {
-    x64emu_t*   emu;
-	void* 	    jmpbuf;
-	int 	    jmpbuf_ok;
-} emu_jmpbuf_t;
-
 void CleanStackSize(box64context_t* context);
 
-emu_jmpbuf_t* GetJmpBuf();
-
-void init_pthread_helper();
+void init_pthread_helper(void);
 void fini_pthread_helper(box64context_t* context);
 
 // prepare an "emuthread structure" in pet and return address of function pointer for a "thread creation routine"
 void* my_prepare_thread(x64emu_t *emu, void* f, void* arg, int ssize, void** pet);
 
-#ifndef DYNAREC
 //check and unlock if a mutex is locked by current thread (works only for PTHREAD_MUTEX_ERRORCHECK typed mutex)
 int checkUnlockMutex(void* m);
-#endif
 
 #endif //_THREADS_H_
\ No newline at end of file
diff --git a/src/include/wine_tools.h b/src/include/wine_tools.h
index 52993cea..5c60fec2 100644
--- a/src/include/wine_tools.h
+++ b/src/include/wine_tools.h
@@ -4,10 +4,10 @@
 void wine_prereserve(const char* reserve);
 
 extern int wine_preloaded;
-void* get_wine_prereserve();
+void* get_wine_prereserve(void);
 
 #ifdef DYNAREC
-void dynarec_wine_prereserve();
+void dynarec_wine_prereserve(void);
 #endif
 
 #endif //__WINE_TOOLS_H__
diff --git a/src/include/x64emu.h b/src/include/x64emu.h
index c7f2e20e..51a27a18 100644
--- a/src/include/x64emu.h
+++ b/src/include/x64emu.h
@@ -6,7 +6,7 @@ typedef struct box64context_s box64context_t;
 
 x64emu_t *NewX64Emu(box64context_t *context, uintptr_t start, uintptr_t stack, int stacksize, int ownstack);
 x64emu_t *NewX64EmuFromStack(x64emu_t* emu, box64context_t *context, uintptr_t start, uintptr_t stack, int stacksize, int ownstack);
-void SetupX64Emu(x64emu_t *emu);
+void SetupX64Emu(x64emu_t *emu, x64emu_t *ref);
 void FreeX64Emu(x64emu_t **x64emu);
 void FreeX64EmuFromStack(x64emu_t **emu);
 void CloneEmu(x64emu_t *newemu, const x64emu_t* emu);
@@ -14,7 +14,7 @@ void CopyEmu(x64emu_t *newemu, const x64emu_t* emu);
 void SetTraceEmu(uintptr_t trace_start, uintptr_t trace_end);
 
 box64context_t* GetEmuContext(x64emu_t* emu);
-uint32_t* GetParityTab();
+uint32_t* GetParityTab(void);
 
 uint32_t GetEAX(x64emu_t *emu);
 uint64_t GetRAX(x64emu_t *emu);
@@ -41,17 +41,15 @@ uint64_t GetRSP(x64emu_t *emu);
 uint64_t GetRBP(x64emu_t *emu);
 void ResetFlags(x64emu_t *emu);
 void ResetSegmentsCache(x64emu_t *emu);
-const char* DumpCPURegs(x64emu_t* emu, uintptr_t ip);
+const char* DumpCPURegs(x64emu_t* emu, uintptr_t ip, int is32bits);
 
-void StopEmu(x64emu_t* emu, const char* reason);
-void PushExit(x64emu_t* emu);
-void* GetExit();
+void StopEmu(x64emu_t* emu, const char* reason, int is32bits);
 void EmuCall(x64emu_t* emu, uintptr_t addr);
 void AddCleanup(x64emu_t *emu, void *p, void* dso_handle);
 void AddCleanup1Arg(x64emu_t *emu, void *p, void* a, void* dso_handle);
 void CallCleanup(x64emu_t *emu, void* p);
 void CallAllCleanup(x64emu_t *emu);
-void UnimpOpcode(x64emu_t* emu);
+void UnimpOpcode(x64emu_t* emu, int is32bits);
 
 uint64_t ReadTSC(x64emu_t* emu);
 
@@ -60,7 +58,7 @@ long double LD2localLD(void* ld);        // long double (80bits pointer) -> long
 void LD2D(void* ld, void* d);   // long double (80bits) -> double (64bits)
 void D2LD(void* d, void* ld);   // double (64bits) -> long double (64bits)
 
-void printFunctionAddr(uintptr_t nextaddr, const char* text);
+int printFunctionAddr(uintptr_t nextaddr, const char* text); // 0 if nothing was found
 const char* getAddrFunctionName(uintptr_t addr);
 
 #endif //__X86EMU_H_
\ No newline at end of file
diff --git a/src/include/x64run.h b/src/include/x64run.h
index 0e156341..11f07cfa 100644
--- a/src/include/x64run.h
+++ b/src/include/x64run.h
@@ -11,6 +11,6 @@ int DynaRun(x64emu_t *emu);
 uint32_t LibSyscall(x64emu_t *emu);
 void PltResolver(x64emu_t* emu);
 extern uintptr_t pltResolver;
-int GetTID();
+int GetTID(void);
 
 #endif //__X64RUN_H_
\ No newline at end of file
diff --git a/src/include/x64tls.h b/src/include/x64tls.h
index 9ca97efb..66f0d9eb 100644
--- a/src/include/x64tls.h
+++ b/src/include/x64tls.h
@@ -2,8 +2,9 @@
 #define __X64_TLS_H__
 
 typedef struct thread_area_s thread_area_t;
+typedef struct thread_area_32_s thread_area_32_t;
 
-uint32_t my_set_thread_area(thread_area_t* td);
+uint32_t my_set_thread_area_32(x64emu_t* emu, thread_area_32_t* td);
 uint32_t my_modify_ldt(x64emu_t* emu, int op, thread_area_t* td, int size);
 
 tlsdatasize_t* getTLSData(box64context_t *context);
diff --git a/src/include/x64trace.h b/src/include/x64trace.h
index 662f2740..e7c3efd7 100644
--- a/src/include/x64trace.h
+++ b/src/include/x64trace.h
@@ -8,10 +8,11 @@ typedef struct zydis_dec_s zydis_dec_t;
 int InitX64Trace(box64context_t *context);
 void DeleteX64Trace(box64context_t *context);
 
+zydis_dec_t* InitX86TraceDecoder(box64context_t *context);
+void DeleteX86TraceDecoder(zydis_dec_t **dec);
 zydis_dec_t* InitX64TraceDecoder(box64context_t *context);
 void DeleteX64TraceDecoder(zydis_dec_t **dec);
-const char* DecodeX64Trace(zydis_dec_t *dec, uintptr_t p);
 
-#define ZYDIS_RUNTIME_ADDRESS_NONE (uint64_t)(-1)
+const char* DecodeX64Trace(zydis_dec_t *dec, uintptr_t p);
 
 #endif //__X64TRACE_H_
\ No newline at end of file