svn commit: r205431 - head/sys/ia64/include

[ Available lists | Index of svn-src-all | Month of Mar 2010 | Week of 22 Mar 2010 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Marcel Moolenaar <marcel@FreeBSD.org>
Date
22 Mar 2010 02:01:34
Subject
svn commit: r205431 - head/sys/ia64/include
Message-ID
201003220201.o2M21YVZ080700@svn.freebsd.org


[ Hide this part ]
Author: marcel
Date: Mon Mar 22 02:01:33 2010
New Revision: 205431
URL: http://svn.freebsd.org/changeset/base/205431

Log:
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.

Modified:
head/sys/ia64/include/pcpu.h

Modified: head/sys/ia64/include/pcpu.h
==============================================================================
--- head/sys/ia64/include/pcpu.h Mon Mar 22 00:11:31 2010 (r205430)
+++ head/sys/ia64/include/pcpu.h Mon Mar 22 02:01:33 2010 (r205431)
@@ -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)

/*

Elapsed time: 0.102 seconds