From: Jisheng Zhang <jszhang@kernel.org>
To: Russell King <linux@armlinux.org.uk>,
Vladimir Murzin <vladimir.murzin@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ARM: NOMMU: Fix exc_ret for stack frame type
Date: Sun, 13 Oct 2024 21:25:20 +0800 [thread overview]
Message-ID: <20241013132520.2848-1-jszhang@kernel.org> (raw)
commit 72cd4064fcca ("ARM: 8830/1: NOMMU: Toggle only bits in
EXC_RETURN we are really care of") only sets BIT[3] for Thread mode
and BIT[2] for PSP, it leaves BIT[4] untouched. But there's such a
case: the pre-linux env makes use of FPU then the BIT[4] in 'lr' is
cleared, this brings an umatch issue since the NOMMU kernel doesn't
support FPU yet. Before the above commit, we hardcode the exc_ret
as 0xfffffffd, so the flow works fine.
Fix this issue by explicitly set BIT[4] which means using standard
stack frame.
Fixes: 72cd4064fcca ("ARM: 8830/1: NOMMU: Toggle only bits in EXC_RETURN we are really care of")
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
arch/arm/include/asm/v7m.h | 1 +
arch/arm/mm/proc-v7m.S | 1 +
2 files changed, 2 insertions(+)
diff --git a/arch/arm/include/asm/v7m.h b/arch/arm/include/asm/v7m.h
index 4512f7e1918f..3aea6d3c97ee 100644
--- a/arch/arm/include/asm/v7m.h
+++ b/arch/arm/include/asm/v7m.h
@@ -51,6 +51,7 @@
*/
#define EXC_RET_STACK_MASK 0x00000004
#define EXC_RET_THREADMODE_PROCESSSTACK (3 << 2)
+#define EXC_RET_FTYPE (1 << 4)
/* Cache related definitions */
diff --git a/arch/arm/mm/proc-v7m.S b/arch/arm/mm/proc-v7m.S
index ed7781c84341..fdae077d2654 100644
--- a/arch/arm/mm/proc-v7m.S
+++ b/arch/arm/mm/proc-v7m.S
@@ -138,6 +138,7 @@ __v7m_setup_cont:
1: cpsid i
/* Calculate exc_ret */
orr r10, lr, #EXC_RET_THREADMODE_PROCESSSTACK
+ orr r10, #EXC_RET_FTYPE
ldmia sp, {r0-r3, r12}
str r5, [r12, #11 * 4] @ restore the original SVC vector entry
mov lr, r6 @ restore LR
--
2.45.2
next reply other threads:[~2024-10-13 13:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-13 13:25 Jisheng Zhang [this message]
2024-10-14 9:54 ` [PATCH] ARM: NOMMU: Fix exc_ret for stack frame type Vladimir Murzin
2024-10-15 0:02 ` Jisheng Zhang
2024-10-22 10:37 ` Vladimir Murzin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241013132520.2848-1-jszhang@kernel.org \
--to=jszhang@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=vladimir.murzin@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.