Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1693875
| From | Marc Zyngier <marc.zyngier@arm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 09/16] ARM: Check condition code before trying to handle an UNDEF |
| Date | 2017-07-21 19:20 +0200 |
| Message-ID | <u5JKN-7DO-5@gated-at.bofh.it> (permalink) |
| References | <u5JKN-7DO-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
As indicated in the ARMv7 ARM in B1.9.2, an instruction that
would cause an UNDEF can trap even if it fails its condition
code. Yes, this is annoying.
Add a arm_check_condition call before trying to handle an
UNDEF, and move the PC by the right amount if the condition
check fails.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/kernel/traps.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 948c648fea00..ca51e80a60b6 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -462,6 +462,19 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
instr = __mem_to_opcode_arm(instr);
}
+ /*
+ * An UNDEF is allowed to trap even when failing its condition
+ * code (see B1.9.2 in the ARMv7 ARM).
+ */
+ if (arm_check_condition(instr, regs->ARM_cpsr) == ARM_OPCODE_CONDTEST_FAIL) {
+ if (thumb_mode(regs) && !is_wide_instruction(instr))
+ regs->ARM_pc += 2;
+ else
+ regs->ARM_pc +=4;
+
+ return;
+ }
+
if (call_undef_hook(regs, instr) == 0)
return;
--
2.11.0
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 09/16] ARM: Check condition code before trying to handle an UNDEF Marc Zyngier <marc.zyngier@arm.com> - 2017-07-21 19:20 +0200
csiph-web