about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-03-06 11:36:40 +0100
committerptitSeb <sebastien.chev@gmail.com>2021-03-06 11:36:40 +0100
commit2bcdbb125adafb0c46df295bb73f6b182004aa87 (patch)
tree9d1286acb645b4cd113e0f4e4d3b56a8c800cb31 /src
parentaba24babeafbfa8d834cc0ac214865bb214540fd (diff)
downloadbox64-2bcdbb125adafb0c46df295bb73f6b182004aa87.tar.gz
box64-2bcdbb125adafb0c46df295bb73f6b182004aa87.zip
Added F0 REX 0F C1 XADD opcode
Diffstat (limited to 'src')
-rw-r--r--src/emu/x64runf0.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/emu/x64runf0.c b/src/emu/x64runf0.c
index 6969c062..cb44bf19 100644
--- a/src/emu/x64runf0.c
+++ b/src/emu/x64runf0.c
@@ -31,8 +31,8 @@ int RunF0(x64emu_t *emu, rex_t rex)
 {

     uint8_t opcode;

     uint8_t nextop;

-    int32_t tmp32s;

     uint32_t tmp32u;

+    uint64_t tmp64u;

     reg64_t *oped, *opgd;

 

     opcode = F8;

@@ -100,7 +100,41 @@ int RunF0(x64emu_t *emu, rex_t rex)
                     pthread_mutex_unlock(&emu->context->mutex_lock);

 #endif

                     break;

-                    

+

+                case 0xC1:                      /* XADD Gd,Ed */

+                    nextop = F8;

+                    GETED;

+                    GETGD;

+#ifdef DYNAREC

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

+                        do {

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

+                            tmp32u |= arm_lock_read_b(ED);

+                            tmp32u2 = add32(emu, tmp32u, GD.dword[0]);

+                        } while(arm_lock_write_b(ED, tmp32u2&0xff));

+                        ED->dword[0] = tmp32u2;

+                    } else {

+                        do {

+                            tmp32u = arm_lock_read_d(ED);

+                            tmp32u2 = add32(emu, tmp32u, GD.dword[0]);

+                        } while(arm_lock_write_d(ED, tmp32u2));

+                    }

+                    GD.dword[0] = tmp32u;

+#else

+                    pthread_mutex_lock(&emu->context->mutex_lock);

+                    if(rex.w) {

+                        tmp64u = add64(emu, ED->q[0], GD->q[0]);

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

+                        ED->q[0] = tmp64u;

+                    } else {

+                        tmp32u = add32(emu, ED->dword[0], GD->dword[0]);

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

+                        ED->dword[0] = tmp32u;

+                    }

+                    pthread_mutex_unlock(&emu->context->mutex_lock);

+#endif

+                    break;

+

             default:

                 return 1;

             }