summaryrefslogtreecommitdiffstats
path: root/sys/mips
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2012-02-10 07:03:45 +0000
committergonzo <gonzo@FreeBSD.org>2012-02-10 07:03:45 +0000
commit3951badb4ab33facb20c8f2f00f934910bef36ad (patch)
treed249e592dc37a684cd3e05f122af83e68f51f8eb /sys/mips
parentd9d5ba0dafd572b738441863d5cd89852d23da7a (diff)
downloadFreeBSD-src-3951badb4ab33facb20c8f2f00f934910bef36ad.zip
FreeBSD-src-3951badb4ab33facb20c8f2f00f934910bef36ad.tar.gz
Fix-up value passed by thr_new syscall to make it compatible
with MIPS_TLS_GET/MIPS_TLS_SET sysarch API.
Diffstat (limited to 'sys/mips')
-rw-r--r--sys/mips/mips/vm_machdep.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/mips/mips/vm_machdep.c b/sys/mips/mips/vm_machdep.c
index bdd73e7..81f004a 100644
--- a/sys/mips/mips/vm_machdep.c
+++ b/sys/mips/mips/vm_machdep.c
@@ -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);
}
OpenPOWER on IntegriCloud