about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-06-22 13:26:14 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-06-22 13:26:14 +0200
commit314b2a55839ec97cd16d95f3a46a6098c02d7112 (patch)
tree11baa563d2a9acc1b7ffcd4fe5ca95578fbd64a6 /src
parentce30c1179ecfef615472f55561decc1df2696b1d (diff)
downloadbox64-314b2a55839ec97cd16d95f3a46a6098c02d7112.tar.gz
box64-314b2a55839ec97cd16d95f3a46a6098c02d7112.zip
[COSIM] Imprroved F2 0F prefixed opcodes
Diffstat (limited to 'src')
-rw-r--r--src/emu/modrm.h1
-rw-r--r--src/emu/x64runf20f.c50
2 files changed, 26 insertions, 25 deletions
diff --git a/src/emu/modrm.h b/src/emu/modrm.h
index d4817833..2f2cd1fc 100644
--- a/src/emu/modrm.h
+++ b/src/emu/modrm.h
@@ -109,6 +109,7 @@
 #define _GETED(D)           oped=GetEd(emu, &addr, rex, nextop, D)

 #define _GETED32(D)         oped=GetEd32O(emu, &addr, rex, nextop, D, 0)

 #define _GETEB(D)           oped=GetEb(emu, &addr, rex, nextop, D)

+#define _GETEX(D)           opex=GetEx(emu, &addr, rex, nextop, D)

 

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

 

diff --git a/src/emu/x64runf20f.c b/src/emu/x64runf20f.c
index 020a896a..92292f3c 100644
--- a/src/emu/x64runf20f.c
+++ b/src/emu/x64runf20f.c
@@ -51,7 +51,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
 

     case 0x10:  /* MOVSD Gx, Ex */

         nextop = F8;

-        GETEX(0);

+        _GETEX(0);

         GETGX;

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

         if(!MODREG) {

@@ -61,25 +61,25 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
         break;

     case 0x11:  /* MOVSD Ex, Gx */

         nextop = F8;

-        GETEX(0);

+        GETEX8(0);

         GETGX;

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

         break;

     case 0x12:  /* MOVDDUP Gx, Ex */

         nextop = F8;

-        GETEX(0);

+        _GETEX(0);

         GETGX;

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

         break;

 

     case 0x1E:  /* NOP */

         nextop = F8;

-        GETED(0);

+        _GETED(0);

         break;

 

     case 0x2A:  /* CVTSI2SD Gx, Ed */

         nextop = F8;

-        GETED(0);

+        _GETED(0);

         GETGX;

         if(rex.w) {

             GX->d[0] = ED->sq[0];

@@ -90,7 +90,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
 

     case 0x2C:  /* CVTTSD2SI Gd, Ex */

         nextop = F8;

-        GETEX(0);

+        _GETEX(0);

         GETGD;

         if(rex.w)

             if(isnan(EX->d[0]) || isinf(EX->d[0]) || EX->d[0]>0x7fffffffffffffffLL)

@@ -107,7 +107,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
         break;

     case 0x2D:  /* CVTSD2SI Gd, Ex */

         nextop = F8;

-        GETEX(0);

+        _GETEX(0);

         GETGD;

         if(rex.w) {

             if(isnan(EX->d[0]) || isinf(EX->d[0]) || EX->d[0]>0x7fffffffffffffffLL)

@@ -163,7 +163,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
 

                 case 0xF0:  // CRC32 Gd, Eb

                     nextop = F8;

-                    GETEB(0);

+                    _GETEB(0);

                     GETGD;

                     GD->dword[0] ^=  EB->byte[0];

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

@@ -176,7 +176,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
                     break;

                 case 0xF1:  // CRC32 Gd, Ed

                     nextop = F8;

-                    GETED(0);

+                    _GETED(0);

                     GETGD;

                     for(int j=0; j<4*(rex.w+1); ++j) {

                         GD->dword[0] ^=  ED->byte[j];

@@ -197,7 +197,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
         

     case 0x51:  /* SQRTSD Gx, Ex */

         nextop = F8;

-        GETEX(0);

+        _GETEX(0);

         GETGX;

         if(EX->d[0]<0.0 )

             GX->d[0] = -NAN;

@@ -207,7 +207,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
 

     case 0x58:  /* ADDSD Gx, Ex */

         nextop = F8;

-        GETEX(0);

+        _GETEX(0);

         GETGX;

         #ifndef NOALIGN

         // add generate a -NAN only if doing inf + -inf

@@ -219,7 +219,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
         break;

     case 0x59:  /* MULSD Gx, Ex */

         nextop = F8;

-        GETEX(0);

+        _GETEX(0);

         GETGX;

         #ifndef NOALIGN

             // mul generate a -NAN only if doing (+/-)inf * (+/-)0

@@ -231,14 +231,14 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
         break;

     case 0x5A:  /* CVTSD2SS Gx, Ex */

         nextop = F8;

-        GETEX(0);

+        _GETEX(0);

         GETGX;

         GX->f[0] = EX->d[0];

         break;

 

     case 0x5C:  /* SUBSD Gx, Ex */

         nextop = F8;

-        GETEX(0);

+        _GETEX(0);

         GETGX;

         #ifndef NOALIGN

             // sub generate a -NAN only if doing inf - inf

@@ -250,7 +250,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
         break;

     case 0x5D:  /* MINSD Gx, Ex */

         nextop = F8;

-        GETEX(0);

+        _GETEX(0);

         GETGX;

         if (GX->d[0] == 0.0 && EX->d[0]  == 0.0)

             GX->d[0] = EX->d[0];

@@ -259,7 +259,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
         break;

     case 0x5E:  /* DIVSD Gx, Ex */

         nextop = F8;

-        GETEX(0);

+        _GETEX(0);

         GETGX;

         #ifndef NOALIGN

         is_nan = isnan(GX->d[0]) || isnan(EX->d[0]);

@@ -272,7 +272,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
         break;

     case 0x5F:  /* MAXSD Gx, Ex */

         nextop = F8;

-        GETEX(0);

+        _GETEX(0);

         GETGX;

         if (GX->d[0] == 0.0 && EX->d[0]  == 0.0)

             GX->d[0] = EX->d[0];

@@ -282,7 +282,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
 

     case 0x70:  /* PSHUFLW Gx, Ex, Ib */

         nextop = F8;

-        GETEX(1);

+        _GETEX(1);

         GETGX;

         tmp8u = F8;

         if(GX==EX) {

@@ -298,7 +298,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
 

     case 0x7C:  /* HADDPS Gx, Ex */

         nextop = F8;

-        GETEX(0);

+        _GETEX(0);

         GETGX;

         GX->f[0] += GX->f[1];

         GX->f[1] = GX->f[2] + GX->f[3];

@@ -312,7 +312,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
         break;

     case 0x7D:  /* HSUBPS Gx, Ex */

         nextop = F8;

-        GETEX(0);

+        _GETEX(0);

         GETGX;

         GX->f[0] -= GX->f[1];

         GX->f[1] = GX->f[2] - GX->f[3];

@@ -333,7 +333,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
         

     case 0xC2:  /* CMPSD Gx, Ex, Ib */

         nextop = F8;

-        GETEX(1);

+        _GETEX(1);

         GETGX;

         tmp8u = F8;

         tmp8s = 0;

@@ -352,7 +352,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
 

     case 0xD0:  /* ADDSUBPS Gx, Ex */

         nextop = F8;

-        GETEX(0);

+        _GETEX(0);

         GETGX;

         GX->f[0] -= EX->f[0];

         GX->f[1] += EX->f[1];

@@ -362,14 +362,14 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
 

     case 0xD6:  /* MOVDQ2Q Gm, Ex */

         nextop = F8;

-        GETEX(0);

+        _GETEX(0);

         GETGM;

         GM->q = EX->q[0];

         break;

 

     case 0xE6:  /* CVTPD2DQ Gx, Ex */

         nextop = F8;

-        GETEX(0);

+        _GETEX(0);

         GETGX;

         switch(emu->mxcsr.f.MXCSR_RC) {

             case ROUND_Nearest: {

@@ -409,7 +409,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step)
 

     case 0xF0:  /* LDDQU Gx, Ex */

         nextop = F8;

-        GETEX(0);

+        _GETEX(0);

         GETGX;

         memcpy(GX, EX, 16);

         break;