From c1b08cd1b240332abfac339823a7468f52ff843d Mon Sep 17 00:00:00 2001 From: Jack Rosenthal Date: Thu, 2 May 2019 09:58:48 -0600 Subject: ish: preserve panic data across reset This commit stores panic data across reset by storing panic data in the last 256 bytes of AON memory (before AON ROM). > crash divzero ========== PANIC ========== Reason: Divide By Zero Error Code = 0xFF00B60C EIP = 0xFF010008 CS = 0x00010202 EFLAGS = 0x00103085 EAX = 0x00000001 EBX = 0xFF01B118 ECX = 0x00000000 EDX = 0x00000000 ESI = 0x00000000 EDI = 0xFF017E0E Resetting system... =========================== ... ISH reset ... > panicinfo Saved panic data: (NEW) Reason: Divide By Zero Error Code = 0xFF00B60C EIP = 0xFF010008 CS = 0x00010202 EFLAGS = 0x00103085 EAX = 0x00000001 EBX = 0xFF01B118 ECX = 0x00000000 EDX = 0x00000000 ESI = 0x00000000 EDI = 0xFF017E0E BUG=b:129425206 BRANCH=none TEST=see console output above (on arcada_ish) Change-Id: I5c9e458b53076eafe7fa50ba851f2c6e863f2247 Signed-off-by: Jack Rosenthal Reviewed-on: https://chromium-review.googlesource.com/1593418 Reviewed-by: Jett Rink --- core/minute-ia/panic.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'core') diff --git a/core/minute-ia/panic.c b/core/minute-ia/panic.c index 06c903be0c..40e8ee1cf0 100644 --- a/core/minute-ia/panic.c +++ b/core/minute-ia/panic.c @@ -13,14 +13,13 @@ #include "task.h" #include "timer.h" #include "util.h" -#include "watchdog.h" /* * This array maps an interrupt vector number to the corresponding * exception name. See see "Intel 64 and IA-32 Architectures Software * Developer's Manual", Volume 3A, Section 6.15. */ -const static char *PANIC_REASON[] = { +const static char *panic_reason[] = { "Divide By Zero", "Debug Exception", "NMI Interrupt", @@ -45,13 +44,14 @@ const static char *PANIC_REASON[] = { }; /* - * Print panic data + * Print panic data. This may be called either from the report_panic + * procedure (below) while handling a panic, or from the panicinfo + * console command. */ void panic_data_print(const struct panic_data *pdata) { - panic_printf("\n========== PANIC ==========\n"); if (pdata->x86.vector <= 20) - panic_printf("%s\n", PANIC_REASON[pdata->x86.vector]); + panic_printf("Reason: %s\n", panic_reason[pdata->x86.vector]); else panic_printf("Interrupt vector number: 0x%08X (unknown)\n", pdata->x86.vector); @@ -66,13 +66,6 @@ void panic_data_print(const struct panic_data *pdata) panic_printf("EDX = 0x%08X\n", pdata->x86.edx); panic_printf("ESI = 0x%08X\n", pdata->x86.esi); panic_printf("EDI = 0x%08X\n", pdata->x86.edi); - panic_printf("\n"); - panic_printf("Resetting system...\n"); - panic_printf("===========================\n"); -} - -void __keep report_panic(void) -{ } /** @@ -132,7 +125,13 @@ __attribute__ ((noreturn)) void __keep exception_panic( if (panic_once) panic_printf("\nWhile resetting from a panic, another panic" " occurred!"); + + panic_printf("\n========== PANIC ==========\n"); panic_data_print(PANIC_DATA_PTR); + panic_printf("\n"); + panic_printf("Resetting system...\n"); + panic_printf("===========================\n"); + if (panic_once) { system_reset(SYSTEM_RESET_HARD); } else { -- cgit v1.2.1