Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Nov 2011 13:03:59 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r227714 - stable/9/sys/sparc64/include
Message-ID:  <201111191303.pAJD3xtR044138@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Sat Nov 19 13:03:59 2011
New Revision: 227714
URL: http://svn.freebsd.org/changeset/base/227714

Log:
  MFC: r227539
  
  Define curthread as an inline function that loads the thread pointer
  directly from g7, the pcpu pointer. This guarantees correct behavior
  when the thread migrates to a different CPU.
  Commit message stolen from r205431. Additional testing by Peter Jeremy.
  
  Approved by:	re (kib)

Modified:
  stable/9/sys/sparc64/include/pcpu.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/sparc64/include/pcpu.h
==============================================================================
--- stable/9/sys/sparc64/include/pcpu.h	Sat Nov 19 13:03:14 2011	(r227713)
+++ stable/9/sys/sparc64/include/pcpu.h	Sat Nov 19 13:03:59 2011	(r227714)
@@ -74,6 +74,16 @@ register struct pcpu *pcpup __asm__(__XS
 
 #define	PCPU_GET(member)	(pcpup->pc_ ## member)
 
+static __inline __pure2 struct thread *
+__curthread(void)
+{
+	struct thread *td;
+
+	__asm("ldx [%" __XSTRING(PCPU_REG) "], %0" : "=r" (td));
+	return (td);
+}
+#define	curthread	(__curthread())
+
 /*
  * XXX The implementation of this operation should be made atomic
  * with respect to preemption.



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