Page MenuHomeFreeBSD

riscv: Save gp in the trapframe in both modes
ClosedPublic

Authored by jhb on Sep 2 2023, 10:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jun 23, 4:44 AM
Unknown Object (File)
Fri, Jun 7, 12:25 AM
Unknown Object (File)
May 26 2024, 11:26 PM
Unknown Object (File)
May 26 2024, 11:25 PM
Unknown Object (File)
May 26 2024, 11:13 PM
Unknown Object (File)
May 4 2024, 4:35 AM
Unknown Object (File)
Mar 12 2024, 11:42 PM
Unknown Object (File)
Jan 21 2024, 5:04 PM
Subscribers

Details

Summary

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.

Sponsored by: DARPA

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Sep 2 2023, 10:05 PM

For the title + summary, RISC-V registers don't have % or $ sigils

Oh, the % is spurious for assembly certainly. In gdb the registers are named '$gp' (that is, it is 'p $gp' down in a lower frame that would give you an incorrect value), so I think $gp in the context of gdb makes sense.

jhb retitled this revision from riscv: Save %gp in the trapframe in both modes to riscv: Save gp in the trapframe in both modes.Sep 2 2023, 10:24 PM
jhb edited the summary of this revision. (Show Details)

I could also spell out "global pointer" in the summary if that is better

In D41699#950348, @jhb wrote:

I could also spell out "global pointer" in the summary if that is better

The current form seems reasonable

This revision is now accepted and ready to land.Sep 2 2023, 10:30 PM
This revision was automatically updated to reflect the committed changes.