diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/arm/unicorn/arm_unicorn.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/arm/unicorn/arm_unicorn.cpp b/src/core/arm/unicorn/arm_unicorn.cpp index d189efb63..b96583123 100644 --- a/src/core/arm/unicorn/arm_unicorn.cpp +++ b/src/core/arm/unicorn/arm_unicorn.cpp | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include "core/core_timing.h" | 11 | #include "core/core_timing.h" |
| 12 | #include "core/hle/kernel/scheduler.h" | 12 | #include "core/hle/kernel/scheduler.h" |
| 13 | #include "core/hle/kernel/svc.h" | 13 | #include "core/hle/kernel/svc.h" |
| 14 | #include "core/memory.h" | ||
| 14 | 15 | ||
| 15 | namespace Core { | 16 | namespace Core { |
| 16 | 17 | ||
| @@ -171,7 +172,17 @@ MICROPROFILE_DEFINE(ARM_Jit_Unicorn, "ARM JIT", "Unicorn", MP_RGB(255, 64, 64)); | |||
| 171 | 172 | ||
| 172 | void ARM_Unicorn::ExecuteInstructions(std::size_t num_instructions) { | 173 | void ARM_Unicorn::ExecuteInstructions(std::size_t num_instructions) { |
| 173 | MICROPROFILE_SCOPE(ARM_Jit_Unicorn); | 174 | MICROPROFILE_SCOPE(ARM_Jit_Unicorn); |
| 175 | |||
| 176 | // Temporarily map the code page for Unicorn | ||
| 177 | u64 map_addr{GetPC() & ~Memory::PAGE_MASK}; | ||
| 178 | std::vector<u8> page_buffer(Memory::PAGE_SIZE); | ||
| 179 | system.Memory().ReadBlock(map_addr, page_buffer.data(), page_buffer.size()); | ||
| 180 | |||
| 181 | CHECKED(uc_mem_map_ptr(uc, map_addr, page_buffer.size(), | ||
| 182 | UC_PROT_READ | UC_PROT_WRITE | UC_PROT_EXEC, page_buffer.data())); | ||
| 174 | CHECKED(uc_emu_start(uc, GetPC(), 1ULL << 63, 0, num_instructions)); | 183 | CHECKED(uc_emu_start(uc, GetPC(), 1ULL << 63, 0, num_instructions)); |
| 184 | CHECKED(uc_mem_unmap(uc, map_addr, page_buffer.size())); | ||
| 185 | |||
| 175 | system.CoreTiming().AddTicks(num_instructions); | 186 | system.CoreTiming().AddTicks(num_instructions); |
| 176 | if (GDBStub::IsServerEnabled()) { | 187 | if (GDBStub::IsServerEnabled()) { |
| 177 | if (last_bkpt_hit && last_bkpt.type == GDBStub::BreakpointType::Execute) { | 188 | if (last_bkpt_hit && last_bkpt.type == GDBStub::BreakpointType::Execute) { |