svn commit: r337127 - head/sys/riscv/riscv

Konstantin Belousov kostikbel at gmail.com
Thu Aug 2 15:50:41 UTC 2018


On Thu, Aug 02, 2018 at 08:16:59AM -0700, John Baldwin wrote:
> On 8/2/18 5:13 AM, Ruslan Bukin wrote:
> > Author: br
> > Date: Thu Aug  2 12:13:52 2018
> > New Revision: 337127
> > URL: https://svnweb.freebsd.org/changeset/base/337127
> > 
> > Log:
> >   Don't overwrite tp in set_mcontext().
> >   
> >   This makes libthr/swapcontext_test:swapcontext1 happy.
> >   
> >   Sponsored by:	DARPA, AFRL
> 
> This seems a bit odd.  Is get_mcontext() not setting gp_tp correctly, or is
> makecontext() not preserving it perhaps?
> 
> In general I feel like we should be saving/restoring 'tp' in the trapframe
> on kernel entry/exit like other GPRs instead of in the pcb and then
> including it in 'struct reg'.  This makes it possible for debuggers to
> handle TLS variables more sanely (and in general we need to fix the various
> struct reg in FreeBSD architectures to include TLS registers when possible,
> such as adding fs_base and gs_base on x86).  It would be nice if RISC-V
> started off on the correct foot here.

I wanted to do this on x86, but I gave up due to the ABI issues.
When FSGSBASE instructions are supported on amd64, we save base
on context switch and restore on return to usermode.


More information about the svn-src-all mailing list