From 2db80ea0eabc6add2b075dde2e9871e71319c000 Mon Sep 17 00:00:00 2001 From: Macdu Date: Sun, 10 Mar 2024 19:09:51 +0100 Subject: [PATCH] external, cpu: Update dynarmic (#3241) --- external/dynarmic | 2 +- vita3k/cpu/include/cpu/impl/dynarmic_cpu.h | 1 - vita3k/cpu/src/dynarmic_cpu.cpp | 30 ++++++++++------------ 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/external/dynarmic b/external/dynarmic index 83adf70de..d8b33e431 160000 --- a/external/dynarmic +++ b/external/dynarmic @@ -1 +1 @@ -Subproject commit 83adf70ded4ea5642fb35da1e2cdc73e898316e7 +Subproject commit d8b33e4311fbb41aac376cc8b644c47df03c1549 diff --git a/vita3k/cpu/include/cpu/impl/dynarmic_cpu.h b/vita3k/cpu/include/cpu/impl/dynarmic_cpu.h index 71e23b3ca..2f34aeb34 100644 --- a/vita3k/cpu/include/cpu/impl/dynarmic_cpu.h +++ b/vita3k/cpu/include/cpu/impl/dynarmic_cpu.h @@ -18,7 +18,6 @@ #pragma once #include -#include #include #include diff --git a/vita3k/cpu/src/dynarmic_cpu.cpp b/vita3k/cpu/src/dynarmic_cpu.cpp index 9a74b06cc..6241f757e 100644 --- a/vita3k/cpu/src/dynarmic_cpu.cpp +++ b/vita3k/cpu/src/dynarmic_cpu.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -295,14 +296,14 @@ public: }; std::unique_ptr DynarmicCPU::make_jit() { - Dynarmic::A32::UserConfig config; + Dynarmic::A32::UserConfig config{}; config.arch_version = Dynarmic::A32::ArchVersion::v7; config.callbacks = cb.get(); if (parent->mem->use_page_table) { config.page_table = (log_mem || !cpu_opt) ? nullptr : reinterpret_cast(parent->mem->page_table.get()); config.absolute_offset_page_table = true; - } else { - config.fastmem_pointer = (log_mem || !cpu_opt) ? nullptr : parent->mem->memory.get(); + } else if (!log_mem && cpu_opt) { + config.fastmem_pointer = std::bit_cast(parent->mem->memory.get()); } config.hook_hint_instructions = true; config.enable_cycle_counting = false; @@ -440,24 +441,21 @@ void DynarmicCPU::set_fpscr(uint32_t val) { CPUContext DynarmicCPU::save_context() { CPUContext ctx; - const auto dctx = jit->SaveContext(); - ctx.cpu_registers = dctx.Regs(); - static_assert(sizeof(ctx.fpu_registers) == sizeof(dctx.ExtRegs())); - memcpy(ctx.fpu_registers.data(), dctx.ExtRegs().data(), sizeof(ctx.fpu_registers)); - ctx.fpscr = dctx.Fpscr(); - ctx.cpsr = dctx.Cpsr(); + ctx.cpu_registers = jit->Regs(); + static_assert(sizeof(ctx.fpu_registers) == sizeof(jit->ExtRegs())); + memcpy(ctx.fpu_registers.data(), jit->ExtRegs().data(), sizeof(ctx.fpu_registers)); + ctx.fpscr = jit->Fpscr(); + ctx.cpsr = jit->Cpsr(); return ctx; } void DynarmicCPU::load_context(CPUContext ctx) { - Dynarmic::A32::Context dctx; - dctx.Regs() = ctx.cpu_registers; - static_assert(sizeof(ctx.fpu_registers) == sizeof(dctx.ExtRegs())); - memcpy(dctx.ExtRegs().data(), ctx.fpu_registers.data(), sizeof(ctx.fpu_registers)); - dctx.SetCpsr(ctx.cpsr); - dctx.SetFpscr(ctx.fpscr); - jit->LoadContext(dctx); + jit->Regs() = ctx.cpu_registers; + static_assert(sizeof(ctx.fpu_registers) == sizeof(jit->ExtRegs())); + memcpy(jit->ExtRegs().data(), ctx.fpu_registers.data(), sizeof(ctx.fpu_registers)); + jit->SetCpsr(ctx.cpsr); + jit->SetFpscr(ctx.fpscr); } uint32_t DynarmicCPU::get_lr() {