about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-02-27 19:06:21 +0800
committerptitSeb <sebastien.chev@gmail.com>2022-02-27 19:06:21 +0800
commit2f1024f16763165db359e7c30ad7034a4434d752 (patch)
tree23423a5e8407bbd59516927c3bceb5bcd3b3ab04 /src
parent6d4183934128e58bcfe27d419a41a89ed073e0b7 (diff)
downloadbox64-2f1024f16763165db359e7c30ad7034a4434d752.tar.gz
box64-2f1024f16763165db359e7c30ad7034a4434d752.zip
[DYNAREC] More multi-arch work
Diffstat (limited to 'src')
-rw-r--r--src/custommem.c7
-rwxr-xr-xsrc/dynarec/dynarec.c27
2 files changed, 18 insertions, 16 deletions
diff --git a/src/custommem.c b/src/custommem.c
index c92b7b03..236456a0 100644
--- a/src/custommem.c
+++ b/src/custommem.c
@@ -644,6 +644,9 @@ void cleanDBFromAddressRange(uintptr_t addr, size_t size, int destroy)
 #ifdef ARM64
 void arm64_next(void);
 #define native_next arm64_next
+#elif defined(LA464)
+void la464_next(void);
+#define native_next la464_next
 #else
 #error Unsupported architecture
 #endif
@@ -1162,7 +1165,6 @@ void init_custommem_helper(box64context_t* ctx)
         memprot[i] = memprot_default;
     init_mutexes();
 #ifdef DYNAREC
-#ifdef ARM64
     if(box64_dynarec)
         for(int i=0; i<(1<<JMPTABL_SHIFT); ++i) {
             box64_jmptbldefault0[i] = (uintptr_t)native_next;
@@ -1170,9 +1172,6 @@ void init_custommem_helper(box64context_t* ctx)
             box64_jmptbldefault2[i] = box64_jmptbldefault1;
             box64_jmptbl3[i] = box64_jmptbldefault2;
         }
-#else
-#error Unsupported architecture!
-#endif
 #endif
     pthread_atfork(NULL, NULL, atfork_child_custommem);
 }
diff --git a/src/dynarec/dynarec.c b/src/dynarec/dynarec.c
index 36fa85ad..694c5690 100755
--- a/src/dynarec/dynarec.c
+++ b/src/dynarec/dynarec.c
@@ -26,7 +26,15 @@
 #ifdef ARM64
 void arm64_prolog(x64emu_t* emu, void* addr) EXPORTDYN;
 void arm64_epilog() EXPORTDYN;
-void arm64_epilog_fast() EXPORTDYN;
+#define native_prolog       arm64_prolog
+#define native_epilog       arm64_epilog
+#elif defined(LA464)
+void la464_prolog(x64emu_t* emu, void* addr) EXPORTDYN;
+void la464_epilog() EXPORTDYN;
+#define native_prolog       la464_prolog
+#define native_epilog       la464_epilog
+#else
+#error Unsupported architecture
 #endif
 #endif
 
@@ -59,18 +67,17 @@ void* LinkNext(x64emu_t* emu, uintptr_t addr, void* x2, uintptr_t* x3)
             dynablock_t* db = FindDynablockFromNativeAddress(x2-4);
             dynarec_log(LOG_INFO, "Warning, jumping to a no-block address %p from %p (db=%p, x64addr=%p)\n", (void*)addr, x2-4, db, db?(void*)getX64Address(db, (uintptr_t)x2-4):NULL);
             #endif
-            //tableupdate(arm64_epilog, addr, table);
-            return arm64_epilog;
+            //tableupdate(native_epilog, addr, table);
+            return native_epilog;
         }
     }
     if(!block->done) {
         // not finished yet... leave linker
-        //tableupdate(arm_linker, addr, table);
-        return arm64_epilog;
+        return native_epilog;
     }
     if(!(jblock=block->block)) {
         // null block, but done: go to epilog, no linker here
-        return arm64_epilog;
+        return native_epilog;
     }
     //dynablock_t *father = block->father?block->father:block;
     return jblock;
@@ -131,9 +138,7 @@ void DynaCall(x64emu_t* emu, uintptr_t addr)
                 dynarec_log(LOG_DEBUG, "%04d|Calling DynaRec Block @%p (%p) of %d x64 instructions (father=%p) emu=%p\n", GetTID(), (void*)R_RIP, block->block, block->isize ,block->father, emu);
                 CHECK_FLAGS(emu);
                 // block is here, let's run it!
-                #ifdef ARM64
-                arm64_prolog(emu, block->block);
-                #endif
+                native_prolog(emu, block->block);
                 block = NULL;
             }
             if(emu->fork) {
@@ -212,9 +217,7 @@ int DynaRun(x64emu_t* emu)
             } else {
                 dynarec_log(LOG_DEBUG, "%04d|Running DynaRec Block @%p (%p) of %d x64 insts (father=%p) emu=%p\n", GetTID(), (void*)R_RIP, block->block, block->isize, block->father, emu);
                 // block is here, let's run it!
-                #ifdef ARM64
-                arm64_prolog(emu, block->block);
-                #endif
+                native_prolog(emu, block->block);
                 block = NULL;
             }
             if(emu->fork) {