diff options
Diffstat (limited to 'src/core/arm')
| -rw-r--r-- | src/core/arm/arm_interface.cpp | 26 | ||||
| -rw-r--r-- | src/core/arm/arm_interface.h | 8 | ||||
| -rw-r--r-- | src/core/arm/unicorn/arm_unicorn.cpp | 1 |
3 files changed, 35 insertions, 0 deletions
diff --git a/src/core/arm/arm_interface.cpp b/src/core/arm/arm_interface.cpp new file mode 100644 index 000000000..bcc812da4 --- /dev/null +++ b/src/core/arm/arm_interface.cpp | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "arm_interface.h" | ||
| 6 | #include "common/common_types.h" | ||
| 7 | #include "common/logging/log.h" | ||
| 8 | #include "core/memory.h" | ||
| 9 | |||
| 10 | namespace Core { | ||
| 11 | void ARM_Interface::LogBacktrace() { | ||
| 12 | VAddr fp = GetReg(29); | ||
| 13 | VAddr lr = GetReg(30); | ||
| 14 | VAddr sp = GetReg(13); | ||
| 15 | VAddr pc = GetPC(); | ||
| 16 | LOG_ERROR(Core_ARM, "Backtrace, sp={:016X}, pc={:016X}", sp, pc); | ||
| 17 | for (;;) { | ||
| 18 | LOG_ERROR(Core_ARM, "{:016X}", lr); | ||
| 19 | if (!fp) { | ||
| 20 | break; | ||
| 21 | } | ||
| 22 | lr = Memory::Read64(fp + 8) - 4; | ||
| 23 | fp = Memory::Read64(fp); | ||
| 24 | } | ||
| 25 | } | ||
| 26 | }; // namespace Core | ||
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index 59da33f30..91d2b0f81 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h | |||
| @@ -141,6 +141,14 @@ public: | |||
| 141 | 141 | ||
| 142 | /// Prepare core for thread reschedule (if needed to correctly handle state) | 142 | /// Prepare core for thread reschedule (if needed to correctly handle state) |
| 143 | virtual void PrepareReschedule() = 0; | 143 | virtual void PrepareReschedule() = 0; |
| 144 | |||
| 145 | /// fp (= r29) points to the last frame record. | ||
| 146 | /// Note that this is the frame record for the *previous* frame, not the current one. | ||
| 147 | /// Note we need to subtract 4 from our last read to get the proper address | ||
| 148 | /// Frame records are two words long: | ||
| 149 | /// fp+0 : pointer to previous frame record | ||
| 150 | /// fp+8 : value of lr for frame | ||
| 151 | void LogBacktrace(); | ||
| 144 | }; | 152 | }; |
| 145 | 153 | ||
| 146 | } // namespace Core | 154 | } // namespace Core |
diff --git a/src/core/arm/unicorn/arm_unicorn.cpp b/src/core/arm/unicorn/arm_unicorn.cpp index ded4dd359..c455c81fb 100644 --- a/src/core/arm/unicorn/arm_unicorn.cpp +++ b/src/core/arm/unicorn/arm_unicorn.cpp | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include "core/core.h" | 10 | #include "core/core.h" |
| 11 | #include "core/core_timing.h" | 11 | #include "core/core_timing.h" |
| 12 | #include "core/hle/kernel/svc.h" | 12 | #include "core/hle/kernel/svc.h" |
| 13 | #include "core/memory.h" | ||
| 13 | 14 | ||
| 14 | namespace Core { | 15 | namespace Core { |
| 15 | 16 | ||