Skip to content

Commit 4559019

Browse files
Russell King - ARM LinuxHinnerk van Bruinehsen
Russell King - ARM Linux
authored and
Hinnerk van Bruinehsen
committed
ARM: VFP: fix emulation of second VFP instruction
Martin Storsjö reports that the sequence: ee312ac1 vsub.f32 s4, s3, s2 ee702ac0 vsub.f32 s5, s1, s0 e59f0028 ldr r0, [pc, raspberrypi#40] ee111a90 vmov r1, s3 on Raspberry Pi (implementor 41 architecture 1 part 20 variant b rev 5) where s3 is a denormal and s2 is zero results in incorrect behaviour - the instruction "vsub.f32 s5, s1, s0" is not executed: VFP: bounce: trigger ee111a90 fpexc d0000780 VFP: emulate: INST=0xee312ac1 SCR=0x00000000 ... As we can see, the instruction triggering the exception is the "vmov" instruction, and we emulate the "vsub.f32 s4, s3, s2" but fail to properly take account of the FPEXC_FP2V flag in FPEXC. This is because the test for the second instruction register being valid is bogus, and will always skip emulation of the second instruction. Cc: <[email protected]> Reported-by: Martin Storsjö <[email protected]> Tested-by: Martin Storsjö <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent a056237 commit 4559019

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arm/vfp/vfpmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ void VFP_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs)
413413
* If there isn't a second FP instruction, exit now. Note that
414414
* the FPEXC.FP2V bit is valid only if FPEXC.EX is 1.
415415
*/
416-
if (fpexc ^ (FPEXC_EX | FPEXC_FP2V))
416+
if ((fpexc & (FPEXC_EX | FPEXC_FP2V)) != (FPEXC_EX | FPEXC_FP2V))
417417
goto exit;
418418

419419
/*

0 commit comments

Comments
 (0)