summaryrefslogtreecommitdiffstats
path: root/sys/ia64/include
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2010-03-22 02:01:33 +0000
committermarcel <marcel@FreeBSD.org>2010-03-22 02:01:33 +0000
commitd5582bd6012d80fa65782ce116e963c3e943aba7 (patch)
tree95cc6c7d8a33ad624bcf22971c63fbdcab573f08 /sys/ia64/include
parentdb34b4a5eb1e2ab97653a18d95280340a5072607 (diff)
downloadFreeBSD-src-d5582bd6012d80fa65782ce116e963c3e943aba7.zip
FreeBSD-src-d5582bd6012d80fa65782ce116e963c3e943aba7.tar.gz
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.
Diffstat (limited to 'sys/ia64/include')
-rw-r--r--sys/ia64/include/pcpu.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/ia64/include/pcpu.h b/sys/ia64/include/pcpu.h
index bc9fe08..9eb8efb 100644
--- a/sys/ia64/include/pcpu.h
+++ b/sys/ia64/include/pcpu.h
@@ -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)
/*
OpenPOWER on IntegriCloud