Skip to content

Commit 863b379

Browse files
xen0nchenhuacai
authored andcommitted
LoongArch: Print symbol info for $ra and CSR.ERA only for kernel-mode contexts
Otherwise the addresses wouldn't make sense at all. While at it, align the "map keys" to maintain right-alignment with the "estat:" line too; also swap the ERA and ra lines so all CSRs are shown together. Signed-off-by: WANG Xuerui <git@xen0n.name> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent f6a79b6 commit 863b379

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

arch/loongarch/kernel/traps.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,19 @@ static void __show_regs(const struct pt_regs *regs)
183183
/* The slot for $zero is reused as the syscall restart flag */
184184
if (regs->regs[0])
185185
printk("syscall restart flag: %0*lx\n", GPR_FIELD(0));
186+
187+
if (user_mode(regs)) {
188+
printk(" ra: %0*lx\n", GPR_FIELD(1));
189+
printk(" ERA: %0*lx\n", field, regs->csr_era);
190+
} else {
191+
printk(" ra: %0*lx %pS\n", GPR_FIELD(1), (void *) regs->regs[1]);
192+
printk(" ERA: %0*lx %pS\n", field, regs->csr_era, (void *) regs->csr_era);
193+
}
186194
#undef GPR_FIELD
187195

188196
/*
189197
* Saved csr registers
190198
*/
191-
printk("era : %0*lx %pS\n", field, regs->csr_era,
192-
(void *) regs->csr_era);
193-
printk("ra : %0*lx %pS\n", field, regs->regs[1],
194-
(void *) regs->regs[1]);
195-
196199
printk("CSR crmd: %08lx ", regs->csr_crmd);
197200
printk("CSR prmd: %08lx ", regs->csr_prmd);
198201
printk("CSR euen: %08lx ", regs->csr_euen);

0 commit comments

Comments
 (0)