DragonFly kernel List (threaded) for 2007-10
DragonFly BSD
DragonFly kernel List (threaded) for 2007-10
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: pmap of amd64


From: Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxx>
Date: Mon, 15 Oct 2007 13:17:03 +0200
Mail-followup-to: kernel@crater.dragonflybsd.org

On Sat, Oct 13, 2007 at 04:24:53PM -0700, Matthew Dillon wrote:
> 
> :On Fri, Oct 12, 2007 at 07:54:16PM -0700, Matthew Dillon wrote:
> :>     (1) We can map a page containing the address of the per-cpu globaldata
> :>         structure and use %fs in the trap code:
> :>  
> :>         movq	$SOME_FIXED_CONSTANT_ADDRESS,%fs
> :
> :You don't have to play such games on AMD64 -- the swapgs instruction is
> :normally used by traps and system calls to load a well-defined address
> :base for that. Note that gs is expected to be used for, but that is a
> :minor detail.
> :
> :Joerg
> 
>     I don't think we can use swapgs.  The problem with swapgs is that it's
>     a swap, not a load, which means it can only be used at the syscall
>     interface and can't be used at the interrupt or exception interface.

You can check the stack frame for the RIP and if it is alreday in the
kernel, you can skip the swapgs. Given that you have to do more work for
traps from userland anyway, that's a relatively cheap change.

Joerg



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]