about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-04-09 11:36:56 +0200
committerptitSeb <sebastien.chev@gmail.com>2021-04-09 11:36:56 +0200
commit8c63b7634391ad7d81926a832fc6be65b0a3df88 (patch)
tree54dbe929ccc52012ae056f784127c227a99f4d13 /src
parentba7a04851f7d573c3666647d3a7c9828d2818385 (diff)
downloadbox64-8c63b7634391ad7d81926a832fc6be65b0a3df88.tar.gz
box64-8c63b7634391ad7d81926a832fc6be65b0a3df88.zip
Added unligned case for lock inc dword ptr[xx]
Diffstat (limited to 'src')
-rw-r--r--src/emu/x64runf0.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/emu/x64runf0.c b/src/emu/x64runf0.c
index 01394618..cdf75eac 100644
--- a/src/emu/x64runf0.c
+++ b/src/emu/x64runf0.c
@@ -583,9 +583,20 @@ int RunF0(x64emu_t *emu, rex_t rex)
                             tmp64u = arm64_lock_read_dd(ED);

                         } while(arm64_lock_write_dd(ED, inc64(emu, tmp64u)));

                     else {

-                        do {

-                            tmp32u = arm64_lock_read_d(ED);

-                        } while(arm64_lock_write_d(ED, inc32(emu, tmp32u)));

+                        if((uintptr_t)ED&3) { 

+                            //meh.

+                            do {

+                                tmp32u = ED->dword[0];

+                                tmp32u &=~0xff;

+                                tmp32u |= arm64_lock_read_b(ED);

+                                tmp32u = inc32(emu, tmp32u);

+                        } while(arm64_lock_write_b(ED, tmp32u&0xff));

+                            ED->dword[0] = tmp32u;

+                        } else {

+                            do {

+                                tmp32u = arm64_lock_read_d(ED);

+                            } while(arm64_lock_write_d(ED, inc32(emu, tmp32u)));

+                        }

                         if(MODREG) ED->dword[1] = 0;

                     }

 #else