Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Mar 2010 02:01:34 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r205431 - head/sys/ia64/include
Message-ID:  <201003220201.o2M21YVZ080700@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003220201.o2M21YVZ080700>