Subject: Re: COMPAT_LINUX: moving forward with NPTL machdep code
To: Emmanuel Dreyfus <manu@netbsd.org>
From: Richard Earnshaw <Richard.Earnshaw@buzzard.freeserve.co.uk>
List: tech-kern
Date: 06/26/2006 19:13:58
On Mon, 26 Jun 2006 10:06:33 -0000, Emmanuel Dreyfus wrote:
> Hello
> 
> It would be nice if we could move forward with NPTL emulation. 
[...
> 
> For other architectures:
> - For ARM, we just have to get and set process' register R3

Eh?  Where did this 'specification' come from?  R3 is a general purpose 
register used in function calls and as a scratch at other times.  NPTL on 
ARM is only really supported in the new EABI linux flavour, where the 
thread register is stored in a special cp-15 register that on more recent 
chips is readable from user space (c13 sub-register 3 -- maybe that's 
where the confusion has come from) -- older CPU's don't have this register 
and just have to fake things up by trapping if the user tries to read it 
directly.  However, the recommended way for reading this value when 
presence of the register can't be guaranteed is to jump to a 'well-known 
address' in kernel space (somewhere in the top page of memory IIRC), and 
the trampoline at that address will set r0 to the right value.  The 
details of this are normally handled by the glibc __aeabi_read_tp call, 
but it expects the kernel to provide the low-level support.  Can NetBSD 
provide this sort of support in the kernel for Linux system calls?

R.