summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/aim/machdep.c
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/aim/machdep.c
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/aim/machdep.c')
-rw-r--r--sys/powerpc/aim/machdep.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c
index c368c68..2049949 100644
--- a/sys/powerpc/aim/machdep.c
+++ b/sys/powerpc/aim/machdep.c
@@ -303,7 +303,12 @@ powerpc_init(vm_offset_t startkernel, vm_offset_t endkernel,
*/
pc = __pcpu;
pcpu_init(pc, 0, sizeof(struct pcpu));
- curthread_reg = pc->pc_curthread = &thread0;
+ pc->pc_curthread = &thread0;
+#ifdef __powerpc64__
+ __asm __volatile("mr 13,%0" :: "r"(pc->pc_curthread));
+#else
+ __asm __volatile("mr 2,%0" :: "r"(pc->pc_curthread));
+#endif
pc->pc_cpuid = 0;
__asm __volatile("mtsprg 0, %0" :: "r"(pc));
OpenPOWER on IntegriCloud