about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-03-08 15:23:09 +0100
committerptitSeb <sebastien.chev@gmail.com>2021-03-08 15:23:09 +0100
commit749961af32d25df77d2c63bb1e20c9a3aeb1d527 (patch)
tree4b2dfc34d48a3ae7f0f6b36ce57fd6bbb338c41d /src
parenteda8b442e09877ccd3884a813d30b57ed161f5a6 (diff)
downloadbox64-749961af32d25df77d2c63bb1e20c9a3aeb1d527.tar.gz
box64-749961af32d25df77d2c63bb1e20c9a3aeb1d527.zip
Added a gew more various opcodes
Diffstat (limited to 'src')
-rwxr-xr-xsrc/emu/x64run.c18
-rw-r--r--src/emu/x64run0f.c71
-rw-r--r--src/emu/x64run64.c10
-rw-r--r--src/emu/x64run66.c18
4 files changed, 117 insertions, 0 deletions
diff --git a/src/emu/x64run.c b/src/emu/x64run.c
index 9c465d54..a01fdb92 100755
--- a/src/emu/x64run.c
+++ b/src/emu/x64run.c
@@ -480,6 +480,24 @@ x64emurun:
                 R_RCX = tmp64u;
             break;
 
+        case 0xB0:                      /* MOV AL,Ib */
+        case 0xB1:                      /* MOV CL,Ib */
+        case 0xB2:                      /* MOV DL,Ib */
+        case 0xB3:                      /* MOV BL,Ib */
+            if(rex.rex)
+                emu->regs[(opcode&7)+(rex.b<<3)].byte[0] = F8;
+            else
+                emu->regs[opcode&3].byte[0] = F8;
+            break;
+        case 0xB4:                      /* MOV AH,Ib */
+        case 0xB5:                      /*    ...    */
+        case 0xB6:
+        case 0xB7:
+            if(rex.rex)
+                emu->regs[(opcode&7)+(rex.b<<3)].byte[0] = F8;
+            else
+                emu->regs[opcode&3].byte[1] = F8;
+            break;
         case 0xB8:                      /* MOV EAX,Id */
         case 0xB9:                      /* MOV ECX,Id */
         case 0xBA:                      /* MOV EDX,Id */
diff --git a/src/emu/x64run0f.c b/src/emu/x64run0f.c
index a6404967..f8c6d359 100644
--- a/src/emu/x64run0f.c
+++ b/src/emu/x64run0f.c
@@ -58,6 +58,13 @@ int Run0F(x64emu_t *emu, rex_t rex)
             GETED(0);

             break;

 

+        case 0x28:                      /* MOVAPS Gx,Ex */

+            nextop = F8;

+            GETEX(0);

+            GETGX;

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

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

+            break;

         case 0x29:                      /* MOVAPS Ex,Gx */

             nextop = F8;

             GETEX(0);

@@ -95,6 +102,70 @@ int Run0F(x64emu_t *emu, rex_t rex)
             ,

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

         

+        case 0x51:                      /* SQRTPS Gx, Ex */

+            nextop = F8;

+            GETEX(0);

+            GETGX;

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

+                GX->f[i] = sqrtf(EX->f[i]);

+            break;

+        case 0x52:                      /* RSQRTPS Gx, Ex */

+            nextop = F8;

+            GETEX(0);

+            GETGX;

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

+                GX->f[i] = 1.0f/sqrtf(EX->f[i]);

+            break;

+        case 0x53:                      /* RCPPS Gx, Ex */

+            nextop = F8;

+            GETEX(0);

+            GETGX;

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

+                GX->f[i] = 1.0f/EX->f[i];

+            break;

+        case 0x54:                      /* ANDPS Gx, Ex */

+            nextop = F8;

+            GETEX(0);

+            GETGX;

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

+                GX->ud[i] &= EX->ud[i];

+            break;

+        case 0x55:                      /* ANDNPS Gx, Ex */

+            nextop = F8;

+            GETEX(0);

+            GETGX;

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

+                GX->ud[i] = (~GX->ud[i]) & EX->ud[i];

+            break;

+        case 0x56:                      /* ORPS Gx, Ex */

+            nextop = F8;

+            GETEX(0);

+            GETGX;

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

+                GX->ud[i] |= EX->ud[i];

+            break;

+        case 0x57:                      /* XORPS Gx, Ex */

+            nextop = F8;

+            GETEX(0);

+            GETGX;

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

+                GX->ud[i] ^= EX->ud[i];

+            break;

+        case 0x58:                      /* ADDPS Gx, Ex */

+            nextop = F8;

+            GETEX(0);

+            GETGX;

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

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

+            break;

+        case 0x59:                      /* MULPS Gx, Ex */

+            nextop = F8;

+            GETEX(0);

+            GETGX;

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

+                GX->f[i] *= EX->f[i];

+            break;

+

         case 0x60:                      /* PUNPCKLBW Gm, Em */

             nextop = F8;

             GETEM(0);

diff --git a/src/emu/x64run64.c b/src/emu/x64run64.c
index 92db3f52..b0e70a0c 100644
--- a/src/emu/x64run64.c
+++ b/src/emu/x64run64.c
@@ -46,6 +46,16 @@ int Run64(x64emu_t *emu, rex_t rex)
 

     switch(opcode) {

 

+        case 0x33:              /* XOR Gd,Ed */

+            nextop = F8;

+            GETED_OFFS(0, tlsdata);

+            GETGD;

+            if(rex.w)

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

+            else

+                GD->q[0] = xor32(emu, GD->dword[0], ED->dword[0]);

+            break;

+

         case 0x88:                      /* MOV Eb,Gb */

             nextop = F8;

             GETEB_OFFS(0, tlsdata);

diff --git a/src/emu/x64run66.c b/src/emu/x64run66.c
index 9f70aee6..c112fd97 100644
--- a/src/emu/x64run66.c
+++ b/src/emu/x64run66.c
@@ -36,6 +36,10 @@ int Run66(x64emu_t *emu, rex_t rex)
     reg64_t *oped, *opgd;

 

     opcode = F8;

+

+    while(opcode == 0x2E)   // ignoring CS:

+        opcode = F8;

+

     // REX prefix before the F0 are ignored

     rex.rex = 0;

     while(opcode>=0x40 && opcode<=0x4f) {

@@ -81,6 +85,20 @@ int Run66(x64emu_t *emu, rex_t rex)
     case 0x90:                              /* NOP */

         break;

 

+    case 0xB8:                              /* MOV AX,Iw */

+    case 0xB9:                              /* MOV CX,Iw */

+    case 0xBA:                              /* MOV DX,Iw */

+    case 0xBB:                              /* MOV BX,Iw */

+    case 0xBC:                              /*    ...     */

+    case 0xBD:

+    case 0xBE:

+    case 0xBF:

+        if(rex.w)

+            emu->regs[(opcode&7)+(rex.b<<3)].q[0] = F64;

+        else

+            emu->regs[(opcode&7)+(rex.b<<3)].word[0] = F16;

+        break;

+

     case 0xC1:                              /* GRP2 Ew,Ib */

         nextop = F8;

         GETEW(1);