svn commit: r323029 - head/sys/mips/mips

John Baldwin jhb at FreeBSD.org
Wed Aug 30 19:21:13 UTC 2017


Author: jhb
Date: Wed Aug 30 19:21:11 2017
New Revision: 323029
URL: https://svnweb.freebsd.org/changeset/base/323029

Log:
  Apply 64k padding to stack pointer for 32-bit processes.
  
  In particular, MIPS now has COMPAT_FREEBSD32 for n64 kernels so this
  cannot be ignored for n64.  On the other hand, it is unneeded for o32
  MIPS kernels as the issue is only present when using 64-bit registers,
  so remove the workaround from o32 kernels.
  
  Reviewed by:	jmallett
  Sponsored by:	DARPA / AFRL

Modified:
  head/sys/mips/mips/pm_machdep.c

Modified: head/sys/mips/mips/pm_machdep.c
==============================================================================
--- head/sys/mips/mips/pm_machdep.c	Wed Aug 30 19:19:31 2017	(r323028)
+++ head/sys/mips/mips/pm_machdep.c	Wed Aug 30 19:21:11 2017	(r323029)
@@ -427,15 +427,12 @@ exec_setregs(struct thread *td, struct image_params *i
 	 * 0xffffffff80007f00 and the load is instead done from
 	 * 0xffffffff7ffffff0.
 	 *
-	 * To prevent this, we subtract 64K from the stack pointer here.
-	 *
-	 * For consistency, we should just always do this unless we're
-	 * running n64 programs.  For now, since we don't support
-	 * COMPAT_FREEBSD32 on n64 kernels, we just do it unless we're
-	 * running n64 kernels.
+	 * To prevent this, we subtract 64K from the stack pointer here
+	 * for processes with 32-bit pointers.
 	 */
-#if !defined(__mips_n64)
-	td->td_frame->sp -= 65536;
+#if defined(__mips_n32) || defined(__mips_n64)
+	if (!SV_PROC_FLAG(td->td_proc, SV_LP64))
+		td->td_frame->sp -= 65536;
 #endif
 
 	td->td_frame->pc = imgp->entry_addr & ~3;


More information about the svn-src-all mailing list