about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-11-08 22:58:59 +0100
committerptitSeb <sebastien.chev@gmail.com>2023-11-08 22:58:59 +0100
commit675336dee509154fdb14497eed1e5423fa25d407 (patch)
tree6c935e45b6ab20b535f176935856675e9a16fde1 /src
parent3cd4ed8e63b2039bf105bf63fcae8763b2aa6803 (diff)
downloadbox64-675336dee509154fdb14497eed1e5423fa25d407.tar.gz
box64-675336dee509154fdb14497eed1e5423fa25d407.zip
Use non-atomic operation on XCHG when unaligned
Diffstat (limited to 'src')
-rw-r--r--src/emu/x64run.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/emu/x64run.c b/src/emu/x64run.c
index 16a3a3b3..2296611e 100644
--- a/src/emu/x64run.c
+++ b/src/emu/x64run.c
@@ -721,7 +721,13 @@ x64emurun:
                 }
             } else {
                 if(rex.w) {
-                    GD->q[0] = native_lock_xchg_dd(ED, GD->q[0]);
+                    if((uintptr_t)ED&7) {
+                        // not aligned, dont't try to "LOCK"
+                        tmp64u = ED->q[0];
+                        ED->q[0] = GD->q[0];
+                        GD->q[0] = tmp64u;
+                    } else
+                        GD->q[0] = native_lock_xchg_dd(ED, GD->q[0]);
                 } else {
                     if((uintptr_t)ED&3) {
                         // not aligned, dont't try to "LOCK"