about summary refs log tree commit diff stats
path: root/src/emu/x64runf0.c
diff options
context:
space:
mode:
authorptitSeb <seebastien.chev@gmail.com>2023-10-22 11:35:24 +0200
committerptitSeb <seebastien.chev@gmail.com>2023-10-22 11:35:24 +0200
commit59b51cccfc19ced50c19c7e6bf578cb3dd9fd3f5 (patch)
treedfbfbe3f966d29198d9765c9d56c042e47f0cb33 /src/emu/x64runf0.c
parenta83091bc3b9e84a9471aeadfef40b501b0399988 (diff)
downloadbox64-59b51cccfc19ced50c19c7e6bf578cb3dd9fd3f5.tar.gz
box64-59b51cccfc19ced50c19c7e6bf578cb3dd9fd3f5.zip
[ARM64] More unaligned improvments
Diffstat (limited to 'src/emu/x64runf0.c')
-rw-r--r--src/emu/x64runf0.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/emu/x64runf0.c b/src/emu/x64runf0.c
index e0225f57..9e6426f4 100644
--- a/src/emu/x64runf0.c
+++ b/src/emu/x64runf0.c
@@ -330,16 +330,31 @@ uintptr_t RunF0(x64emu_t *emu, rex_t rex, uintptr_t addr)
                                 }

                             } while(tmp32s);

                     else {

-                        do {

-                            tmp32u = native_lock_read_d(ED);

-                            cmp32(emu, R_EAX, tmp32u);

-                            if(ACCESS_FLAG(F_ZF)) {

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

-                            } else {

-                                R_EAX = tmp32u;

-                                tmp32s = 0;

-                            }

-                        } while(tmp32s);

+                        if(((uintptr_t)ED)&3) {

+                            do {

+                                tmp32u = ED->q[0] & ~0xffLL;

+                                tmp32u |= native_lock_read_b(ED);

+                                cmp64(emu, R_RAX, tmp32u);

+                                if(ACCESS_FLAG(F_ZF)) {

+                                    tmp32s = native_lock_write_b(ED, GD->dword[0]&0xff);

+                                    if(!tmp32s)

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

+                                } else {

+                                    R_EAX = tmp32u;

+                                    tmp32s = 0;

+                                }

+                            } while(tmp32s);

+                        } else

+                            do {

+                                tmp32u = native_lock_read_d(ED);

+                                cmp32(emu, R_EAX, tmp32u);

+                                if(ACCESS_FLAG(F_ZF)) {

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

+                                } else {

+                                    R_EAX = tmp32u;

+                                    tmp32s = 0;

+                                }

+                            } while(tmp32s);

                         emu->regs[_AX].dword[1] = 0;

                         if(MODREG)

                             ED->dword[1] = 0;