mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-12-18 16:32:05 +00:00
kern: print kernel backtrace on panic
This commit is contained in:
parent
a89c5dd5d7
commit
8ef6c49d30
1 changed files with 12 additions and 5 deletions
|
@ -94,13 +94,16 @@ namespace ams::kern {
|
||||||
/* Print the state. */
|
/* Print the state. */
|
||||||
MESOSPHERE_RELEASE_LOG("Core[%d] Current State:\n", core_id);
|
MESOSPHERE_RELEASE_LOG("Core[%d] Current State:\n", core_id);
|
||||||
|
|
||||||
/* Print registers and user backtrace. */
|
/* Print kernel state. */
|
||||||
KDebug::PrintRegister();
|
|
||||||
KDebug::PrintBacktrace();
|
|
||||||
|
|
||||||
#ifdef ATMOSPHERE_ARCH_ARM64
|
#ifdef ATMOSPHERE_ARCH_ARM64
|
||||||
|
MESOSPHERE_RELEASE_LOG("Kernel Registers:\n");
|
||||||
|
for (size_t i = 0; i < 31; i++) {
|
||||||
|
MESOSPHERE_RELEASE_LOG(" X[%02zu] = %016lx\n", i, core_ctx->x[i]);
|
||||||
|
}
|
||||||
|
MESOSPHERE_RELEASE_LOG(" SP = %016lx\n", core_ctx->sp);
|
||||||
|
|
||||||
/* Print kernel backtrace. */
|
/* Print kernel backtrace. */
|
||||||
MESOSPHERE_RELEASE_LOG("Backtrace:\n");
|
MESOSPHERE_RELEASE_LOG("Kernel Backtrace:\n");
|
||||||
uintptr_t fp = core_ctx != nullptr ? core_ctx->x[29] : reinterpret_cast<uintptr_t>(__builtin_frame_address(0));
|
uintptr_t fp = core_ctx != nullptr ? core_ctx->x[29] : reinterpret_cast<uintptr_t>(__builtin_frame_address(0));
|
||||||
for (size_t i = 0; i < 32 && fp && util::IsAligned(fp, 0x10) && cpu::GetPhysicalAddressWritable(nullptr, fp, true); i++) {
|
for (size_t i = 0; i < 32 && fp && util::IsAligned(fp, 0x10) && cpu::GetPhysicalAddressWritable(nullptr, fp, true); i++) {
|
||||||
struct {
|
struct {
|
||||||
|
@ -112,6 +115,10 @@ namespace ams::kern {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Print registers and user backtrace. */
|
||||||
|
KDebug::PrintRegister();
|
||||||
|
KDebug::PrintBacktrace();
|
||||||
|
|
||||||
MESOSPHERE_RELEASE_LOG("\n");
|
MESOSPHERE_RELEASE_LOG("\n");
|
||||||
|
|
||||||
/* Allow the next core to print. */
|
/* Allow the next core to print. */
|
||||||
|
|
Loading…
Reference in a new issue