[RV64_DYNAREC] Added F3 0F 1E NOP opcode (#570)

This commit is contained in:
Yang Liu 2023-03-16 14:32:58 +08:00 committed by GitHub
parent a3ad297f92
commit 50e463917c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 77 additions and 4 deletions

View File

@ -625,7 +625,7 @@ if(RV64_DYNAREC)
#"${BOX64_ROOT}/src/dynarec/rv64/dynarec_rv64_6664.c"
#"${BOX64_ROOT}/src/dynarec/rv64/dynarec_rv64_66f0.c"
#"${BOX64_ROOT}/src/dynarec/rv64/dynarec_rv64_f20f.c"
#"${BOX64_ROOT}/src/dynarec/rv64/dynarec_rv64_f30f.c"
"${BOX64_ROOT}/src/dynarec/rv64/dynarec_rv64_f30f.c"
)
endif()

View File

@ -52,6 +52,15 @@ uintptr_t dynarec64_00(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
MAYUSE(cacheupd);
switch(opcode) {
case 0x0F:
switch(rep) {
case 2:
addr = dynarec64_F30F(dyn, addr, ip, ninst, rex, ok, need_epilog);
break;
default:
DEFAULT;
}
break;
case 0x29:
INST_NAME("SUB Ed, Gd");
SETFLAGS(X_ALL, SF_SET_PENDING);
@ -341,7 +350,7 @@ uintptr_t dynarec64_00(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
#endif
}
break;
case 0xE8:
INST_NAME("CALL Id");
i32 = F32S;
@ -353,7 +362,7 @@ uintptr_t dynarec64_00(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
#if STEP < 2
if(isNativeCall(dyn, addr+i32, &dyn->insts[ninst].natcall, &dyn->insts[ninst].retn))
tmp = dyn->insts[ninst].pass2choice = 3;
else
else
tmp = dyn->insts[ninst].pass2choice = 0;
#else
tmp = dyn->insts[ninst].pass2choice;

View File

@ -0,0 +1,59 @@
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
#include <errno.h>
#include "debug.h"
#include "box64context.h"
#include "dynarec.h"
#include "emu/x64emu_private.h"
#include "emu/x64run_private.h"
#include "x64run.h"
#include "x64emu.h"
#include "box64stack.h"
#include "callback.h"
#include "emu/x64run_private.h"
#include "x64trace.h"
#include "dynarec_native.h"
#include "rv64_printer.h"
#include "dynarec_rv64_private.h"
#include "dynarec_rv64_functions.h"
#include "dynarec_rv64_helper.h"
uintptr_t dynarec64_F30F(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, rex_t rex, int* ok, int* need_epilog)
{
(void)ip; (void)need_epilog;
uint8_t opcode = F8;
uint8_t nextop, u8;
uint8_t gd, ed;
uint8_t wback;
uint64_t u64;
int v0, v1;
int q0, q1;
int d0, d1;
int64_t fixedaddress;
int unscaled;
int64_t j64;
MAYUSE(d0);
MAYUSE(d1);
MAYUSE(q0);
MAYUSE(q1);
MAYUSE(v0);
MAYUSE(v1);
MAYUSE(j64);
switch(opcode) {
case 0x1E:
INST_NAME("NOP / ENDBR32 / ENDBR64");
nextop = F8;
FAKEED;
break;
default:
DEFAULT;
}
return addr;
}

View File

@ -73,6 +73,11 @@
ed = x1; \
}
// FAKEED like GETED, but doesn't get anything
#define FAKEED if(!MODREG) { \
addr = fakeed(dyn, addr, ninst, nextop); \
}
// Write back ed in wback (if wback not 0)
#define WBACK if(wback) {SDxw(ed, wback, fixedaddress); SMWRITE();}
@ -655,7 +660,7 @@ uintptr_t dynarec64_00(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
//uintptr_t dynarec64_6664(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, rex_t rex, int seg, int* ok, int* need_epilog);
//uintptr_t dynarec64_66F0(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, rex_t rex, int rep, int* ok, int* need_epilog);
//uintptr_t dynarec64_F20F(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, rex_t rex, int* ok, int* need_epilog);
//uintptr_t dynarec64_F30F(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, rex_t rex, int* ok, int* need_epilog);
uintptr_t dynarec64_F30F(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ninst, rex_t rex, int* ok, int* need_epilog);
#if STEP < 2
#define PASS2(A)