mirror of https://github.com/thesofproject/sof.git
panic: Distinguish exceptions from other panics
On exceptions and panics, the code will reach panic_rewind. That function will, among the other things it needs to do to dump the info, will also dump the exception cause (exccause register). This means that normally coredumps from panics and those from exceptions are indistinguishable. In this commit I reserve the maximum value for exccause (63) to signify that the dump actually came from a panic instead of a hardware exception. The easiest way I could see that would not duplicate code is to simply set the exccause register to this reserved value (otherwise it could be undefined, as it's not initialized at boot). I also update the core dumper tool to use 63 as the value reserved for panics instead of 0 (which is IllegalInstructionCause, a valid hardware exception). Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
This commit is contained in:
parent
2d0759dd02
commit
3ed68f15af
|
@ -88,5 +88,14 @@ void __panic(uint32_t p, char *filename, uint32_t linenum)
|
|||
filename, strlen + 1));
|
||||
}
|
||||
|
||||
/* To distinguish regular panic() calls from exceptions, we will
|
||||
* set a reserved value for the exception cause (63) so the
|
||||
* coredumper tool could distinguish between the situations.
|
||||
*/
|
||||
__asm__ __volatile__("movi a3, 63\n\t"
|
||||
"wsr.exccause a3\n\t"
|
||||
"esync" : : :
|
||||
"a3", "memory");
|
||||
|
||||
panic_rewind(p, 0, &panicinfo, NULL);
|
||||
}
|
||||
|
|
|
@ -729,7 +729,9 @@ class CoreDumpReader(object):
|
|||
stdoutPrint("set *0x{:08x}=0x{:08x}\n"
|
||||
.format(addr, dw))
|
||||
|
||||
if self.core_dump.exccause:
|
||||
# Exccause 63 is reserved for panics; the other causes come
|
||||
# from actual exceptions
|
||||
if self.core_dump.exccause != 63:
|
||||
verbosePrint("\n# *EXCEPTION*\n")
|
||||
verbosePrint("# exccause: " + EXCCAUSE_CODE[self.core_dump.exccause][0])
|
||||
if EXCCAUSE_CODE[self.core_dump.exccause][1]:
|
||||
|
|
Loading…
Reference in New Issue