From patchwork Sun Jul 24 15:30:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 9244983 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EB342607FD for ; Sun, 24 Jul 2016 15:34:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBDDC2521F for ; Sun, 24 Jul 2016 15:34:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0A9A26224; Sun, 24 Jul 2016 15:34:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C3FA2521F for ; Sun, 24 Jul 2016 15:34:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752246AbcGXPa6 (ORCPT ); Sun, 24 Jul 2016 11:30:58 -0400 Received: from alt13.smtp-out.videotron.ca ([135.19.0.26]:23911 "EHLO alt12.smtp-out.videotron.ca" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752157AbcGXPal (ORCPT ); Sun, 24 Jul 2016 11:30:41 -0400 Received: from yoda.home ([96.23.157.65]) by Videotron with SMTP id RLMUbsTb5q3HFRLMVbAIVg; Sun, 24 Jul 2016 11:30:39 -0400 X-Authority-Analysis: v=2.1 cv=Q9lym9Ca c=1 sm=1 tr=0 a=keA3yYpnlypCNW5BNWqu+w==:117 a=keA3yYpnlypCNW5BNWqu+w==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=cAmyUtKerLwA:10 a=tBb2bbeoAAAA:8 a=KKAkSRfTAAAA:8 a=K4JpAEHDefzeMZtjvzcA:9 a=Oj-tNtZlA1e06AYgeCfH:22 a=cvBusfyB2V15izCimMoJ:22 Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTP id 9719A2DA06AB; Sun, 24 Jul 2016 11:30:36 -0400 (EDT) From: Nicolas Pitre To: Greg Ungerer , linux-fsdevel@vger.kernel.org Cc: Alan Cox , Alexander Viro , David Howells , linux-arm-kernel@lists.infradead.org, linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 13/15] m68k: fix bFLT executable running on MMU enabled systems Date: Sun, 24 Jul 2016 11:30:27 -0400 Message-Id: <1469374229-21585-14-git-send-email-nicolas.pitre@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1469374229-21585-1-git-send-email-nicolas.pitre@linaro.org> References: <1469374229-21585-1-git-send-email-nicolas.pitre@linaro.org> X-CMAE-Envelope: MS4wfALCiiyc11A3aXr1hzmcP/Z4AmjBnCZ+yiqjtjb7nVMnOFjTTmWrQE3SCgQglua9dHzSN0Wc/rcdAMVG8gNbruTIHioE296rjzpD4PNuRn0/WFSvyWIk WLDfJ0RepS54OUEuLiryTdjEtFAXAQvXD4giPpyrmRtVv15JU2aPURc7CpG79r+vHQ0LDzXf3j0rR4C4CBVcAF8rnLyqzh4dCv/TTEZAAoLI0JQrqbQozdRv YoHpLLFq1F7GOL5fRdimcTO1MzQItrKVErlWOubPnB2YmnXtsQRYGfTtzEEykMaSEPwPw7bnU+QQKp5MEhVEpYd9KIYFJA85UNOuY0JCkwkFNLRNBne0okOl xY7b1ooGd0b5T7Z5ojRnJXfEQSnZrPky6c/3lr+wt/kZgSb/qFpdlSZejA4I8/YGm0GauY3ILLQ/lYxTbSw0BRVrIDv2DqMKe9ipgjrSfiVS2Bu73JI= Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Greg Ungerer Even after recent changes to support running flat format executables on MMU enabled systems (by nicolas.pitre@linaro.org) they still failed to run on m68k/ColdFire MMU enabled systems. On trying to run a flat format binary the application would immediately crash with a SIGSEGV. Code to setup the D5 register with the base of the application data region was only in the non-MMU code path, so it was not being set for the MMU enabled case. Flat binaries on m68k/ColdFire use this to support GOT/PIC flat built application code. Fix this so that D5 is always setup when loading/running a bFLT executable on m68k systems. Signed-off-by: Greg Ungerer Signed-off-by: Nicolas Pitre --- arch/m68k/include/asm/flat.h | 6 ++++++ arch/m68k/include/asm/processor.h | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/m68k/include/asm/flat.h b/arch/m68k/include/asm/flat.h index f9454b89a5..f46c2f044f 100644 --- a/arch/m68k/include/asm/flat.h +++ b/arch/m68k/include/asm/flat.h @@ -18,4 +18,10 @@ static inline int flat_set_persistent(unsigned long relval, return 0; } +#define FLAT_PLAT_INIT(regs) \ + do { \ + if (current->mm) \ + (regs)->d5 = current->mm->start_data; \ + } while (0) + #endif /* __M68KNOMMU_FLAT_H__ */ diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h index a6ce2ec8d6..46672d1f4d 100644 --- a/arch/m68k/include/asm/processor.h +++ b/arch/m68k/include/asm/processor.h @@ -131,8 +131,6 @@ extern int handle_kernel_fault(struct pt_regs *regs); do { \ (_regs)->pc = (_pc); \ setframeformat(_regs); \ - if (current->mm) \ - (_regs)->d5 = current->mm->start_data; \ (_regs)->sr &= ~0x2000; \ wrusp(_usp); \ } while(0)