diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-03-05 14:10:06 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-03-05 14:10:06 +0100 |
| commit | 2009b014259d82d24fdacf30dd5be5ba2ed0c370 (patch) | |
| tree | f000876d9f4139c186580a694c3d3808c272af39 /src | |
| parent | e0af8de6421a891ff1e7ed7c049abbc1074b48c9 (diff) | |
| download | box64-2009b014259d82d24fdacf30dd5be5ba2ed0c370.tar.gz box64-2009b014259d82d24fdacf30dd5be5ba2ed0c370.zip | |
More fixes to GetEb/GteGb and other macro, plus adding 66 C7 MOV opcode
Diffstat (limited to 'src')
| -rw-r--r-- | src/emu/modrm.h | 8 | ||||
| -rwxr-xr-x | src/emu/x64run.c | 9 | ||||
| -rw-r--r-- | src/emu/x64run66.c | 50 | ||||
| -rwxr-xr-x | src/emu/x64run_private.h | 7 |
4 files changed, 69 insertions, 5 deletions
diff --git a/src/emu/modrm.h b/src/emu/modrm.h index 7d1c5c76..b2c0580e 100644 --- a/src/emu/modrm.h +++ b/src/emu/modrm.h @@ -16,11 +16,15 @@ #define GETED oped=GetEd(emu, rex, nextop) #define GETGD opgd=GetGd(emu, rex, nextop) #define GETEB oped=GetEb(emu, rex, nextop) -#define GETGB oped=GetGb(emu, rex, nextop) +#define GETGB opgd=GetGb(emu, rex, nextop) +#define GETEW oped=GetEw(emu, rex, nextop) +#define GETGW opgd=GetGw(emu, rex, nextop) #define ED oped #define GD opgd #define EB oped -#define GB oped->byte[0] +#define GB opgd->byte[0] +#define EW oped +#define GW opgd #define GOCOND(BASE, PREFIX, CONDITIONAL) \ case BASE+0x0: \ diff --git a/src/emu/x64run.c b/src/emu/x64run.c index 6889f353..18e8027d 100755 --- a/src/emu/x64run.c +++ b/src/emu/x64run.c @@ -231,6 +231,15 @@ x64emurun: GD->sdword[0] = ED->sdword[0]; // meh? break; + case 0x66: /* 16bits prefix */ + if(Run66(emu, rex)) { + unimp = 1; + goto fini; + } + if(emu->quit) + goto fini; + break; + case 0x68: /* Push Id */ Push(emu, F32S64); break; diff --git a/src/emu/x64run66.c b/src/emu/x64run66.c new file mode 100644 index 00000000..9e41b931 --- /dev/null +++ b/src/emu/x64run66.c @@ -0,0 +1,50 @@ +#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 Run66(x64emu_t *emu, rex_t rex) +{ + uint8_t opcode; + uint8_t nextop; + int32_t tmp32s; + reg64_t *oped, *opgd; + + opcode = F8; + + switch(opcode) { + + case 0xC7: /* MOV Ew,Iw */ + nextop = F8; + GETEW; + EW->word[0] = F16; + 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 e797c71f..2ba10b47 100755 --- a/src/emu/x64run_private.h +++ b/src/emu/x64run_private.h @@ -85,7 +85,7 @@ static inline reg64_t* GetECommon(x64emu_t* emu, rex_t rex, uint8_t m) int32_t base = Fetch32s(emu); return (reg64_t*)(base+R_RIP); } - return (reg64_t*)(emu->regs[m].q[0]+(rex.b<<3)); + return (reg64_t*)(emu->regs[m+(rex.b<<3)].q[0]); } else { uintptr_t base; if((m&7)==4) { @@ -204,9 +204,9 @@ static inline reg64_t* GetGb(x64emu_t *emu, rex_t rex, uint8_t v) { uint8_t m = (v&0x38)>>3; if(rex.rex) { - return (reg64_t*)&emu->regs[m&3].byte[m>>2]; - } else return &emu->regs[(m&7)+(rex.r<<3)]; + } else + return (reg64_t*)&emu->regs[m&3].byte[m>>2]; } static inline mmx_regs_t* GetGm(x64emu_t *emu, rex_t rex, uint8_t v) @@ -228,6 +228,7 @@ void UpdateFlags(x64emu_t *emu); //void Run67(x64emu_t *emu); int Run0F(x64emu_t *emu, rex_t rex); +int Run66(x64emu_t *emu, rex_t rex); //void Run660F(x64emu_t *emu); //void Run66D9(x64emu_t *emu); // x87 //void Run6766(x64emu_t *emu); |