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
This commit is contained in:
John Baldwin 2017-08-30 19:21:11 +00:00
parent e896328044
commit b8b3a64000
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=323029

View File

@ -427,15 +427,12 @@ exec_setregs(struct thread *td, struct image_params *imgp, u_long stack)
* 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;