summaryrefslogtreecommitdiffstats
path: root/sys/i386/include/pcpu.h
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2003-11-20 23:23:22 +0000
committerpeter <peter@FreeBSD.org>2003-11-20 23:23:22 +0000
commitd7a2504b1e8c12fe9c7118548f0413b9b5d920b6 (patch)
tree7e3a93565fb21f8a6a582d45996f73e00490ee20 /sys/i386/include/pcpu.h
parent855c7a569b45eee9a67d2709f89add780f349e48 (diff)
downloadFreeBSD-src-d7a2504b1e8c12fe9c7118548f0413b9b5d920b6.zip
FreeBSD-src-d7a2504b1e8c12fe9c7118548f0413b9b5d920b6.tar.gz
MFamd64: use a less compiler-intensive MD implementation of 'curthread'
so that the compiler doesn't have to do so much work. Approved by: re (jhb)
Diffstat (limited to 'sys/i386/include/pcpu.h')
-rw-r--r--sys/i386/include/pcpu.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/i386/include/pcpu.h b/sys/i386/include/pcpu.h
index 1e5cba4..357f52e 100644
--- a/sys/i386/include/pcpu.h
+++ b/sys/i386/include/pcpu.h
@@ -151,6 +151,16 @@ extern struct pcpu *pcpup;
#define PCPU_PTR(member) __PCPU_PTR(pc_ ## member)
#define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val)
+static __inline struct thread *
+__curthread(void)
+{
+ struct thread *td;
+
+ __asm __volatile("movl %%fs:0,%0" : "=r" (td));
+ return (td);
+}
+#define curthread (__curthread())
+
#else
#error gcc or lint is required to use this file
#endif
OpenPOWER on IntegriCloud