about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-03-09 19:51:47 +0100
committerptitSeb <sebastien.chev@gmail.com>2021-03-09 19:51:47 +0100
commit7309be63396fac5d46a3adf32944e7a9dec699e2 (patch)
tree054bcd07e7fc35fa2a209399e7c4e3edfde72425 /src
parent5edc83c556ee6b3fb4edfffaaf33bca97fd678a2 (diff)
downloadbox64-7309be63396fac5d46a3adf32944e7a9dec699e2.tar.gz
box64-7309be63396fac5d46a3adf32944e7a9dec699e2.zip
Added 66 64 8B opcode
Diffstat (limited to 'src')
-rw-r--r--src/emu/modrm.h1
-rw-r--r--src/emu/x64run66.c3
-rw-r--r--src/emu/x64run6664.c60
-rwxr-xr-xsrc/emu/x64run_private.h1
4 files changed, 65 insertions, 0 deletions
diff --git a/src/emu/modrm.h b/src/emu/modrm.h
index 2653a4de..f1c949a1 100644
--- a/src/emu/modrm.h
+++ b/src/emu/modrm.h
@@ -20,6 +20,7 @@
 #define GETEB_OFFS(D, O)    oped=GetEbO(emu, rex, nextop, D, O)

 #define GETGB               opgd=GetGb(emu, rex, nextop)

 #define GETEW(D)            oped=GetEw(emu, rex, nextop, D)

+#define GETEW_OFFS(D, O)    oped=GetEdO(emu, rex, nextop, D, O)

 #define GETGW               opgd=GetGw(emu, rex, nextop)

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

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

diff --git a/src/emu/x64run66.c b/src/emu/x64run66.c
index 2628386a..ab3d9a2a 100644
--- a/src/emu/x64run66.c
+++ b/src/emu/x64run66.c
@@ -100,6 +100,9 @@ int Run66(x64emu_t *emu, rex_t rex)
     case 0x0F:                              /* more opcdes */

         return Run660F(emu, rex);

 

+    case 0x64:                              /* FS: */

+        return Run6664(emu, rex);

+

     case 0x81:                              /* GRP3 Ew,Iw */

     case 0x83:                              /* GRP3 Ew,Ib */

         nextop = F8;

diff --git a/src/emu/x64run6664.c b/src/emu/x64run6664.c
new file mode 100644
index 00000000..f3001290
--- /dev/null
+++ b/src/emu/x64run6664.c
@@ -0,0 +1,60 @@
+#define _GNU_SOURCE

+#include <stdint.h>

+#include <stdio.h>

+#include <stdlib.h>

+#include <math.h>

+#include <string.h>

+#include <signal.h>

+#include <sys/types.h>

+#include <unistd.h>

+

+#include "debug.h"

+#include "box64stack.h"

+#include "x64emu.h"

+#include "x64run.h"

+#include "x64emu_private.h"

+#include "x64run_private.h"

+#include "x64primop.h"

+#include "x64trace.h"

+#include "x87emu_private.h"

+#include "box64context.h"

+#include "bridge.h"

+//#include "signals.h"

+#ifdef DYNAREC

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

+#endif

+

+#include "modrm.h"

+

+int Run6664(x64emu_t *emu, rex_t rex)

+{

+    uint8_t opcode;

+    uint8_t nextop;

+    reg64_t *oped, *opgd;

+    uintptr_t tlsdata = GetFSBaseEmu(emu);

+

+    opcode = F8;

+    // REX prefix before the F0 are ignored

+    rex.rex = 0;

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

+        rex.rex = opcode;

+        opcode = F8;

+    }

+

+    switch(opcode) {

+

+        case 0x8B:                      /* MOV Gd,Ed */

+            nextop = F8;

+            GETEW_OFFS(0, tlsdata);

+            GETGW;

+            if(rex.w)

+                GW->q[0] = EW->q[0];

+            else

+                GW->word[0] = EW->word[0];

+            break;

+

+       default:

+            return 1;

+    }

+    return 0;

+}
\ No newline at end of file
diff --git a/src/emu/x64run_private.h b/src/emu/x64run_private.h
index 024564a7..e33d7386 100755
--- a/src/emu/x64run_private.h
+++ b/src/emu/x64run_private.h
@@ -99,6 +99,7 @@ int Run0F(x64emu_t *emu, rex_t rex);
 int Run64(x64emu_t *emu, rex_t rex);
 int Run66(x64emu_t *emu, rex_t rex);
 int Run660F(x64emu_t *emu, rex_t rex);
+int Run6664(x64emu_t *emu, rex_t rex);
 //int Run67(x64emu_t *emu, rex_t rex);
 int RunD8(x64emu_t *emu, rex_t rex);
 int RunD9(x64emu_t *emu, rex_t rex);