about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-01-27 14:31:51 +0100
committerptitSeb <sebastien.chev@gmail.com>2024-01-27 14:31:51 +0100
commit65c4f9d9c3d149ca475a80f688fef7a1cc864395 (patch)
tree918ce36af97799ba80f8192012c7228cc57758e8 /src
parent8043f53d7d15544e587760c51e07ffe95752c49f (diff)
downloadbox64-65c4f9d9c3d149ca475a80f688fef7a1cc864395.tar.gz
box64-65c4f9d9c3d149ca475a80f688fef7a1cc864395.zip
[INTERPRETER] Add code for unaligned 32bits F0 87 opcode
Diffstat (limited to 'src')
-rw-r--r--src/emu/x64runf0.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/emu/x64runf0.c b/src/emu/x64runf0.c
index 10747155..29ca7a71 100644
--- a/src/emu/x64runf0.c
+++ b/src/emu/x64runf0.c
@@ -975,7 +975,18 @@ uintptr_t RunF0(x64emu_t *emu, rex_t rex, uintptr_t addr)
                         GD->q[0] = native_lock_xchg_dd(ED, GD->q[0]);

                     }

                 } else {

-                    GD->dword[0] = native_lock_xchg_d(ED, GD->dword[0]);

+                    if((uintptr_t)ED&3) {

+                        // unaligned

+                        do {

+                            tmp32u = ED->dword[0] & 0xffffff00;

+                            tmp32u |= native_lock_read_b(ED);

+                            

+                        } while(native_lock_write_b(ED, GD->byte[0]));

+                        ED->dword[0] = GD->dword[0];

+                        GD->dword[0] = tmp32u;

+                    } else {

+                        GD->dword[0] = native_lock_xchg_d(ED, GD->dword[0]);

+                    }

                 }

             }

 #else