HomeFreeBSD

Fix global pointer relaxations in the RISC-V kernel

Description

Fix global pointer relaxations in the RISC-V kernel

The gp register is intended to used by the linker as another means of
performing relaxations, and should point to the small data section (.sdata).

Currently gp is being used as the pcpu pointer within the kernel, but the more
appropriate choice for this is the tp register, which is unused.

Swap existing usage of gp with tp within the kernel, and set up gp properly
at boot with the value of __global_pointer$ for all harts.

Additionally, remove some cases of accessing tp from the PCB, as it is not
part of the per-thread state. The user's tp and gp should be tracked only
through the trapframe.

Reviewed by: markj, jhb
Approved by: markj (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19893

Details

Provenance
mhorneAuthored on
Reviewer
markj
Differential Revision
D19893: Fix global pointer relaxations in the RISC-V kernel
Parents
rS348835: Remove block of dead code
Branches
Unknown
Tags
Unknown