@@ -286,10 +286,10 @@ static void register_insn_emulation_sysctl(struct ctl_table *table)
CONFIG_ARM64_PAN) \
"0: ldxr"B" %w2, [%3]\n" \
"1: stxr"B" %w0, %w1, [%3]\n" \
- " cbz %w0, 2f\n" \
- " mov %w0, %w4\n" \
+ " cmp %w0, #0\n" \
+ " csel %w0, %w4, wzr, ne\n" \
+ " csel %w1, %w2, %w1, eq\n" \
"2:\n" \
- " mov %w1, %w2\n" \
" .pushsection .fixup,\"ax\"\n" \
" .align 2\n" \
"3: mov %w0, %w5\n" \
@@ -303,7 +303,7 @@ static void register_insn_emulation_sysctl(struct ctl_table *table)
ALTERNATIVE("nop", SET_PSTATE_PAN(1), ARM64_HAS_PAN, \
CONFIG_ARM64_PAN) \
: "=&r" (res), "+r" (data), "=&r" (temp) \
- : "r" (addr), "i" (-EAGAIN), "i" (-EFAULT) \
+ : "r" (addr), "r" (-EAGAIN), "i" (-EFAULT) \
: "memory")
#define __user_swp_asm(data, addr, res, temp) \
@@ -342,7 +342,7 @@ static void set_segfault(struct pt_regs *regs, unsigned long addr)
static int emulate_swpX(unsigned int address, unsigned int *data,
unsigned int type)
{
- unsigned int res = 0;
+ unsigned int res;
if ((type != TYPE_SWPB) && (address & 0x3)) {
/* SWP to unaligned address not permitted */