Author: jmallett
Date: Tue Mar  6 07:47:28 2012
New Revision: 232583
URL: http://svn.freebsd.org/changeset/base/232583
Log:
  When emulating rdhwr for TLS, use the 32-bit offset under COMPAT_FREEBSD32.

Modified:
  head/sys/mips/include/tls.h
  head/sys/mips/mips/trap.c

Modified: head/sys/mips/include/tls.h
==============================================================================
--- head/sys/mips/include/tls.h Tue Mar  6 03:42:54 2012        (r232582)
+++ head/sys/mips/include/tls.h Tue Mar  6 07:47:28 2012        (r232583)
@@ -32,6 +32,10 @@
 #ifndef        __MIPS_TLS_H__
 #define        __MIPS_TLS_H__
 
+#if defined(_KERNEL) && !defined(KLD_MODULE) && !defined(_STANDALONE)
+#include "opt_compat.h"
+#endif
+
 /*
  * TLS parameters
  */
@@ -41,6 +45,9 @@
 
 #ifdef __mips_n64
 #define TLS_TCB_SIZE   16
+#ifdef COMPAT_FREEBSD32
+#define TLS_TCB_SIZE32 8
+#endif
 #else
 #define TLS_TCB_SIZE   8
 #endif

Modified: head/sys/mips/mips/trap.c
==============================================================================
--- head/sys/mips/mips/trap.c   Tue Mar  6 03:42:54 2012        (r232582)
+++ head/sys/mips/mips/trap.c   Tue Mar  6 07:47:28 2012        (r232583)
@@ -814,6 +814,11 @@ dofault:
                                        if (inst.RType.rd == 29) {
                                                frame_regs = &(trapframe->zero);
                                                frame_regs[inst.RType.rt] = 
(register_t)(intptr_t)td->td_md.md_tls;
+#if defined(__mips_n64) && defined(COMPAT_FREEBSD32)
+                                               if (SV_PROC_FLAG(td->td_proc, 
SV_ILP32))
+                                                       
frame_regs[inst.RType.rt] += TLS_TP_OFFSET + TLS_TCB_SIZE32;
+                                               else
+#endif
                                                frame_regs[inst.RType.rt] += 
TLS_TP_OFFSET + TLS_TCB_SIZE;
                                                trapframe->pc += sizeof(int);
                                                goto out;
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to