From owner-svn-src-all@freebsd.org Wed Aug 30 19:21:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39433E08551; Wed, 30 Aug 2017 19:21:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 089287C62E; Wed, 30 Aug 2017 19:21:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7UJLCxY086398; Wed, 30 Aug 2017 19:21:12 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7UJLCpj086397; Wed, 30 Aug 2017 19:21:12 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201708301921.v7UJLCpj086397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 30 Aug 2017 19:21:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323029 - head/sys/mips/mips X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/mips/mips X-SVN-Commit-Revision: 323029 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Aug 2017 19:21:13 -0000 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;