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.
This commit is contained in:
parent
46e93cbbc5
commit
a897298940
@ -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));
|
||||
|
@ -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;
|
||||
|
||||
|
@ -135,13 +135,20 @@ struct pmap;
|
||||
#ifdef _KERNEL
|
||||
|
||||
#define pcpup ((struct pcpu *) powerpc_get_pcpup())
|
||||
#ifdef __powerpc64__
|
||||
register struct thread *curthread_reg __asm("%r13");
|
||||
#else
|
||||
register struct thread *curthread_reg __asm("%r2");
|
||||
#endif
|
||||
|
||||
#ifdef AIM /* Book-E not yet adapted */
|
||||
#define curthread curthread_reg
|
||||
static __inline __pure2 struct thread *
|
||||
__curthread(void)
|
||||
{
|
||||
struct thread *td;
|
||||
#ifdef __powerpc64__
|
||||
__asm __volatile("mr %0,13" : "=r"(td));
|
||||
#else
|
||||
__asm __volatile("mr %0,2" : "=r"(td));
|
||||
#endif
|
||||
return (td);
|
||||
}
|
||||
#define curthread (__curthread())
|
||||
#endif
|
||||
|
||||
#define PCPU_GET(member) (pcpup->pc_ ## member)
|
||||
|
Loading…
Reference in New Issue
Block a user