From patchwork Mon Oct 15 22:16:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 10642511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 830CD157A for ; Mon, 15 Oct 2018 22:17:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B5E4283A5 for ; Mon, 15 Oct 2018 22:17:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CA4E299AA; Mon, 15 Oct 2018 22:17:03 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CDAC2283A5 for ; Mon, 15 Oct 2018 22:17:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Nt5ZLzmFBQjcbBRyHljwDLKO6Wp7HNpQHf9Pk369J+U=; b=Lo3tKPLYh+W5nR xK2cEMDGKJWgzqoQ2+yBP6k54Eevq2Lugp/fxEeVb0jwE/MK8ZI2vWtnTmtcbzbcA+yxOJqDpuM5r 3t47P6fquSR4VwNp4RunCxOc2vaTrYWKdYKOPaCPxe+aep0MdH3B8ZeGqjTHKsKXv08j1o6D8WJnE DlDmbiLMnakQspnLtSQWWEmQ40fCa12YmeQrOZL4aEdf06d/qKmHfiq+4UZCvtw2Ljfa3mQMb4Idy P7Od2BeD9nlmBqtDaARB+r2ujd9ZnrFTGGmj3dk3ZW7IdehnEEwrNJpb16nqryNHYqDyn7LkNXs6R sM0dgE8nBe+5wXZ8zRfQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gCBAW-0005my-Qh; Mon, 15 Oct 2018 22:16:56 +0000 Received: from mail.kmu-office.ch ([2a02:418:6a02::a2]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gCBAS-0005kp-Md for linux-arm-kernel@lists.infradead.org; Mon, 15 Oct 2018 22:16:54 +0000 Received: from trochilidae.toradex.int (unknown [IPv6:2a02:169:3460::525]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 9E3EB5C0106; Tue, 16 Oct 2018 00:16:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1539641798; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=M6JmEVCtUnq7D+ti0w3NkBGcNYQiCg6j51cuvLvMpH8=; b=BYfuLSJy1GSO3z8/vmtk9X9mCacyD9ZRyQ+k+W5NRZUQDr009VRB8n9gldKj26RYA+JSx1 Wk4zkn3L79ZlSGYE4j1hWx9yiTOEwzWZT7RQT8eXUzkzJRPX/GoGevM4qO3SXWtO82mGMH cisISckofZSxqTTZrAGVJA0J+bBs53c= From: Stefan Agner To: linux@armlinux.org.uk, ulli.kroll@googlemail.com Subject: [PATCH 1/2] ARM: copypage-fa: add kto and kfrom to input operands list Date: Tue, 16 Oct 2018 00:16:29 +0200 Message-Id: <20181015221629.13924-1-stefan@agner.ch> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-Spam: Yes X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181015_151652_889684_5071FD89 X-CRM114-Status: GOOD ( 11.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: arnd@arndb.de, nico@linaro.org, linus.walleij@linaro.org, linux-kernel@vger.kernel.org, Stefan Agner , joel@jms.id.au, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When functions incoming parameters are not in input operands list gcc 4.5 does not load the parameters into registers before calling this function but the inline assembly assumes valid addresses inside this function. This breaks the code because r0 and r1 are invalid when execution enters v4wb_copy_user_page () Also the constant needs to be used as third input operand so account for that as well. This fixes copypage-fa.c what has previously done before for the other copypage implementations in commit 9a40ac86152c ("ARM: 6164/1: Add kto and kfrom to input operands list."). Signed-off-by: Stefan Agner Signed-off-by: Nicolas Pitre Tested-by: Stefan Agner Signed-off-by: Nicolas Pitre Reviewed-by: Stefan Agner --- arch/arm/mm/copypage-fa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mm/copypage-fa.c b/arch/arm/mm/copypage-fa.c index d130a5ece5d5..ec6501308c60 100644 --- a/arch/arm/mm/copypage-fa.c +++ b/arch/arm/mm/copypage-fa.c @@ -22,7 +22,7 @@ fa_copy_user_page(void *kto, const void *kfrom) { asm("\ stmfd sp!, {r4, lr} @ 2\n\ - mov r2, %0 @ 1\n\ + mov r2, %2 @ 1\n\ 1: ldmia r1!, {r3, r4, ip, lr} @ 4\n\ stmia r0, {r3, r4, ip, lr} @ 4\n\ mcr p15, 0, r0, c7, c14, 1 @ 1 clean and invalidate D line\n\ @@ -36,7 +36,7 @@ fa_copy_user_page(void *kto, const void *kfrom) mcr p15, 0, r2, c7, c10, 4 @ 1 drain WB\n\ ldmfd sp!, {r4, pc} @ 3" : - : "I" (PAGE_SIZE / 32)); + : "r" (kto), "r" (kfrom), "I" (PAGE_SIZE / 32)); } void fa_copy_user_highpage(struct page *to, struct page *from, From patchwork Mon Oct 15 22:26:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 10642527 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 64AE4112B for ; Mon, 15 Oct 2018 22:26:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4CF1B298DE for ; Mon, 15 Oct 2018 22:26:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3FA47298F5; Mon, 15 Oct 2018 22:26:58 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6A9A2298DE for ; Mon, 15 Oct 2018 22:26:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=/SwII3dJ3iFTyS1q8v50Bqg6PCDykObmysY4YO8xJU4=; b=TkEpOYaf+MDozr NpzSA1CFl4kvSCHN5G0j0cqWIRntAPBvchuOM6f9vd8OVGieX8b30jnOs3Yud8G6Jjp4Z9jBr/213 gFPD3onN9jeeY7ThiagujPBn0w0MslXJGO2eBu4VWeO4mNOBN8JMF8FEelpesGt2o+Tid1X3EN+Vs 2JMKwL0zMa4ZSKEQG7szUvciqqOObyvdQs07Kns1RD46MgIPqQ7hmt1uqrHkSv0vmSOQ1ubu02Cp1 YSww+CgyvqLPiA/+6RxQcFj9u3dmND61BARQC2mvPr+3GSmrMkhXMOfwpUvkXVWXW4zxwWFirjJup iMNueXTGTxV1vWKl0g/A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gCBK2-0002Np-5b; Mon, 15 Oct 2018 22:26:46 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gCBJy-0002Nf-5x for linux-arm-kernel@bombadil.infradead.org; Mon, 15 Oct 2018 22:26:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=CPOYv+dAi1polkXs360FUJXuFjcZ5cQj+Pt76m/rcLc=; b=Wx/aGDyt4VN658SuEAiGm7+EQQ Il9dqJTPy3q0xZoXugiVjnFR0akydAWxMaL0g5RBOF1lA1OdCTwB3IMRNDBiCvxPC/VbbSMlM4nbQ FEIsFXhnSFUpCNVqA/sGTJw/p25N9naVm3cJYEBeIaySm2uIacPVpa9D263Nyx0FQmxiSBe7jTphl eQ97h4+glQpN9iP7YtQRrMp24rqQTJ3UuykDb9A16JaO64yKNlWCRmsF3RuhGNZhrWNIdFEPQ4B0i 2uHA+NUpFspORisq+2RNxCkQxHNWcN7+qtMwKYTUGw+yZVW9v6MzzLxzp4Hg3ZxQzZ7oM3JT1wmHO 5kxNwt6A==; Received: from mail.kmu-office.ch ([2a02:418:6a02::a2]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gCBJu-0006rC-67 for linux-arm-kernel@lists.infradead.org; Mon, 15 Oct 2018 22:26:40 +0000 Received: from trochilidae.toradex.int (unknown [IPv6:2a02:169:3460::525]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 5B86C5C0072; Tue, 16 Oct 2018 00:26:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1539642385; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=CPOYv+dAi1polkXs360FUJXuFjcZ5cQj+Pt76m/rcLc=; b=wPgzLXsQRhJ7d+WhiKqwjUJbMrC/nUe94wfO0V2bJrG8D58J3UkWK3rqCkbxrJqZo1VIOC fcKCJrjobHqrs/DC+PJe7GdoSaKbX+Mf+C1Yb3x7sqSSgmF8+ExjIZrsOZBWINxbW7zD5I I2PZW2RxO7/20JZlCIGQiyhpHdgEV44= From: Stefan Agner To: linux@armlinux.org.uk, ulli.kroll@googlemail.com Subject: [PATCH 2/2] ARM: copypage: do not use naked functions Date: Tue, 16 Oct 2018 00:26:21 +0200 Message-Id: <20181015222621.14673-1-stefan@agner.ch> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-Spam: Yes X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181015_232638_307916_3CDAA456 X-CRM114-Status: GOOD ( 13.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: arnd@arndb.de, nico@linaro.org, linus.walleij@linaro.org, linux-kernel@vger.kernel.org, Stefan Agner , joel@jms.id.au, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP GCC documentation says naked functions should only use basic ASM syntax. The extended ASM or mixture of basic ASM and "C" code is not guaranteed. Currently it seems to work though. Furthermore with Clang using parameters in extended asm in a naked function is not supported: arch/arm/mm/copypage-v4wb.c:47:9: error: parameter references not allowed in naked functions : "r" (kto), "r" (kfrom), "I" (PAGE_SIZE / 64)); ^ Use a regular function to be more portable. Also use volatile asm to avoid unsolicited optimizations. Tested with qemu versatileab machine and versatile_defconfig and qemu mainstone machine using pxa_defconfig compiled with GCC 7.2.1 and Clang 7.0. Link: https://github.com/ClangBuiltLinux/linux/issues/90 Reported-by: Joel Stanley Signed-off-by: Stefan Agner --- arch/arm/mm/copypage-fa.c | 17 +++++++++++------ arch/arm/mm/copypage-feroceon.c | 17 +++++++++++------ arch/arm/mm/copypage-v4mc.c | 14 +++++++++----- arch/arm/mm/copypage-v4wb.c | 17 +++++++++++------ arch/arm/mm/copypage-v4wt.c | 17 +++++++++++------ arch/arm/mm/copypage-xsc3.c | 17 +++++++++++------ arch/arm/mm/copypage-xscale.c | 13 ++++++++----- 7 files changed, 72 insertions(+), 40 deletions(-) diff --git a/arch/arm/mm/copypage-fa.c b/arch/arm/mm/copypage-fa.c index ec6501308c60..33ccd396bf99 100644 --- a/arch/arm/mm/copypage-fa.c +++ b/arch/arm/mm/copypage-fa.c @@ -17,11 +17,16 @@ /* * Faraday optimised copy_user_page */ -static void __naked -fa_copy_user_page(void *kto, const void *kfrom) +static void fa_copy_user_page(void *kto, const void *kfrom) { - asm("\ - stmfd sp!, {r4, lr} @ 2\n\ + register void *r0 asm("r0") = kto; + register const void *r1 asm("r1") = kfrom; + + asm( + __asmeq("%0", "r0") + __asmeq("%1", "r1") + "\ + stmfd sp!, {r4} @ 2\n\ mov r2, %2 @ 1\n\ 1: ldmia r1!, {r3, r4, ip, lr} @ 4\n\ stmia r0, {r3, r4, ip, lr} @ 4\n\ @@ -34,9 +39,9 @@ fa_copy_user_page(void *kto, const void *kfrom) subs r2, r2, #1 @ 1\n\ bne 1b @ 1\n\ mcr p15, 0, r2, c7, c10, 4 @ 1 drain WB\n\ - ldmfd sp!, {r4, pc} @ 3" + ldmfd sp!, {r4} @ 3" : - : "r" (kto), "r" (kfrom), "I" (PAGE_SIZE / 32)); + : "r" (r0), "r" (r1), "I" (PAGE_SIZE / 32)); } void fa_copy_user_highpage(struct page *to, struct page *from, diff --git a/arch/arm/mm/copypage-feroceon.c b/arch/arm/mm/copypage-feroceon.c index 49ee0c1a7209..71c3b938493a 100644 --- a/arch/arm/mm/copypage-feroceon.c +++ b/arch/arm/mm/copypage-feroceon.c @@ -13,11 +13,16 @@ #include #include -static void __naked -feroceon_copy_user_page(void *kto, const void *kfrom) +static void feroceon_copy_user_page(void *kto, const void *kfrom) { - asm("\ - stmfd sp!, {r4-r9, lr} \n\ + register void *r0 asm("r0") = kto; + register const void *r1 asm("r1") = kfrom; + + asm volatile( + __asmeq("%0", "r0") + __asmeq("%1", "r1") + "\ + stmfd sp!, {r4-r9} \n\ mov ip, %2 \n\ 1: mov lr, r1 \n\ ldmia r1!, {r2 - r9} \n\ @@ -62,9 +67,9 @@ feroceon_copy_user_page(void *kto, const void *kfrom) add r0, r0, #32 \n\ bne 1b \n\ mcr p15, 0, ip, c7, c10, 4 @ drain WB\n\ - ldmfd sp!, {r4-r9, pc}" + ldmfd sp!, {r4-r9}" : - : "r" (kto), "r" (kfrom), "I" (PAGE_SIZE)); + : "r" (r0), "r" (r1), "I" (PAGE_SIZE)); } void feroceon_copy_user_highpage(struct page *to, struct page *from, diff --git a/arch/arm/mm/copypage-v4mc.c b/arch/arm/mm/copypage-v4mc.c index 0224416cba3c..85a81bc67912 100644 --- a/arch/arm/mm/copypage-v4mc.c +++ b/arch/arm/mm/copypage-v4mc.c @@ -40,11 +40,15 @@ static DEFINE_RAW_SPINLOCK(minicache_lock); * instruction. If your processor does not supply this, you have to write your * own copy_user_highpage that does the right thing. */ -static void __naked -mc_copy_user_page(void *from, void *to) +static void mc_copy_user_page(void *from, void *to) { + register void *r0 asm("r0") = from; + register void *r1 asm("r1") = to; + asm volatile( - "stmfd sp!, {r4, lr} @ 2\n\ + __asmeq("%0", "r0") + __asmeq("%1", "r1") + "stmfd sp!, {r4} @ 2\n\ mov r4, %2 @ 1\n\ ldmia %0!, {r2, r3, ip, lr} @ 4\n\ 1: mcr p15, 0, %1, c7, c6, 1 @ 1 invalidate D line\n\ @@ -59,9 +63,9 @@ mc_copy_user_page(void *from, void *to) stmia %1!, {r2, r3, ip, lr} @ 4\n\ ldmneia %0!, {r2, r3, ip, lr} @ 4\n\ bne 1b @ 1\n\ - ldmfd sp!, {r4, pc} @ 3" + ldmfd sp!, {r4} @ 3" : - : "r" (from), "r" (to), "I" (PAGE_SIZE / 64)); + : "r" (r0), "r" (r1), "I" (PAGE_SIZE / 64)); } void v4_mc_copy_user_highpage(struct page *to, struct page *from, diff --git a/arch/arm/mm/copypage-v4wb.c b/arch/arm/mm/copypage-v4wb.c index 067d0fdd630c..dd518bf30a97 100644 --- a/arch/arm/mm/copypage-v4wb.c +++ b/arch/arm/mm/copypage-v4wb.c @@ -22,11 +22,16 @@ * instruction. If your processor does not supply this, you have to write your * own copy_user_highpage that does the right thing. */ -static void __naked -v4wb_copy_user_page(void *kto, const void *kfrom) +static void v4wb_copy_user_page(void *kto, const void *kfrom) { - asm("\ - stmfd sp!, {r4, lr} @ 2\n\ + register void *r0 asm("r0") = kto; + register const void *r1 asm("r1") = kfrom; + + asm volatile( + __asmeq("%0", "r0") + __asmeq("%1", "r1") + "\ + stmfd sp!, {r4} @ 2\n\ mov r2, %2 @ 1\n\ ldmia r1!, {r3, r4, ip, lr} @ 4\n\ 1: mcr p15, 0, r0, c7, c6, 1 @ 1 invalidate D line\n\ @@ -42,9 +47,9 @@ v4wb_copy_user_page(void *kto, const void *kfrom) ldmneia r1!, {r3, r4, ip, lr} @ 4\n\ bne 1b @ 1\n\ mcr p15, 0, r1, c7, c10, 4 @ 1 drain WB\n\ - ldmfd sp!, {r4, pc} @ 3" + ldmfd sp!, {r4} @ 3" : - : "r" (kto), "r" (kfrom), "I" (PAGE_SIZE / 64)); + : "r" (r0), "r" (r1), "I" (PAGE_SIZE / 64)); } void v4wb_copy_user_highpage(struct page *to, struct page *from, diff --git a/arch/arm/mm/copypage-v4wt.c b/arch/arm/mm/copypage-v4wt.c index b85c5da2e510..d397ac123300 100644 --- a/arch/arm/mm/copypage-v4wt.c +++ b/arch/arm/mm/copypage-v4wt.c @@ -20,11 +20,16 @@ * dirty data in the cache. However, we do have to ensure that * subsequent reads are up to date. */ -static void __naked -v4wt_copy_user_page(void *kto, const void *kfrom) +static void v4wt_copy_user_page(void *kto, const void *kfrom) { - asm("\ - stmfd sp!, {r4, lr} @ 2\n\ + register void *r0 asm("r0") = kto; + register const void *r1 asm("r1") = kfrom; + + asm volatile( + __asmeq("%0", "r0") + __asmeq("%1", "r1") + "\ + stmfd sp!, {r4} @ 2\n\ mov r2, %2 @ 1\n\ ldmia r1!, {r3, r4, ip, lr} @ 4\n\ 1: stmia r0!, {r3, r4, ip, lr} @ 4\n\ @@ -38,9 +43,9 @@ v4wt_copy_user_page(void *kto, const void *kfrom) ldmneia r1!, {r3, r4, ip, lr} @ 4\n\ bne 1b @ 1\n\ mcr p15, 0, r2, c7, c7, 0 @ flush ID cache\n\ - ldmfd sp!, {r4, pc} @ 3" + ldmfd sp!, {r4} @ 3" : - : "r" (kto), "r" (kfrom), "I" (PAGE_SIZE / 64)); + : "r" (r0), "r" (r1), "I" (PAGE_SIZE / 64)); } void v4wt_copy_user_highpage(struct page *to, struct page *from, diff --git a/arch/arm/mm/copypage-xsc3.c b/arch/arm/mm/copypage-xsc3.c index 03a2042aced5..6a60465b52e1 100644 --- a/arch/arm/mm/copypage-xsc3.c +++ b/arch/arm/mm/copypage-xsc3.c @@ -29,11 +29,16 @@ * if we eventually end up using our copied page. * */ -static void __naked -xsc3_mc_copy_user_page(void *kto, const void *kfrom) +static void xsc3_mc_copy_user_page(void *kto, const void *kfrom) { - asm("\ - stmfd sp!, {r4, r5, lr} \n\ + register void *r0 asm("r0") = kto; + register const void *r1 asm("r1") = kfrom; + + asm volatile( + __asmeq("%0", "r0") + __asmeq("%1", "r1") + "\ + stmfd sp!, {r4, r5} \n\ mov lr, %2 \n\ \n\ pld [r1, #0] \n\ @@ -65,9 +70,9 @@ xsc3_mc_copy_user_page(void *kto, const void *kfrom) bgt 1b \n\ beq 2b \n\ \n\ - ldmfd sp!, {r4, r5, pc}" + ldmfd sp!, {r4, r5}" : - : "r" (kto), "r" (kfrom), "I" (PAGE_SIZE / 64 - 1)); + : "r" (r0), "r" (r1), "I" (PAGE_SIZE / 64 - 1)); } void xsc3_mc_copy_user_highpage(struct page *to, struct page *from, diff --git a/arch/arm/mm/copypage-xscale.c b/arch/arm/mm/copypage-xscale.c index 97972379f4d6..e508e99311a0 100644 --- a/arch/arm/mm/copypage-xscale.c +++ b/arch/arm/mm/copypage-xscale.c @@ -36,15 +36,18 @@ static DEFINE_RAW_SPINLOCK(minicache_lock); * Dcache aliasing issue. The writes will be forwarded to the write buffer, * and merged as appropriate. */ -static void __naked -mc_copy_user_page(void *from, void *to) +static void mc_copy_user_page(void *from, void *to) { + register void *r0 asm("r0") = from; + register void *r1 asm("r1") = to; /* * Strangely enough, best performance is achieved * when prefetching destination as well. (NP) */ asm volatile( - "stmfd sp!, {r4, r5, lr} \n\ + __asmeq("%0", "r0") + __asmeq("%1", "r1") + "stmfd sp!, {r4, r5} \n\ mov lr, %2 \n\ pld [r0, #0] \n\ pld [r0, #32] \n\ @@ -79,9 +82,9 @@ mc_copy_user_page(void *from, void *to) mcr p15, 0, ip, c7, c6, 1 @ invalidate D line\n\ bgt 1b \n\ beq 2b \n\ - ldmfd sp!, {r4, r5, pc} " + ldmfd sp!, {r4, r5} " : - : "r" (from), "r" (to), "I" (PAGE_SIZE / 64 - 1)); + : "r" (r0), "r" (r1), "I" (PAGE_SIZE / 64 - 1)); } void xscale_mc_copy_user_highpage(struct page *to, struct page *from,