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/aim | |
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/aim')
-rw-r--r-- | sys/powerpc/aim/machdep.c | 7 | ||||
-rw-r--r-- | sys/powerpc/aim/mp_cpudep.c | 7 |
2 files changed, 12 insertions, 2 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)); diff --git a/sys/powerpc/aim/mp_cpudep.c b/sys/powerpc/aim/mp_cpudep.c index 68fe517..607256c 100644 --- a/sys/powerpc/aim/mp_cpudep.c +++ b/sys/powerpc/aim/mp_cpudep.c @@ -88,7 +88,12 @@ cpudep_ap_bootstrap(void) msr = PSL_KERNSET & ~PSL_EE; mtmsr(msr); - curthread_reg = pcpup->pc_curthread = pcpup->pc_idlethread; + pcpup->pc_curthread = pcpup->pc_idlethread; +#ifdef __powerpc64__ + __asm __volatile("mr 13,%0" :: "r"(pcpup->pc_curthread)); +#else + __asm __volatile("mr 2,%0" :: "r"(pcpup->pc_curthread)); +#endif pcpup->pc_curpcb = pcpup->pc_curthread->td_pcb; sp = pcpup->pc_curpcb->pcb_sp; |