diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2011-11-17 15:49:42 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2011-11-17 15:49:42 +0000 |
commit | ef4c84e32bd0feba0a4aa485c44c23db1bc24293 (patch) | |
tree | 97cd6167540839daf45973e80763fcda71433a10 /sys/powerpc/include/pcpu.h | |
parent | 6f4edbc71847532df7e5dbb131dc1bf0bb75d255 (diff) | |
download | FreeBSD-src-ef4c84e32bd0feba0a4aa485c44c23db1bc24293.zip FreeBSD-src-ef4c84e32bd0feba0a4aa485c44c23db1bc24293.tar.gz |
Use a global __pure2 function instead of a global register variable for
curthread, like on x86 and sparc64. This makes the kernel somewhat more
clang friendly, which doesn't support global register variables.
Diffstat (limited to 'sys/powerpc/include/pcpu.h')
-rw-r--r-- | sys/powerpc/include/pcpu.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/powerpc/include/pcpu.h b/sys/powerpc/include/pcpu.h index 631abd2..2dac1b4 100644 --- a/sys/powerpc/include/pcpu.h +++ b/sys/powerpc/include/pcpu.h @@ -135,13 +135,20 @@ struct pmap; #ifdef _KERNEL #define pcpup ((struct pcpu *) powerpc_get_pcpup()) + +#ifdef AIM /* Book-E not yet adapted */ +static __inline __pure2 struct thread * +__curthread(void) +{ + struct thread *td; #ifdef __powerpc64__ -register struct thread *curthread_reg __asm("%r13"); + __asm __volatile("mr %0,13" : "=r"(td)); #else -register struct thread *curthread_reg __asm("%r2"); + __asm __volatile("mr %0,2" : "=r"(td)); #endif -#ifdef AIM /* Book-E not yet adapted */ -#define curthread curthread_reg + return (td); +} +#define curthread (__curthread()) #endif #define PCPU_GET(member) (pcpup->pc_ ## member) |