diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-05 13:24:16 +0000 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-05 13:24:16 +0000 |
commit | a32737e1ca650504f172292dd344eb64c02311f3 (patch) | |
tree | 7dd2004ece26081507af877d9dd40b1bd4eecc1a /arch/arm/kernel/swp_emulate.c | |
parent | 27edacac7d97d37ec77779c7da08345298a5d283 (diff) | |
parent | a3c2b511a844641f6d0b60bd84cd6076143b3f2d (diff) | |
download | lwn-a32737e1ca650504f172292dd344eb64c02311f3.tar.gz lwn-a32737e1ca650504f172292dd344eb64c02311f3.zip |
Merge branches 'fixes' and 'misc' into for-linus
Diffstat (limited to 'arch/arm/kernel/swp_emulate.c')
-rw-r--r-- | arch/arm/kernel/swp_emulate.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/arm/kernel/swp_emulate.c b/arch/arm/kernel/swp_emulate.c index 5f452f8fde05..df745188f5de 100644 --- a/arch/arm/kernel/swp_emulate.c +++ b/arch/arm/kernel/swp_emulate.c @@ -25,6 +25,7 @@ #include <linux/syscalls.h> #include <linux/perf_event.h> +#include <asm/opcodes.h> #include <asm/traps.h> #include <asm/uaccess.h> @@ -185,6 +186,21 @@ 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 */ + return -EFAULT; + default: + return -EINVAL; + } + if (current->pid != previous_pid) { pr_debug("\"%s\" (%ld) uses deprecated SWP{B} instruction\n", current->comm, (unsigned long)current->pid); |