Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Mar 2012 07:47:29 +0000 (UTC)
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r232583 - in head/sys/mips: include mips
Message-ID:  <201203060747.q267lTm1026195@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203060747.q267lTm1026195>