HomeFreeBSD

riscv: Save gp in the trapframe in both modes

Description

riscv: Save gp in the trapframe in both modes

Similar to d95fbf4e1a12565908b04b442263fe60c9e890b4, 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

(cherry picked from commit 3b35d2a8af43c2e3ea8cb5e1363ac87ec5eadeaf)

Details

Provenance
jhbAuthored on Sep 5 2023, 4:04 PM
Reviewer
mhorne
Differential Revision
D41699: riscv: Save gp in the trapframe in both modes
Parents
rGb7f5e993476f: virtio_random: Pipeline fetching the data
Branches
Unknown
Tags
Unknown