Define curthread as an inline function that loads the thread pointer
directly from r13, the pcpu pointer. This guarantees correct behaviour when the thread migrates to a different CPU.
This commit is contained in:
parent
a5d64faeca
commit
c56153c577
@ -70,6 +70,16 @@ struct pcpu;
|
||||
|
||||
register struct pcpu *pcpup __asm__("r13");
|
||||
|
||||
static __inline struct thread *
|
||||
__curthread(void)
|
||||
{
|
||||
struct thread *td;
|
||||
|
||||
__asm __volatile("ld8.acq %0=[r13]" : "=r"(td));
|
||||
return (td);
|
||||
}
|
||||
#define curthread (__curthread())
|
||||
|
||||
#define PCPU_GET(member) (pcpup->pc_ ## member)
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user