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)
 
 /*
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to