Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Aug 2018 18:50:30 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        Ruslan Bukin <br@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r337127 - head/sys/riscv/riscv
Message-ID:  <20180802155030.GA40119@kib.kiev.ua>
In-Reply-To: <7842b7e4-d14e-805f-719e-b393fc80b74c@FreeBSD.org>
References:  <201808021213.w72CDqQV065424@repo.freebsd.org> <7842b7e4-d14e-805f-719e-b393fc80b74c@FreeBSD.org>

index | next in thread | previous in thread | raw e-mail

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.


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180802155030.GA40119>