Added 67 E0..E3 opcodes

This commit is contained in:
ptitSeb 2021-03-11 17:47:14 +01:00
parent 5a244911cc
commit f08b88cce5
4 changed files with 86 additions and 2 deletions

View File

@ -114,6 +114,7 @@ set(ELFLOADER_SRC
"${BOX64_ROOT}/src/emu/x64run66.c"
"${BOX64_ROOT}/src/emu/x64run660f.c"
"${BOX64_ROOT}/src/emu/x64run6664.c"
"${BOX64_ROOT}/src/emu/x64run67.c"
"${BOX64_ROOT}/src/emu/x64rund8.c"
"${BOX64_ROOT}/src/emu/x64rund9.c"
"${BOX64_ROOT}/src/emu/x64rundb.c"

View File

@ -254,7 +254,14 @@ x64emurun:
if(emu->quit)
goto fini;
break;
case 0x67: /* reduce EASize prefix */
if(Run67(emu, rex)) {
unimp = 1;
goto fini;
}
if(emu->quit)
goto fini;
break;
case 0x68: /* Push Id */
Push(emu, F32S64);
break;

76
src/emu/x64run67.c Normal file
View File

@ -0,0 +1,76 @@
#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 Run67(x64emu_t *emu, rex_t rex)
{
uint8_t opcode;
uint8_t nextop;
int8_t tmp8s;
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 0xE0: /* LOOPNZ */
CHECK_FLAGS(emu);
tmp8s = F8S;
--R_ECX; // don't update flags
if(R_ECX && !ACCESS_FLAG(F_ZF))
R_RIP += tmp8s;
break;
case 0xE1: /* LOOPZ */
CHECK_FLAGS(emu);
tmp8s = F8S;
--R_ECX; // don't update flags
if(R_ECX && ACCESS_FLAG(F_ZF))
R_RIP += tmp8s;
break;
case 0xE2: /* LOOP */
tmp8s = F8S;
--R_ECX; // don't update flags
if(R_ECX)
R_RIP += tmp8s;
break;
case 0xE3: /* JECXZ Ib */
tmp8s = F8S;
if(!R_ECX)
R_RIP += tmp8s;
break;
default:
return 1;
}
return 0;
}

View File

@ -100,7 +100,7 @@ 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 Run67(x64emu_t *emu, rex_t rex);
int RunD8(x64emu_t *emu, rex_t rex);
int RunD9(x64emu_t *emu, rex_t rex);
int RunDB(x64emu_t *emu, rex_t rex);