mirror of
https://github.com/ptitSeb/box64.git
synced 2024-11-30 13:26:03 +08:00
More fixes to GetEb/GteGb and other macro, plus adding 66 C7 MOV opcode
This commit is contained in:
parent
e0af8de642
commit
2009b01425
@ -110,6 +110,7 @@ set(ELFLOADER_SRC
|
||||
"${BOX64_ROOT}/src/emu/x64primop.c"
|
||||
"${BOX64_ROOT}/src/emu/x64run.c"
|
||||
"${BOX64_ROOT}/src/emu/x64run0f.c"
|
||||
"${BOX64_ROOT}/src/emu/x64run66.c"
|
||||
"${BOX64_ROOT}/src/emu/x64run_private.c"
|
||||
"${BOX64_ROOT}/src/emu/x64syscall.c"
|
||||
"${BOX64_ROOT}/src/emu/x64tls.c"
|
||||
|
@ -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: \
|
||||
|
@ -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;
|
||||
|
50
src/emu/x64run66.c
Normal file
50
src/emu/x64run66.c
Normal file
@ -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;
|
||||
}
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user