Author: marius
Date: Sat Nov 19 13:04:17 2011
New Revision: 227715
URL: http://svn.freebsd.org/changeset/base/227715

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:
  releng/9.0/sys/sparc64/include/pcpu.h
Directory Properties:
  releng/9.0/sys/   (props changed)
  releng/9.0/sys/amd64/include/xen/   (props changed)
  releng/9.0/sys/boot/   (props changed)
  releng/9.0/sys/boot/i386/efi/   (props changed)
  releng/9.0/sys/boot/ia64/efi/   (props changed)
  releng/9.0/sys/boot/ia64/ski/   (props changed)
  releng/9.0/sys/boot/powerpc/boot1.chrp/   (props changed)
  releng/9.0/sys/boot/powerpc/ofw/   (props changed)
  releng/9.0/sys/cddl/contrib/opensolaris/   (props changed)
  releng/9.0/sys/conf/   (props changed)
  releng/9.0/sys/contrib/dev/acpica/   (props changed)
  releng/9.0/sys/contrib/octeon-sdk/   (props changed)
  releng/9.0/sys/contrib/pf/   (props changed)
  releng/9.0/sys/contrib/x86emu/   (props changed)

Modified: releng/9.0/sys/sparc64/include/pcpu.h
==============================================================================
--- releng/9.0/sys/sparc64/include/pcpu.h       Sat Nov 19 13:03:59 2011        
(r227714)
+++ releng/9.0/sys/sparc64/include/pcpu.h       Sat Nov 19 13:04:17 2011        
(r227715)
@@ -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.
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to