about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-02-17 15:14:26 +0100
committerptitSeb <sebastien.chev@gmail.com>2024-02-17 15:14:26 +0100
commit47b8e2a98330c7381f973007436ba7faa8de27ec (patch)
treed3823b08b60df6c64dec2775a59fd1eb2612c5f8
parentcc010182232e1fe5c4f9ebf8fe5042e72a6fdf55 (diff)
downloadbox64-47b8e2a98330c7381f973007436ba7faa8de27ec.tar.gz
box64-47b8e2a98330c7381f973007436ba7faa8de27ec.zip
[INTERPRETER] Added a few unaligned path for some F0 math opcodes
-rw-r--r--src/emu/x64runf0.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/emu/x64runf0.c b/src/emu/x64runf0.c
index 77691a67..20552e2e 100644
--- a/src/emu/x64runf0.c
+++ b/src/emu/x64runf0.c
@@ -75,6 +75,25 @@ uintptr_t RunF0(x64emu_t *emu, rex_t rex, uintptr_t addr)
             nextop = F8;                                            \

             GETED(0);                                               \

             GETGD;                                                  \

+            if(((uintptr_t)ED)&(3<<rex.w)) {                        \

+                if(rex.w) {                                             \

+                    do {                                                \

+                        tmp8u = native_lock_read_b(ED);                 \

+                        tmp64u = ED->q[0];                              \

+                        tmp64u = OP##64(emu, tmp64u, GD->q[0]);         \

+                    } while (native_lock_write_b(ED, tmp8u));           \

+                    ED->q[0] = tmp64u;                                  \

+                } else {                                                \

+                    do {                                                \

+                        tmp8u = native_lock_read_b(ED);                 \

+                        tmp32u = ED->dword[0];                          \

+                        tmp32u = OP##32(emu, tmp32u, GD->dword[0]);     \

+                    } while (native_lock_write_b(ED, tmp8u));           \

+                    ED->dword[0] = tmp32u;                              \

+                    if(MODREG)                                          \

+                        ED->dword[1] = 0;                               \

+                }                                                       \

+            } else {                                                \

             if(rex.w) {                                             \

                 do {                                                \

                     tmp64u = native_lock_read_dd(ED);               \

@@ -88,6 +107,7 @@ uintptr_t RunF0(x64emu_t *emu, rex_t rex, uintptr_t addr)
                 if(MODREG)                                          \

                     ED->dword[1] = 0;                               \

             }                                                       \

+            }                                                       \

             break;                                                  \

         case B+2:                                                   \

             nextop = F8;                                            \

@@ -119,15 +139,15 @@ uintptr_t RunF0(x64emu_t *emu, rex_t rex, uintptr_t addr)
             nextop = F8;                                            \

             GETEB(0);                                               \

             GETGB;                                                  \

-            pthread_mutex_lock(&my_context->mutex_lock);          \

+            pthread_mutex_lock(&my_context->mutex_lock);            \

             EB->byte[0] = OP##8(emu, EB->byte[0], GB);              \

-            pthread_mutex_unlock(&my_context->mutex_lock);        \

+            pthread_mutex_unlock(&my_context->mutex_lock);          \

             break;                                                  \

         case B+1:                                                   \

             nextop = F8;                                            \

             GETED(0);                                               \

             GETGD;                                                  \

-            pthread_mutex_lock(&my_context->mutex_lock);          \

+            pthread_mutex_lock(&my_context->mutex_lock);            \

             if(rex.w)                                               \

                 ED->q[0] = OP##64(emu, ED->q[0], GD->q[0]);         \

             else                                                    \