diff --git a/src/dynarmic/backend/x64/a32_emit_x64.cpp b/src/dynarmic/backend/x64/a32_emit_x64.cpp index 2a6424b9..01ebdeb7 100644 --- a/src/dynarmic/backend/x64/a32_emit_x64.cpp +++ b/src/dynarmic/backend/x64/a32_emit_x64.cpp @@ -155,6 +155,11 @@ A32EmitX64::BlockDescriptor A32EmitX64::Emit(IR::Block& block) { EmitX64::EmitTerminal(block.GetTerminal(), ctx.Location().SetSingleStepping(false), ctx.IsSingleStep()); code.int3(); + for (auto& deferred_emit : ctx.deferred_emits) { + deferred_emit(); + } + code.int3(); + const size_t size = static_cast(code.getCurr() - entrypoint); const A32::LocationDescriptor descriptor{block.Location()}; diff --git a/src/dynarmic/backend/x64/a64_emit_x64.cpp b/src/dynarmic/backend/x64/a64_emit_x64.cpp index e0cd8c45..b3dc4fbd 100644 --- a/src/dynarmic/backend/x64/a64_emit_x64.cpp +++ b/src/dynarmic/backend/x64/a64_emit_x64.cpp @@ -126,6 +126,11 @@ A64EmitX64::BlockDescriptor A64EmitX64::Emit(IR::Block& block) { EmitX64::EmitTerminal(block.GetTerminal(), ctx.Location().SetSingleStepping(false), ctx.IsSingleStep()); code.int3(); + for (auto& deferred_emit : ctx.deferred_emits) { + deferred_emit(); + } + code.int3(); + const size_t size = static_cast(code.getCurr() - entrypoint); const A64::LocationDescriptor descriptor{block.Location()}; diff --git a/src/dynarmic/backend/x64/emit_x64.h b/src/dynarmic/backend/x64/emit_x64.h index 08a84640..24fbcdc3 100644 --- a/src/dynarmic/backend/x64/emit_x64.h +++ b/src/dynarmic/backend/x64/emit_x64.h @@ -6,6 +6,8 @@ #pragma once #include +#include +#include #include #include #include @@ -14,6 +16,7 @@ #include #include #include +#include #include #include "dynarmic/backend/x64/exception_handler.h" @@ -58,8 +61,16 @@ struct EmitContext { RegAlloc& reg_alloc; IR::Block& block; + + std::vector> deferred_emits; }; +using SharedLabel = std::shared_ptr; + +inline SharedLabel GenSharedLabel() { + return std::make_shared(); +} + class EmitX64 { public: struct BlockDescriptor {