diff --git a/src/dynarmic/backend/x64/a64_emit_x64.cpp b/src/dynarmic/backend/x64/a64_emit_x64.cpp index 97472cf6..7cc4e140 100644 --- a/src/dynarmic/backend/x64/a64_emit_x64.cpp +++ b/src/dynarmic/backend/x64/a64_emit_x64.cpp @@ -508,7 +508,7 @@ void A64EmitX64::EmitA64ExceptionRaised(A64EmitContext& ctx, IR::Inst* inst) { void A64EmitX64::EmitA64DataCacheOperationRaised(A64EmitContext& ctx, IR::Inst* inst) { auto args = ctx.reg_alloc.GetArgumentInfo(inst); - ctx.reg_alloc.HostCall(nullptr, {}, args[0], args[1]); + ctx.reg_alloc.HostCall(nullptr, {}, args[1], args[2]); Devirtualize<&A64::UserCallbacks::DataCacheOperationRaised>(conf.callbacks).EmitCall(code); } diff --git a/src/dynarmic/frontend/A64/a64_ir_emitter.cpp b/src/dynarmic/frontend/A64/a64_ir_emitter.cpp index cc471289..80d7e007 100644 --- a/src/dynarmic/frontend/A64/a64_ir_emitter.cpp +++ b/src/dynarmic/frontend/A64/a64_ir_emitter.cpp @@ -55,7 +55,7 @@ void IREmitter::ExceptionRaised(Exception exception) { } void IREmitter::DataCacheOperationRaised(DataCacheOperation op, const IR::U64& value) { - Inst(Opcode::A64DataCacheOperationRaised, Imm64(static_cast(op)), value); + Inst(Opcode::A64DataCacheOperationRaised, ImmCurrentLocationDescriptor(), Imm64(static_cast(op)), value); } void IREmitter::InstructionCacheOperationRaised(InstructionCacheOperation op, const IR::U64& value) { diff --git a/src/dynarmic/ir/opcodes.inc b/src/dynarmic/ir/opcodes.inc index 7642d1fc..791c29a5 100644 --- a/src/dynarmic/ir/opcodes.inc +++ b/src/dynarmic/ir/opcodes.inc @@ -69,7 +69,7 @@ A64OPC(OrQC, Void, U1 A64OPC(SetPC, Void, U64 ) A64OPC(CallSupervisor, Void, U32 ) A64OPC(ExceptionRaised, Void, U64, U64 ) -A64OPC(DataCacheOperationRaised, Void, U64, U64 ) +A64OPC(DataCacheOperationRaised, Void, U64, U64, U64 ) A64OPC(InstructionCacheOperationRaised, Void, U64, U64 ) A64OPC(DataSynchronizationBarrier, Void, ) A64OPC(DataMemoryBarrier, Void, ) diff --git a/src/dynarmic/ir/opt/a64_callback_config_pass.cpp b/src/dynarmic/ir/opt/a64_callback_config_pass.cpp index f9037071..1e0195c4 100644 --- a/src/dynarmic/ir/opt/a64_callback_config_pass.cpp +++ b/src/dynarmic/ir/opt/a64_callback_config_pass.cpp @@ -22,13 +22,14 @@ void A64CallbackConfigPass(IR::Block& block, const A64::UserConfig& conf) { continue; } - const auto op = static_cast(inst.GetArg(0).GetU64()); + const auto op = static_cast(inst.GetArg(1).GetU64()); if (op == A64::DataCacheOperation::ZeroByVA) { A64::IREmitter ir{block}; + ir.current_location = A64::LocationDescriptor{IR::LocationDescriptor{inst.GetArg(0).GetU64()}}; ir.SetInsertionPoint(&inst); size_t bytes = 4 << static_cast(conf.dczid_el0 & 0b1111); - IR::U64 addr{inst.GetArg(1)}; + IR::U64 addr{inst.GetArg(2)}; const IR::U128 zero_u128 = ir.ZeroExtendToQuad(ir.Imm64(0)); while (bytes >= 16) {