Skip to contentSkip to conversation

ARM: Correct the FPSCR bits setting when raising exceptions

PATCH New Catalin Marinas 2 participants 3 messages Jan 28, 2010 – Feb 5, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: Correct the FPSCR bits setting when raising exceptions

Commit c98929c07a removed the clearing of the FPSCR[31:28] bits from the vfp_raise_exceptions() function and the new bits are or'ed with the old FPSCR bits leading to unexpected results (the original commit was referring to the cumulative bits - FPSCR[4:0]).

---
 arch/arm/vfp/vfpmodule.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/arm/vfp/vfpmodule.c +4 -1
index f60a540..a63c4be 100644
@@ -197,10 +197,13 @@ static void vfp_raise_exceptions(u32 exceptions, u32 inst, u32 fpscr, struct pt_
 	}
 
 	/*
-	 * Update the FPSCR with the additional exception flags.
+	 * If any of the status flags are set, update the FPSCR.
 	 * Comparison instructions always return at least one of
 	 * these flags set.
 	 */
+	if (exceptions & (FPSCR_N|FPSCR_Z|FPSCR_C|FPSCR_V))
+		fpscr &= ~(FPSCR_N|FPSCR_Z|FPSCR_C|FPSCR_V);
+
 	fpscr |= exceptions;
 
 	fmxr(FPSCR, fpscr);
#1 lore raw

PATCH 1/1 ARM: Correct the FPSCR bits setting when raising exceptions

Quoted 5 lines · Catalin Marinas

Commit c98929c07a removed the clearing of the FPSCR[31:28] bits from the vfp_raise_exceptions() function and the new bits are or'ed with the old FPSCR bits leading to unexpected results (the original commit was referring to the cumulative bits - FPSCR[4:0]).

What's the status of this patch? Looks like a sane fix to me and apparently it seems Marvell cores are confused without this already.

#2 lore raw

PATCH 1/1 ARM: Correct the FPSCR bits setting when raising exceptions

Quoted 10 lines · Eric Miao
Quoted 5 lines · Catalin Marinas

Commit c98929c07a removed the clearing of the FPSCR[31:28] bits from the vfp_raise_exceptions() function and the new bits are or'ed with the old FPSCR bits leading to unexpected results (the original commit was referring to the cumulative bits - FPSCR[4:0]).

What's the status of this patch? Looks like a sane fix to me and apparently it seems Marvell cores are confused without this already.

It was accepted by Russell and queued for mainline (patch 5909/1).

Signature · 1 line
Catalin