riscv: Save gp in the trapframe in both modes
Similar to d95fbf4e1a, always save gp in
the trapframe even though it is only restored when returning to user
mode. This is mostly a debugging aid so that dump_regs() doesn't
print out random stack garbage as the value of gp for kernel faults
(e.g. sysctl debug.kdb.trap=1) as well as keeping kgdb's trapframe
unwinder from reporting bogus values of $gp for lower frames.
Reviewed by: mhorne, jrtc27, markj
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D41699
This commit is contained in:
@@ -43,9 +43,9 @@
|
||||
|
||||
sd ra, (TF_RA)(sp)
|
||||
sd tp, (TF_TP)(sp)
|
||||
sd gp, (TF_GP)(sp)
|
||||
|
||||
.if \mode == 0 /* We came from userspace. */
|
||||
sd gp, (TF_GP)(sp)
|
||||
.option push
|
||||
.option norelax
|
||||
/* Load the kernel's global pointer */
|
||||
|
||||
Reference in New Issue
Block a user