Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Mar 2012 03:27:58 +0000 (UTC)
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r232579 - head/lib/libthr/arch/mips/include
Message-ID:  <201203060327.q263RwIu017505@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gonzo
Date: Tue Mar  6 03:27:58 2012
New Revision: 232579
URL: http://svn.freebsd.org/changeset/base/232579

Log:
  - Switch to saving non-offseted pointer to TLS block in order too keep things simple

Modified:
  head/lib/libthr/arch/mips/include/pthread_md.h

Modified: head/lib/libthr/arch/mips/include/pthread_md.h
==============================================================================
--- head/lib/libthr/arch/mips/include/pthread_md.h	Tue Mar  6 03:27:08 2012	(r232578)
+++ head/lib/libthr/arch/mips/include/pthread_md.h	Tue Mar  6 03:27:58 2012	(r232579)
@@ -35,15 +35,11 @@
 
 #include <sys/types.h>
 #include <machine/sysarch.h>
+#include <machine/tls.h>
 #include <stddef.h>
 
 #define	CPU_SPINWAIT
 #define	DTV_OFFSET		offsetof(struct tcb, tcb_dtv)
-#ifdef __mips_n64
-#define	TP_OFFSET		0x7010
-#else
-#define	TP_OFFSET		0x7008
-#endif
 
 /*
  * Variant I tcb. The structure layout is fixed, don't blindly
@@ -65,7 +61,7 @@ static __inline void
 _tcb_set(struct tcb *tcb)
 {
 
-	sysarch(MIPS_SET_TLS, ((uint8_t*)tcb + TP_OFFSET));
+	sysarch(MIPS_SET_TLS, tcb);
 }
 
 /*
@@ -74,10 +70,10 @@ _tcb_set(struct tcb *tcb)
 static __inline struct tcb *
 _tcb_get(void)
 {
-	uint8_t *tcb;
+	struct tcb *tcb;
 
 	sysarch(MIPS_GET_TLS, &tcb);
-	return ((struct tcb *)(tcb - TP_OFFSET));
+	return tcb;
 }
 
 extern struct pthread *_thr_initial;



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