From 67dc7f2e4eb495c0c6819f891f3436d3646d3a55 Mon Sep 17 00:00:00 2001 From: Merry Date: Thu, 21 Jul 2022 21:07:53 +0100 Subject: [PATCH] backend/arm64: Implement A32UpdateUpperLocationDescriptor --- src/dynarmic/backend/arm64/emit_arm64.cpp | 2 ++ src/dynarmic/backend/arm64/emit_arm64_a32.cpp | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/dynarmic/backend/arm64/emit_arm64.cpp b/src/dynarmic/backend/arm64/emit_arm64.cpp index a35cc7eb..1a282cc0 100644 --- a/src/dynarmic/backend/arm64/emit_arm64.cpp +++ b/src/dynarmic/backend/arm64/emit_arm64.cpp @@ -34,6 +34,8 @@ void EmitIR(oaknut::CodeGenerator& code, EmitContext& c template<> void EmitIR(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst); template<> +void EmitIR(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst*); +template<> void EmitIR(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst); template<> void EmitIR(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst); diff --git a/src/dynarmic/backend/arm64/emit_arm64_a32.cpp b/src/dynarmic/backend/arm64/emit_arm64_a32.cpp index fc5f1226..8f3c5ba0 100644 --- a/src/dynarmic/backend/arm64/emit_arm64_a32.cpp +++ b/src/dynarmic/backend/arm64/emit_arm64_a32.cpp @@ -50,8 +50,8 @@ void EmitSetUpperLocationDescriptor(oaknut::CodeGenerator& code, EmitContext& ct }(); if (old_upper != new_upper) { - code.MOV(Xscratch0, new_upper); - code.STR(Xscratch0, Xstate, offsetof(A32JitState, upper_location_descriptor)); + code.MOV(Wscratch0, new_upper); + code.STR(Wscratch0, Xstate, offsetof(A32JitState, upper_location_descriptor)); } } @@ -175,4 +175,14 @@ void EmitIR(oaknut::CodeGenerator& code, EmitContext& code.STR(Wscratch0, Xstate, offsetof(A32JitState, cpsr_nzcv)); } +template<> +void EmitIR(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst*) { + for (auto& inst : ctx.block) { + if (inst.GetOpcode() == IR::Opcode::A32BXWritePC) { + return; + } + } + EmitSetUpperLocationDescriptor(code, ctx, ctx.block.EndLocation(), ctx.block.Location()); +} + } // namespace Dynarmic::Backend::Arm64