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.
This commit is contained in:
jmallett 2012-03-04 05:19:55 +00:00
parent 3083b3865c
commit 77002eeb6c

View File

@ -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 + 0x7010;
return (0);
#ifdef COMPAT_FREEBSD32
}
#endif
#endif
#if !defined(__mips_n64) || defined(COMPAT_FREEBSD32)
td->td_md.md_tls = (char*)tls_base + 0x7008;
#endif
return (0);
#endif
}
#ifdef DDB