summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/include/pcpu.h
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2011-11-17 15:49:42 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2011-11-17 15:49:42 +0000
commitef4c84e32bd0feba0a4aa485c44c23db1bc24293 (patch)
tree97cd6167540839daf45973e80763fcda71433a10 /sys/powerpc/include/pcpu.h
parent6f4edbc71847532df7e5dbb131dc1bf0bb75d255 (diff)
downloadFreeBSD-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.h15
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)
OpenPOWER on IntegriCloud