callbacks: Add user_arg argument to InterpreterFallback

This commit is contained in:
MerryMage 2016-09-01 01:58:19 +01:00
parent 3b5c43b427
commit 4321e829d1
5 changed files with 9 additions and 7 deletions

View file

@ -29,7 +29,8 @@ struct UserCallbacks {
bool (*IsReadOnlyMemory)(std::uint32_t vaddr); bool (*IsReadOnlyMemory)(std::uint32_t vaddr);
/// The intrepreter must execute only one instruction at PC. /// The intrepreter must execute only one instruction at PC.
void (*InterpreterFallback)(std::uint32_t pc, Jit* jit); void (*InterpreterFallback)(std::uint32_t pc, Jit* jit, void* user_arg);
void* user_arg = nullptr;
bool (*CallSVC)(std::uint32_t swi); bool (*CallSVC)(std::uint32_t swi);

View file

@ -2188,6 +2188,7 @@ void EmitX64::EmitTerminalInterpret(IR::Term::Interpret terminal, Arm::LocationD
code->mov(code->ABI_PARAM1.cvt32(), terminal.next.PC()); code->mov(code->ABI_PARAM1.cvt32(), terminal.next.PC());
code->mov(code->ABI_PARAM2, reinterpret_cast<u64>(jit_interface)); code->mov(code->ABI_PARAM2, reinterpret_cast<u64>(jit_interface));
code->mov(code->ABI_PARAM3, reinterpret_cast<u64>(cb.user_arg));
code->mov(MJitStateReg(Arm::Reg::PC), code->ABI_PARAM1.cvt32()); code->mov(MJitStateReg(Arm::Reg::PC), code->ABI_PARAM1.cvt32());
code->SwitchMxcsrOnExit(); code->SwitchMxcsrOnExit();
code->CallFunction(cb.InterpreterFallback); code->CallFunction(cb.InterpreterFallback);

View file

@ -56,7 +56,7 @@ static void MemoryWrite8(u32 vaddr, u8 value);
static void MemoryWrite16(u32 vaddr, u16 value); static void MemoryWrite16(u32 vaddr, u16 value);
static void MemoryWrite32(u32 vaddr, u32 value); static void MemoryWrite32(u32 vaddr, u32 value);
static void MemoryWrite64(u32 vaddr, u64 value); static void MemoryWrite64(u32 vaddr, u64 value);
static void InterpreterFallback(u32 pc, Dynarmic::Jit* jit); static void InterpreterFallback(u32 pc, Dynarmic::Jit* jit, void*);
static Dynarmic::UserCallbacks GetUserCallbacks(); static Dynarmic::UserCallbacks GetUserCallbacks();
static bool IsReadOnlyMemory(u32 vaddr) { static bool IsReadOnlyMemory(u32 vaddr) {
@ -92,7 +92,7 @@ static void MemoryWrite64(u32 vaddr, u64 value){
write_records.push_back({64, vaddr, value}); write_records.push_back({64, vaddr, value});
} }
static void InterpreterFallback(u32 pc, Dynarmic::Jit* jit) { static void InterpreterFallback(u32 pc, Dynarmic::Jit* jit, void*) {
ARMul_State interp_state{USER32MODE}; ARMul_State interp_state{USER32MODE};
interp_state.user_callbacks = GetUserCallbacks(); interp_state.user_callbacks = GetUserCallbacks();
interp_state.NumInstrsToExecute = 1; interp_state.NumInstrsToExecute = 1;

View file

@ -48,7 +48,7 @@ static void MemoryWrite8(u32 vaddr, u8 value);
static void MemoryWrite16(u32 vaddr, u16 value); static void MemoryWrite16(u32 vaddr, u16 value);
static void MemoryWrite32(u32 vaddr, u32 value); static void MemoryWrite32(u32 vaddr, u32 value);
static void MemoryWrite64(u32 vaddr, u64 value); static void MemoryWrite64(u32 vaddr, u64 value);
static void InterpreterFallback(u32 pc, Dynarmic::Jit* jit); static void InterpreterFallback(u32 pc, Dynarmic::Jit* jit, void*);
static Dynarmic::UserCallbacks GetUserCallbacks(); static Dynarmic::UserCallbacks GetUserCallbacks();
static bool IsReadOnlyMemory(u32 vaddr) { static bool IsReadOnlyMemory(u32 vaddr) {
@ -84,7 +84,7 @@ static void MemoryWrite64(u32 vaddr, u64 value){
write_records.push_back({64, vaddr, value}); write_records.push_back({64, vaddr, value});
} }
static void InterpreterFallback(u32 pc, Dynarmic::Jit* jit) { static void InterpreterFallback(u32 pc, Dynarmic::Jit* jit, void*) {
ARMul_State interp_state{USER32MODE}; ARMul_State interp_state{USER32MODE};
interp_state.user_callbacks = GetUserCallbacks(); interp_state.user_callbacks = GetUserCallbacks();
interp_state.NumInstrsToExecute = 1; interp_state.NumInstrsToExecute = 1;

View file

@ -15,7 +15,7 @@
static std::array<u16, 1024> code_mem{}; static std::array<u16, 1024> code_mem{};
static u32 MemoryRead32(u32 vaddr); static u32 MemoryRead32(u32 vaddr);
static void InterpreterFallback(u32 pc, Dynarmic::Jit* jit); static void InterpreterFallback(u32 pc, Dynarmic::Jit* jit, void*);
static Dynarmic::UserCallbacks GetUserCallbacks(); static Dynarmic::UserCallbacks GetUserCallbacks();
static u32 MemoryRead32(u32 vaddr) { static u32 MemoryRead32(u32 vaddr) {
@ -26,7 +26,7 @@ static u32 MemoryRead32(u32 vaddr) {
return vaddr; return vaddr;
} }
static void InterpreterFallback(u32 pc, Dynarmic::Jit* jit) { static void InterpreterFallback(u32 pc, Dynarmic::Jit* jit, void*) {
ARMul_State interp_state{USER32MODE}; ARMul_State interp_state{USER32MODE};
interp_state.user_callbacks = GetUserCallbacks(); interp_state.user_callbacks = GetUserCallbacks();
interp_state.NumInstrsToExecute = 1; interp_state.NumInstrsToExecute = 1;