From cc368de1a0cf148409cc4b55cf6e616114ebf76d Mon Sep 17 00:00:00 2001 From: MerryMage Date: Wed, 21 Feb 2018 20:03:56 +0000 Subject: memory: LOG_ERROR when falling off end of page table --- src/core/memory.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/core/memory.cpp b/src/core/memory.cpp index cc1ed16b6..ce62666d7 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -118,6 +118,11 @@ boost::optional ReadSpecial(VAddr addr); template T Read(const VAddr vaddr) { + if ((vaddr >> PAGE_BITS) >= PAGE_TABLE_NUM_ENTRIES) { + LOG_ERROR(HW_Memory, "Read%lu after page table @ 0x%016" PRIX64, sizeof(T) * 8, vaddr); + return 0; + } + const PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; switch (type) { case PageType::Unmapped: @@ -146,6 +151,12 @@ bool WriteSpecial(VAddr addr, const T data); template void Write(const VAddr vaddr, const T data) { + if ((vaddr >> PAGE_BITS) >= PAGE_TABLE_NUM_ENTRIES) { + LOG_ERROR(HW_Memory, "Write%lu after page table 0x%08X @ 0x%016" PRIX64, sizeof(data) * 8, + (u32)data, vaddr); + return; + } + const PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; switch (type) { case PageType::Unmapped: -- cgit v1.2.3 From e8b9731af3a2ee2234a09300d8af7ea3469d22bd Mon Sep 17 00:00:00 2001 From: MerryMage Date: Wed, 21 Feb 2018 20:48:22 +0000 Subject: arm_dynarmic: LOG_INFO on unicorn fallback --- src/core/arm/dynarmic/arm_dynarmic.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp index 283d20831..ab10b8a34 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic.cpp @@ -6,6 +6,7 @@ #include #include #include +#include "common/logging/log.h" #include "core/arm/dynarmic/arm_dynarmic.h" #include "core/core_timing.h" #include "core/hle/kernel/memory.h" @@ -53,6 +54,9 @@ public: } void InterpreterFallback(u64 pc, size_t num_instructions) override { + LOG_INFO(Core_ARM, "Unicorn fallback @ 0x%" PRIx64 " for %zu instructions (instr = %08x)", + pc, num_instructions, MemoryReadCode(pc)); + ARM_Interface::ThreadContext ctx; parent.SaveContext(ctx); parent.inner_unicorn.LoadContext(ctx); -- cgit v1.2.3 From 32d127ad3e94b09566ca17b83072ff42018b02b3 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Wed, 21 Feb 2018 20:51:54 +0000 Subject: dynarmic: Update to 6b4c6b0 6b4c6b0 impl: Update PC when raising exception 7a1313a A64: Implement FDIV (vector) b2d781d system: Raise exception for YIELD, WFE, WFI, SEV, SEVL b277bf5 Correct FPSR and FPCR 7673933 A64: Implement USHL 8d0e558 A64: Implement UCVTF (vector, integer), scalar variant da9a4f8 A64: Partially implement FCVTZU (scalar, fixed-point) and FCVTZS (scalar, fixed-point) 7479684 A64: Implement system register TPIDR_EL0 0fd75fd A64: Implement system registers FPCR and FPSR 31e370c A64: Implement system register CNTPCT_EL0 9a88fd3 A64: Implement system register CTR_EL0 1d16896 A64: Implement NEG (vector) 3184edf IR: Add IR instruction ZeroVector 31f8fbc emit_x64_floating_point: Add maybe_unused to preprocess parameter 567eb1a A64: Implement FMINNM (scalar) c6d8fa1 A64: Implement FMAXNM (scalar) 616056d constant_pool: Add frame parameter a3747cb A64: Implement ADDP (scalar) 5cd5d9f reg_alloc: Only exchange GPRs dd0452a A64: Implement DUP (element), scalar variant e5732ea emit_x64_floating_point: Correct FP{Max,Min}{32,64} implementations for -0/+0 40eb9c3 A64: Implement FMAX (scalar), FMIN (scalar) 7cef39b fuzz_with_unicorn: QEMU's implementation of FCVT is incorrect 826dce2 travis: Switch unicorn repository 9605f28 a64/config: Allow NaN emulation accuracy to be set e9435bc a64_emit_x64: Add conf to A64EmitContext 30b596d fuzz_with_unicorn: Explicitly test floating point instructions be292a8 A64: Implement FSQRT (scalar) 3c42d48 backend_x64: Accurately handle NaNs 4aefed0 fuzz_with_unicorn: Print AArch64 disassembly --- externals/dynarmic | 2 +- src/core/arm/dynarmic/arm_dynarmic.cpp | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/externals/dynarmic b/externals/dynarmic index e585e1d49..6b4c6b06a 160000 --- a/externals/dynarmic +++ b/externals/dynarmic @@ -1 +1 @@ -Subproject commit e585e1d49ed65c31edd567510e00508d42decb1c +Subproject commit 6b4c6b06a94290690d2132adfa45a8087958c2c7 diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp index ab10b8a34..e7f6bf8c2 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic.cpp @@ -67,8 +67,17 @@ public: } void ExceptionRaised(u64 pc, Dynarmic::A64::Exception exception) override { - ASSERT_MSG(false, "ExceptionRaised(exception = %zu, pc = %" PRIx64 ")", - static_cast(exception), pc); + switch (exception) { + case Dynarmic::A64::Exception::WaitForInterrupt: + case Dynarmic::A64::Exception::WaitForEvent: + case Dynarmic::A64::Exception::SendEvent: + case Dynarmic::A64::Exception::SendEventLocal: + case Dynarmic::A64::Exception::Yield: + return; + default: + ASSERT_MSG(false, "ExceptionRaised(exception = %zu, pc = %" PRIx64 ")", + static_cast(exception), pc); + } } void CallSVC(u32 swi) override { @@ -85,11 +94,15 @@ public: u64 GetTicksRemaining() override { return ticks_remaining; } + u64 GetCNTPCT() override { + return CoreTiming::GetTicks(); + } ARM_Dynarmic& parent; size_t ticks_remaining = 0; size_t num_interpreted_instructions = 0; u64 tpidrro_el0 = 0; + u64 tpidr_el0 = 0; }; std::unique_ptr MakeJit(const std::unique_ptr& cb) { @@ -98,10 +111,13 @@ std::unique_ptr MakeJit(const std::unique_ptrtpidrro_el0; + config.tpidr_el0 = &cb->tpidr_el0; config.dczid_el0 = 4; + config.ctr_el0 = 0x8444c004; config.page_table = reinterpret_cast(page_table); config.page_table_address_space_bits = Memory::ADDRESS_SPACE_BITS; config.silently_mirror_page_table = false; + return std::make_unique(config); } -- cgit v1.2.3