about summary refs log tree commit diff stats
path: root/src/include
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-03-05 20:47:50 +0100
committerGitHub <noreply@github.com>2023-03-05 20:47:50 +0100
commitb56be08f959557a0a1fd18190ff89f8de83862a1 (patch)
tree479d45d4eec05abd148d5038e9e78807d9400590 /src/include
parentcabcca2e31207aea12fe0a07c41b3c6b56ce1892 (diff)
parentb1923cadb5fbd4abd3fcba36142266f6ce588f4e (diff)
downloadbox64-b56be08f959557a0a1fd18190ff89f8de83862a1.tar.gz
box64-b56be08f959557a0a1fd18190ff89f8de83862a1.zip
Merge pull request #534 from ptitSeb/steam_chrome
Steamwebhelper compatibility
Diffstat (limited to 'src/include')
-rwxr-xr-xsrc/include/box64context.h6
-rw-r--r--src/include/custommem.h19
-rwxr-xr-xsrc/include/debug.h2
-rw-r--r--src/include/gltools.h12
-rwxr-xr-xsrc/include/library.h4
-rwxr-xr-xsrc/include/myalign.h4
6 files changed, 36 insertions, 11 deletions
diff --git a/src/include/box64context.h b/src/include/box64context.h
index c8360017..010521e8 100755
--- a/src/include/box64context.h
+++ b/src/include/box64context.h
@@ -33,9 +33,8 @@ typedef struct mmaplist_s       mmaplist_t;
 typedef struct kh_dynablocks_s  kh_dynablocks_t;
 #endif
 #define DYNAMAP_SHIFT 16
-#define JMPTABL_SHIFT 16
 
-typedef void* (*procaddess_t)(const char* name);
+typedef void* (*procaddress_t)(const char* name);
 typedef void* (*vkprocaddess_t)(void* instance, const char* name);
 
 #define MAX_SIGNAL 64
@@ -115,9 +114,6 @@ typedef struct box64context_s {
     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
-    kh_symbolmap_t      *glwrappers;    // the map of wrapper for glProcs (for GLX or SDL1/2)
-    kh_symbolmap_t      *glmymap;       // link to the mysymbolmap of libGL
-    procaddess_t        glxprocaddress;
     kh_symbolmap_t      *alwrappers;    // the map of wrapper for alGetProcAddress
     kh_symbolmap_t      *almymap;       // link to the mysymbolmap if libOpenAL
     kh_symbolmap_t      *vkwrappers;    // the map of wrapper for VulkanProcs (TODO: check SDL2)
diff --git a/src/include/custommem.h b/src/include/custommem.h
index f2a4481d..e03db81c 100644
--- a/src/include/custommem.h
+++ b/src/include/custommem.h
@@ -34,17 +34,34 @@ int isJumpTableDefault64(void* addr);
 uintptr_t getJumpTable64();
 uintptr_t getJumpTableAddress64(uintptr_t addr);
 uintptr_t getJumpAddress64(uintptr_t addr);
+
+#define JMPTABL_SHIFT3 18
+#define JMPTABL_SHIFT2 18
+#define JMPTABL_SHIFT1 18
+#define JMPTABL_SHIFT0 10
+#define JMPTABL_START3 (JMPTABL_START2+JMPTABL_SHIFT2)
+#define JMPTABL_START2 (JMPTABL_START1+JMPTABL_SHIFT1)
+#define JMPTABL_START1 (JMPTABL_START0+JMPTABL_SHIFT0)
+#define JMPTABL_START0 0
+#define JMPTABLE_MASK3 ((1<<JMPTABL_SHIFT3)-1)
+#define JMPTABLE_MASK2 ((1<<JMPTABL_SHIFT2)-1)
+#define JMPTABLE_MASK1 ((1<<JMPTABL_SHIFT1)-1)
+#define JMPTABLE_MASK0 ((1<<JMPTABL_SHIFT0)-1)
 #endif
 
 #define PROT_DYNAREC    0x80
 #define PROT_DYNAREC_R  0x40
-#define PROT_CUSTOM     (PROT_DYNAREC | PROT_DYNAREC_R)
+#define PROT_MMAP       0x20
+#define PROT_DYN        (PROT_DYNAREC | PROT_DYNAREC_R)
+#define PROT_CUSTOM     (PROT_DYNAREC | PROT_DYNAREC_R | PROT_MMAP)
 
 void updateProtection(uintptr_t addr, size_t size, uint32_t prot);
 void setProtection(uintptr_t addr, size_t size, uint32_t prot);
+void setProtection_mmap(uintptr_t addr, size_t size, uint32_t prot);
 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();
 #ifdef DYNAREC
 void protectDB(uintptr_t addr, size_t size);
diff --git a/src/include/debug.h b/src/include/debug.h
index b9729787..e2e75ee1 100755
--- a/src/include/debug.h
+++ b/src/include/debug.h
@@ -33,6 +33,7 @@ extern int arm64_crc32;
 extern int arm64_atomics;
 #endif
 #endif
+extern int box64_libcef;
 extern int dlsym_error;    // log dlsym error
 extern int cycle_log;      // if using rolling logs
 #ifdef HAVE_TRACE
@@ -46,6 +47,7 @@ extern char* box64_trace;
 extern uint64_t start_cnt;
 #endif
 extern int box64_nosandbox;
+extern int box64_malloc_hack;
 extern int box64_dummy_crashhandler;
 extern int box64_sse_flushto0;
 extern int box64_x87_no80bits;
diff --git a/src/include/gltools.h b/src/include/gltools.h
new file mode 100644
index 00000000..07bd74f7
--- /dev/null
+++ b/src/include/gltools.h
@@ -0,0 +1,12 @@
+#ifndef __GL_TOOLS_H__
+#define __GL_TOOLS_H__
+
+typedef struct box64context_s box64context_t;
+
+typedef void* (*glprocaddress_t)(const char* name);
+
+void freeGLProcWrapper(box64context_t* context);
+
+void* getGLProcAddress(x64emu_t* emu, glprocaddress_t procaddr, const char* rname);
+
+#endif //__GL_TOOLS_H__
\ No newline at end of file
diff --git a/src/include/library.h b/src/include/library.h
index 48200a9e..afe108e7 100755
--- a/src/include/library.h
+++ b/src/include/library.h
@@ -28,10 +28,6 @@ int IsSameLib(library_t* lib, const char* path);    // check if lib is same (pat
 int GetLibGlobalSymbolStartEnd(library_t* lib, const char* name, uintptr_t* start, uintptr_t* end, size_t size, int* weak, int version, const char* vername, int local);
 int GetLibWeakSymbolStartEnd(library_t* lib, const char* name, uintptr_t* start, uintptr_t* end, size_t size, int* weak, int version, const char* vername, int local);
 int GetLibLocalSymbolStartEnd(library_t* lib, const char* name, uintptr_t* start, uintptr_t* end, size_t size, int* weak, int version, const char* vername, int local);
-void fillGLProcWrapper(box64context_t* context);
-void freeGLProcWrapper(box64context_t* context);
-void fillALProcWrapper(box64context_t* context);
-void freeALProcWrapper(box64context_t* context);
 char** GetNeededLibsNames(library_t* lib);
 int GetNeededLibsN(library_t* lib);
 library_t* GetNeededLib(library_t* lib, int idx);
diff --git a/src/include/myalign.h b/src/include/myalign.h
index 4a705afa..cc4922bd 100755
--- a/src/include/myalign.h
+++ b/src/include/myalign.h
@@ -50,7 +50,7 @@ typedef struct {
     memcpy(&p[6], emu->xmm, 8*16);                  \
   }
 
-
+#define PREFER_CONVERT_VAARG
 
 #elif defined(__aarch64__)
 // aarch64: 8 64bits general regs and 8 128bits float regs
@@ -92,6 +92,8 @@ typedef struct  va_list {
     memcpy(&p[6], emu->xmm, 8*16);                                      \
   }
 
+#define PREFER_CONVERT_VAARG
+
 #elif defined(__sw_64__) /* or Alpha */
 /*
 typdef struct {