Raul Rangel has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/43356 )
Change subject: arch/x86/exception: Add support for printing stack to x86_64 ......................................................................
arch/x86/exception: Add support for printing stack to x86_64
x86_64 uses rsp and rbp which are 8 bytes wide.
BUG=b:159081993 TEST=none
Signed-off-by: Raul E Rangel rrangel@chromium.org Change-Id: Ie0571dd3a02acc4b70bdd00221e69cc2e20afec3 --- M src/arch/x86/exception.c 1 file changed, 13 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/56/43356/1
diff --git a/src/arch/x86/exception.c b/src/arch/x86/exception.c index 958ebfc..48083ca 100644 --- a/src/arch/x86/exception.c +++ b/src/arch/x86/exception.c @@ -545,8 +545,19 @@ printk(BIOS_EMERG, "%.2x ", code[i]); }
+#ifdef __x86_64__ + /* Align to 8-byte boundary and up the stack. */ + u64 *ptr = (u64 *)(ALIGN_DOWN(info->rsp, sizeof(u64)) + MDUMP_SIZE - sizeof(u64)); + for (i = 0; i < MDUMP_SIZE / sizeof(u64); ++i, --ptr) { + printk(BIOS_EMERG, "\n%p:\t0x%016llx", ptr, *ptr); + if ((uintptr_t)ptr == info->rbp) + printk(BIOS_EMERG, " <-rbp"); + else if ((uintptr_t)ptr == info->rsp) + printk(BIOS_EMERG, " <-rsp"); + } +#else /* Align to 4-byte boundary and up the stack. */ - u32 *ptr = (u32 *)(ALIGN_DOWN((uintptr_t)info->esp, sizeof(u32)) + MDUMP_SIZE - 4); + u32 *ptr = (u32 *)(ALIGN_DOWN(info->esp, sizeof(u32)) + MDUMP_SIZE - sizeof(u32)); for (i = 0; i < MDUMP_SIZE / sizeof(u32); ++i, --ptr) { printk(BIOS_EMERG, "\n%p:\t0x%08x", ptr, *ptr); if ((uintptr_t)ptr == info->ebp) @@ -554,6 +565,7 @@ else if ((uintptr_t)ptr == info->esp) printk(BIOS_EMERG, " <-esp"); } +#endif
die("\n"); #endif