about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-03-07 15:00:14 +0100
committerptitSeb <sebastien.chev@gmail.com>2021-03-07 15:00:14 +0100
commitd92dd2cac454c36ef81f1c8d3b007d88b48af622 (patch)
tree5e2d30bdb641141ae1ca51df9273d01927a3ae16 /src
parent230d2c960b054ccbb0e67bf8a7e7f6ff3c18f5aa (diff)
downloadbox64-d92dd2cac454c36ef81f1c8d3b007d88b48af622.tar.gz
box64-d92dd2cac454c36ef81f1c8d3b007d88b48af622.zip
Added a bunch of MMX and SSE opcodes
Diffstat (limited to 'src')
-rw-r--r--src/emu/modrm.h4
-rw-r--r--src/emu/x64run0f.c46
-rw-r--r--src/emu/x64run660f.c23
-rw-r--r--src/emu/x64runf30f.c8
4 files changed, 80 insertions, 1 deletions
diff --git a/src/emu/modrm.h b/src/emu/modrm.h
index 9152dd05..2653a4de 100644
--- a/src/emu/modrm.h
+++ b/src/emu/modrm.h
@@ -23,6 +23,8 @@
 #define GETGW               opgd=GetGw(emu, rex, nextop)

 #define GETEX(D)            opex=GetEx(emu, rex, nextop, D)

 #define GETGX               opgx=GetGx(emu, rex, nextop)

+#define GETEM(D)            opem=GetEm(emu, rex, nextop, D)

+#define GETGM               opgm=GetGm(emu, rex, nextop)

 #define ED  oped

 #define GD  opgd

 #define EB  oped

@@ -31,6 +33,8 @@
 #define GW  opgd

 #define EX  opex

 #define GX  opgx

+#define EM  opem

+#define GM  opgm

 

 #define MODREG  ((nextop&0xC0)==0xC0)

 

diff --git a/src/emu/x64run0f.c b/src/emu/x64run0f.c
index 2d62fc37..03ead2da 100644
--- a/src/emu/x64run0f.c
+++ b/src/emu/x64run0f.c
@@ -20,7 +20,7 @@
 #include "box64context.h"

 #include "my_cpuid.h"

 #include "bridge.h"

-//#include "signals.h"

+#include "signals.h"

 #ifdef DYNAREC

 #include "../dynarec/arm_lock_helper.h"

 #endif

@@ -35,6 +35,7 @@ int Run0F(x64emu_t *emu, rex_t rex)
     uint32_t tmp32u;

     reg64_t *oped, *opgd;

     sse_regs_t *opex, *opgx;

+    mmx87_regs_t *opem, *opgm;

 

     opcode = F8;

 

@@ -74,6 +75,34 @@ int Run0F(x64emu_t *emu, rex_t rex)
             ,

         )                               /* 0x40 -> 0x4F CMOVxx Gd,Ed */ // conditional move, no sign

         

+        case 0x6F:                      /* MOVQ Gm, Em */

+            nextop = F8;

+            GETEM(0);

+            GETGM;

+            GM->q = EM->q;

+            break;

+

+        case 0x77:                      /* EMMS */

+            // empty MMX, FPU now usable

+            emu->top = 0;

+            emu->fpu_stack = 0;

+            break;

+

+        case 0x7E:                       /* MOVD Ed, Gm */

+            nextop = F8;

+            GETED(0);

+            GETGM;

+            if(rex.w)

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

+            else

+                ED->q[0] = GM->ud[0];

+            break;

+        case 0x7F:                      /* MOVQ Em, Gm */

+            nextop = F8;

+            GETEM(0);

+            GETGM;

+            EM->q = GM->q;

+            break;

         GOCOND(0x80

             , tmp32s = F32S; CHECK_FLAGS(emu);

             , R_RIP += tmp32s;

@@ -154,6 +183,21 @@ int Run0F(x64emu_t *emu, rex_t rex)
             }

             break;

 

+        case 0xD3:                   /* PSRLQ Gm,Em */

+            nextop = F8;

+            GETEM(0);

+            GETGM;

+            GM->q = (EM->q > 63) ? 0L : (GM->q >> EM->q);

+            break;

+

+        case 0xFC:                   /* PADDB Gm, Em */

+            nextop = F8;

+            GETEM(0);

+            GETGM;

+            for(int i=0; i<8; ++i)

+                GM->sb[i] += EM->sb[i];

+            break;

+

         default:

             return 1;

     }

diff --git a/src/emu/x64run660f.c b/src/emu/x64run660f.c
index 862fcdd9..8af22159 100644
--- a/src/emu/x64run660f.c
+++ b/src/emu/x64run660f.c
@@ -51,6 +51,29 @@ int Run660F(x64emu_t *emu, rex_t rex)
         GX->q[1] = EX->q[1];

         break;

 

+    case 0x7E:                      /* MOVD Ed, Gx */

+        nextop = F8;

+        GETED(0);

+        GETGX;

+        if(rex.w)

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

+        else {

+            if(MODREG)

+                ED->q[0] = GX->ud[0];

+            else

+                ED->dword[0] = GX->ud[0];

+        }

+        break;

+

+    case 0xD6:                      /* MOVQ Ex,Gx */

+        nextop = F8;

+        GETEX(0);

+        GETGX;

+        EX->q[0] = GX->q[0];

+        if(MODREG)

+            EX->q[1] = 0;

+        break;

+

     case 0xEF:                      /* PXOR Gx,Ex */

         nextop = F8;

         GETEX(0);

diff --git a/src/emu/x64runf30f.c b/src/emu/x64runf30f.c
index 0369ad3d..49176b20 100644
--- a/src/emu/x64runf30f.c
+++ b/src/emu/x64runf30f.c
@@ -86,6 +86,14 @@ int RunF30F(x64emu_t *emu, rex_t rex)
         memcpy(GX, EX, 16);    // unaligned...

         break;

 

+    case 0x7E:  /* MOVQ Gx, Ex */

+        nextop = F8;

+        GETEX(0);

+        GETGX;

+        GX->q[0] = EX->q[0];

+        GX->q[1] = 0;

+        break;

+

     default:

         return 1;

     }