summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2012-03-04 05:19:55 +0000
committerjmallett <jmallett@FreeBSD.org>2012-03-04 05:19:55 +0000
commit77002eeb6cfd162e6ae4999ec8029a1079f7344f (patch)
tree406e250ef07052dc0b89ad3007fc04df33fe545d
parent3083b3865cbe7e0870b7acfc44acc4629c9b0c94 (diff)
downloadFreeBSD-src-77002eeb6cfd162e6ae4999ec8029a1079f7344f.zip
FreeBSD-src-77002eeb6cfd162e6ae4999ec8029a1079f7344f.tar.gz
Fix tls base computation with COMPAT_FREEBSD32 on n64 kernels. The previous
version was missing an else and would always use the n64 TP_OFFSET. Eliminate some duplication of logic here. It may be worth getting rid of some of the ifdefs and introducing gratuitous SV_ILP32 runtime checks on n64 kernels without COMPAT_FREEBSD32 and on o32 kernels, similarly to how PowerPC works.
-rw-r--r--sys/mips/mips/vm_machdep.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/mips/mips/vm_machdep.c b/sys/mips/mips/vm_machdep.c
index 34dcea8..cbbe990 100644
--- a/sys/mips/mips/vm_machdep.c
+++ b/sys/mips/mips/vm_machdep.c
@@ -618,14 +618,18 @@ cpu_set_user_tls(struct thread *td, void *tls_base)
#ifdef __mips_n64
#ifdef COMPAT_FREEBSD32
- if (SV_PROC_FLAG(td->td_proc, SV_ILP32))
- td->td_md.md_tls = (char*)tls_base + 0x7008;
+ if (!SV_PROC_FLAG(td->td_proc, SV_ILP32)) {
#endif
- td->td_md.md_tls = (char*)tls_base + 0x7010;
-#else
- td->td_md.md_tls = (char*)tls_base + 0x7008;
+ td->td_md.md_tls = (char*)tls_base + 0x7010;
+ return (0);
+#ifdef COMPAT_FREEBSD32
+ }
#endif
+#endif
+#if !defined(__mips_n64) || defined(COMPAT_FREEBSD32)
+ td->td_md.md_tls = (char*)tls_base + 0x7008;
return (0);
+#endif
}
#ifdef DDB
OpenPOWER on IntegriCloud