From f628cbdfc3d799662bd38245e9c80d01db09587f Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Mon, 8 Oct 2018 11:09:00 -0400 Subject: [PATCH] target/arm: Correct condition for v8M callee stack push In v7m_exception_taken() we were incorrectly using a "LR bit EXCRET.ES is 1" check when it should be 0 (compare the pseudocode ExceptionTaken() function). This meant we didn't stack the callee-saved registers when tailchaining from a NonSecure to a Secure exception. Backports commit 7b73a1ca05b33d42278ce29cea4652e22d408165 from qemu --- qemu/target/arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu/target/arm/helper.c b/qemu/target/arm/helper.c index 53602bea..690102bd 100644 --- a/qemu/target/arm/helper.c +++ b/qemu/target/arm/helper.c @@ -6125,7 +6125,7 @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr, bool dotailchain, * not already saved. */ if (lr & R_V7M_EXCRET_DCRS_MASK && - !(dotailchain && (lr & R_V7M_EXCRET_ES_MASK))) { + !(dotailchain && !(lr & R_V7M_EXCRET_ES_MASK))) { push_failed = v7m_push_callee_stack(cpu, lr, dotailchain, ignore_stackfaults); }