svn commit: r231351 - head/sys/mips/mips

Oleksandr Tymoshenko gonzo at FreeBSD.org
Fri Feb 10 07:03:46 UTC 2012


Author: gonzo
Date: Fri Feb 10 07:03:45 2012
New Revision: 231351
URL: http://svn.freebsd.org/changeset/base/231351

Log:
  Fix-up value passed by thr_new syscall to make it compatible
  with MIPS_TLS_GET/MIPS_TLS_SET sysarch API.

Modified:
  head/sys/mips/mips/vm_machdep.c

Modified: head/sys/mips/mips/vm_machdep.c
==============================================================================
--- head/sys/mips/mips/vm_machdep.c	Fri Feb 10 06:53:25 2012	(r231350)
+++ head/sys/mips/mips/vm_machdep.c	Fri Feb 10 07:03:45 2012	(r231351)
@@ -601,7 +601,18 @@ int
 cpu_set_user_tls(struct thread *td, void *tls_base)
 {
 
-	td->td_md.md_tls = tls_base;
+	/* 
+	 * tls_base passed to this function 
+         * from thr_new call and points to actual TCB struct, 
+	 * so we should add TP_OFFSET + sizeof(struct tcb)
+	 * to make it the same way TLS base is passed to 
+	 * MIPS_SET_TLS/MIPS_GET_TLS API 
+	 */
+#ifndef __mips_n64
+	td->td_md.md_tls = (char*)tls_base + 0x7010;
+#else
+	td->td_md.md_tls = (char*)tls_base + 0x7008;
+#endif
 	return (0);
 }
 


More information about the svn-src-all mailing list