about summary refs log tree commit diff stats
path: root/src/emu
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-03-12 14:04:57 +0100
committerGitHub <noreply@github.com>2023-03-12 14:04:57 +0100
commit262ec3ed3c9fdf8f5028c55f616565266fc53e4b (patch)
treee4713396644f8dcc524643b5b4e9778ed9d27fea /src/emu
parent38a5e55745b0e2474dcda1ff4636424af2f37bad (diff)
downloadbox64-262ec3ed3c9fdf8f5028c55f616565266fc53e4b.tar.gz
box64-262ec3ed3c9fdf8f5028c55f616565266fc53e4b.zip
Rv64 dynarec (#550)
* [RV64_DYNAREC] Pushed the rv64_lock.h
* [RV64_DYNAREC] Add initial support for atomic functions
* [RV64_DYNAREC] Added some basic infrastructure for the Dynarec (and 1 opcode)
* [RV64_DYNAREC] Add a disassembler for RV64 instructions
* [RV64_DYNAREC] Added 86 MOV opcode, and some fixes too
* [RV64_DYNAREC] Added 8D LEA opcode
* [RV64_DYNAREC] Added POP reg opcode
* [RV64_DYNAREC] Various fixes and small optims

---------

Co-authored-by: Yang Liu <liuyang22@iscas.ac.cn>
Diffstat (limited to 'src/emu')
-rwxr-xr-xsrc/emu/x64run.c8
-rw-r--r--src/emu/x64run66f0.c3
-rw-r--r--src/emu/x64runf0.c3
3 files changed, 14 insertions, 0 deletions
diff --git a/src/emu/x64run.c b/src/emu/x64run.c
index 032614da..a2343ca3 100755
--- a/src/emu/x64run.c
+++ b/src/emu/x64run.c
@@ -424,10 +424,14 @@ x64emurun:
                 GB = EB->byte[0];
                 EB->byte[0] = tmp8u;
             } else {
+                #ifdef USE_CAS
+                GB = native_lock_xchg_b(EB, GB);
+                #else
                 do {
                     tmp8u = native_lock_read_b(EB);
                 } while(native_lock_write_b(EB, GB));
                 GB = tmp8u;
+                #endif
             }
             // dynarec use need it's own mecanism
 #else
@@ -461,10 +465,14 @@ x64emurun:
                 if(rex.w) {
                     GD->q[0] = native_lock_xchg(ED, GD->q[0]);
                 } else {
+                    #ifdef USE_CAS
+                    GD->q[0] = native_lock_xchg(ED, GD->dword[0]);
+                    #else
                     do {
                         tmp32u = native_lock_read_d(ED);
                     } while(native_lock_write_d(ED, GD->dword[0]));
                     GD->q[0] = tmp32u;
+                    #endif
                 }
             }
 #else
diff --git a/src/emu/x64run66f0.c b/src/emu/x64run66f0.c
index 7bf48a47..7b76fe32 100644
--- a/src/emu/x64run66f0.c
+++ b/src/emu/x64run66f0.c
@@ -34,6 +34,9 @@ uintptr_t Run66F0(x64emu_t *emu, rex_t rex, uintptr_t addr)
     int64_t tmp64s;
     uint64_t tmp64u, tmp64u2;
     reg64_t *oped, *opgd;
+    #ifdef USE_CAS
+    uint64_t tmpcas;
+    #endif
 
     opcode = F8;
     // REX prefix before the F0 are ignored
diff --git a/src/emu/x64runf0.c b/src/emu/x64runf0.c
index 13eed9a2..06465fa1 100644
--- a/src/emu/x64runf0.c
+++ b/src/emu/x64runf0.c
@@ -36,6 +36,9 @@ uintptr_t RunF0(x64emu_t *emu, rex_t rex, uintptr_t addr)
     int64_t tmp64s;

     uint64_t tmp64u, tmp64u2;

     reg64_t *oped, *opgd;

+    #ifdef USE_CAS

+    uint64_t tmpcas;

+    #endif

 

     opcode = F8;

     // REX prefix before the F0 are ignored