Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1693885 > unrolled thread

[PATCH 12/16] ARM: Simplify condition checks in swp_handler

Started byMarc Zyngier <marc.zyngier@arm.com>
First post2017-07-21 19:20 +0200
Last post2017-07-21 19:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 12/16] ARM: Simplify condition checks in swp_handler Marc Zyngier <marc.zyngier@arm.com> - 2017-07-21 19:20 +0200

#1693885 — [PATCH 12/16] ARM: Simplify condition checks in swp_handler

FromMarc Zyngier <marc.zyngier@arm.com>
Date2017-07-21 19:20 +0200
Subject[PATCH 12/16] ARM: Simplify condition checks in swp_handler
Message-ID<u5JKO-7DO-33@gated-at.bofh.it>
We now check the validity of the condition code before calling
the UNDEF handlers, so we can simplify swp_handler by only
checking for ARM_OPCODE_CONDTEST_UNCOND, which indicates that
this is not a SWP instruction.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm/kernel/swp_emulate.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/arch/arm/kernel/swp_emulate.c b/arch/arm/kernel/swp_emulate.c
index 3bda08bee674..2683c559e0ff 100644
--- a/arch/arm/kernel/swp_emulate.c
+++ b/arch/arm/kernel/swp_emulate.c
@@ -179,20 +179,9 @@ static int swp_handler(struct pt_regs *regs, unsigned int instr)
 
 	perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, regs->ARM_pc);
 
-	res = arm_check_condition(instr, regs->ARM_cpsr);
-	switch (res) {
-	case ARM_OPCODE_CONDTEST_PASS:
-		break;
-	case ARM_OPCODE_CONDTEST_FAIL:
-		/* Condition failed - return to next instruction */
-		regs->ARM_pc += 4;
-		return 0;
-	case ARM_OPCODE_CONDTEST_UNCOND:
-		/* If unconditional encoding - not a SWP, undef */
+	/* If unconditional encoding - not a SWP, undef */
+	if (arm_check_condition(instr, regs->ARM_cpsr) == ARM_OPCODE_CONDTEST_UNCOND)
 		return -EFAULT;
-	default:
-		return -EINVAL;
-	}
 
 	if (current->pid != previous_pid) {
 		pr_debug("\"%s\" (%ld) uses deprecated SWP{B} instruction\n",
-- 
2.11.0

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web