about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorYang Liu <numbksco@gmail.com>2024-05-20 18:04:31 +0800
committerGitHub <noreply@github.com>2024-05-20 12:04:31 +0200
commitaead503f0290eef0e56de76ff4001477f0e8d812 (patch)
tree6d41d40cb8efdca89c1bb5a6a4d770d0dd449d01 /src
parent7ef2af254910f9a651c7d3633c2ada696065a8b1 (diff)
downloadbox64-aead503f0290eef0e56de76ff4001477f0e8d812.tar.gz
box64-aead503f0290eef0e56de76ff4001477f0e8d812.zip
[INTERPRETER] Fixed CMPXCHG16B opcode for la64 (#1506)
it's not the best we can do, but it fixes things. Will came up something better with scq extension later.
Diffstat (limited to 'src')
-rw-r--r--src/emu/x64runf0.c2
-rw-r--r--src/include/box64context.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/emu/x64runf0.c b/src/emu/x64runf0.c
index 70d945ec..ce7145fc 100644
--- a/src/emu/x64runf0.c
+++ b/src/emu/x64runf0.c
@@ -745,7 +745,7 @@ uintptr_t RunF0(x64emu_t *emu, rex_t rex, uintptr_t addr)
                             GETGD;

 #if defined(DYNAREC) && !defined(TEST_INTERPRETER)

                             if (rex.w) {

-#if defined(__riscv)

+#if defined(__riscv) || defined(__loongarch64)

                                 while (native_lock_xchg_d(&emu->context->mutex_16b, 1)); // lock

                                 tmp64u = ((uint64_t*)ED)[0];

                                 tmp64u2 = ((uint64_t*)ED)[1];

diff --git a/src/include/box64context.h b/src/include/box64context.h
index 19c45f90..b8706729 100644
--- a/src/include/box64context.h
+++ b/src/include/box64context.h
@@ -165,7 +165,7 @@ typedef struct box64context_s {
     rbtree*             db_sizes;
     int                 trace_dynarec;
     pthread_mutex_t     mutex_lock;     // this is for the Test interpreter
-    #ifdef __riscv
+    #if defined(__riscv) || defined(__loongarch64)
     uint32_t            mutex_16b;
     #endif
     #endif