summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDenis Orlov <denorl2009@gmail.com>2023-07-25 08:05:08 +0300
committerSascha Hauer <s.hauer@pengutronix.de>2023-07-27 07:08:29 +0200
commit2c9e141c078fea0c200936e90b8fff29c5a384e7 (patch)
tree0ec7f8d143bc243eaef9455003400869086bb188 /arch
parent7141578b3d85e6c74331d7bc714033e0a987b2e9 (diff)
downloadbarebox-2c9e141c078fea0c200936e90b8fff29c5a384e7.tar.gz
barebox-2c9e141c078fea0c200936e90b8fff29c5a384e7.tar.xz
MIPS: print BadVAddr CP0 register on exception
This register contains the failing address on Address Error and some TLB-related exceptions, and is useful for debugging purposes. Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20230725050618.3451-8-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/include/asm/stackframe.h4
-rw-r--r--arch/mips/lib/traps.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/arch/mips/include/asm/stackframe.h b/arch/mips/include/asm/stackframe.h
index 2295d7f02f..64ec37478a 100644
--- a/arch/mips/include/asm/stackframe.h
+++ b/arch/mips/include/asm/stackframe.h
@@ -89,8 +89,10 @@
#endif
LONG_S v1, PT_EPC(sp)
LONG_S $25, PT_R25(sp)
+ MFC0 v1, CP0_BADVADDR
LONG_S $28, PT_R28(sp)
LONG_S $31, PT_R31(sp)
+ LONG_S v1, PT_BVADDR(sp)
.set pop
.endm
@@ -157,11 +159,13 @@
MTC0 v1, CP0_EPC
LONG_L $31, PT_R31(sp)
LONG_L $28, PT_R28(sp)
+ LONG_L v1, PT_BVADDR(sp)
LONG_L $25, PT_R25(sp)
#ifdef CONFIG_64BIT
LONG_L $8, PT_R8(sp)
LONG_L $9, PT_R9(sp)
#endif
+ MTC0 v0, CP0_BADVADDR
LONG_L $7, PT_R7(sp)
LONG_L $6, PT_R6(sp)
LONG_L $5, PT_R5(sp)
diff --git a/arch/mips/lib/traps.c b/arch/mips/lib/traps.c
index 45694fe7ef..638a511fee 100644
--- a/arch/mips/lib/traps.c
+++ b/arch/mips/lib/traps.c
@@ -153,7 +153,8 @@ static void show_regs(const struct pt_regs *regs)
printf("Status: %08x\n", (uint32_t)regs->cp0_status);
printf("Cause : %08x\n", (uint32_t)regs->cp0_cause);
- printf("Config: %08x\n\n", read_c0_config());
+ printf("Config: %08x\n", read_c0_config());
+ printf("BadVA : %0*lx\n\n", field, regs->cp0_badvaddr);
}
void barebox_exc_handler(struct pt_regs *regs)