summaryrefslogtreecommitdiffstats
path: root/src/core/arm
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-04-21 05:28:23 +0200
committerGitHub <noreply@github.com>2020-04-21 05:28:23 +0200
commit48b670d1323c6872a294720b440032f87d99cfc4 (patch)
treea8f829a9ae7267afc75c71af4f1ef1462a301f32 /src/core/arm
parentaudio_renderer: Preliminary BehaviorInfo (#3736) (diff)
parentcore: arm_unicorn: Fix interpret fallback by temporarily mapping instruction page. (diff)
downloadyuzu-48b670d1323c6872a294720b440032f87d99cfc4.tar
yuzu-48b670d1323c6872a294720b440032f87d99cfc4.tar.gz
yuzu-48b670d1323c6872a294720b440032f87d99cfc4.tar.bz2
yuzu-48b670d1323c6872a294720b440032f87d99cfc4.tar.lz
yuzu-48b670d1323c6872a294720b440032f87d99cfc4.tar.xz
yuzu-48b670d1323c6872a294720b440032f87d99cfc4.tar.zst
yuzu-48b670d1323c6872a294720b440032f87d99cfc4.zip
Diffstat (limited to 'src/core/arm')
-rw-r--r--src/core/arm/unicorn/arm_unicorn.cpp11
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 @@
#include "core/core_timing.h"
#include "core/hle/kernel/scheduler.h"
#include "core/hle/kernel/svc.h"
+#include "core/memory.h"
namespace Core {
@@ -171,7 +172,17 @@ MICROPROFILE_DEFINE(ARM_Jit_Unicorn, "ARM JIT", "Unicorn", MP_RGB(255, 64, 64));
void ARM_Unicorn::ExecuteInstructions(std::size_t num_instructions) {
MICROPROFILE_SCOPE(ARM_Jit_Unicorn);
+
+ // Temporarily map the code page for Unicorn
+ u64 map_addr{GetPC() & ~Memory::PAGE_MASK};
+ std::vector<u8> page_buffer(Memory::PAGE_SIZE);
+ system.Memory().ReadBlock(map_addr, page_buffer.data(), page_buffer.size());
+
+ CHECKED(uc_mem_map_ptr(uc, map_addr, page_buffer.size(),
+ UC_PROT_READ | UC_PROT_WRITE | UC_PROT_EXEC, page_buffer.data()));
CHECKED(uc_emu_start(uc, GetPC(), 1ULL << 63, 0, num_instructions));
+ CHECKED(uc_mem_unmap(uc, map_addr, page_buffer.size()));
+
system.CoreTiming().AddTicks(num_instructions);
if (GDBStub::IsServerEnabled()) {
if (last_bkpt_hit && last_bkpt.type == GDBStub::BreakpointType::Execute) {