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)
Sat, Sep 28, 7:49 AM
Unknown Object (File)
Thu, Sep 19, 2:45 PM
Unknown Object (File)
Mon, Sep 16, 6:48 PM
Unknown Object (File)
Sun, Sep 15, 12:22 PM
Unknown Object (File)
Sun, Sep 15, 12:22 PM
Unknown Object (File)
Wed, Sep 11, 3:06 PM
Unknown Object (File)
Aug 23 2024, 1:33 PM
Unknown Object (File)
Aug 23 2024, 1:33 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 53414
Build 50305: arc lint + arc unit

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.