aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2023-09-05 16:04:54 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2023-10-11 15:10:32 +0000
commit4de5dace1acee104ecacc34e37a17f98d194164c (patch)
tree30bee7001cc13944c1a2db18efc22e809d08d571
parentb7f5e993476f6e445895383e73aed01741f8b9cf (diff)
downloadsrc-4de5dace1acee104ecacc34e37a17f98d194164c.tar.gz
src-4de5dace1acee104ecacc34e37a17f98d194164c.zip
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)
-rw-r--r--sys/riscv/riscv/exception.S2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/riscv/riscv/exception.S b/sys/riscv/riscv/exception.S
index 1aee009a4e00..8acb5cd691d4 100644
--- a/sys/riscv/riscv/exception.S
+++ b/sys/riscv/riscv/exception.S
@@ -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 */