ARM: kprobes: Fix emulation of SXTB16, SXTB, SXTH, UXTB16, UXTB and UXTH instructions
These sign extension instructions are encoded as extend-and-add instructions where the register to add is specified as r15. The decoding routines weren't checking for this and were using the incorrect emulation code, giving incorrect results. Signed-off-by: Jon Medhurst <tixy@yxit.co.uk> Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
This commit is contained in:
committed by
Nicolas Pitre
parent
780b5c1162
commit
8dd7cfbed8
@@ -1390,19 +1390,29 @@ space_cccc_0110__1(kprobe_opcode_t insn, struct arch_specific_insn *asi)
|
|||||||
return prep_emulate_rd12rn16rm0_wflags(insn, asi);
|
return prep_emulate_rd12rn16rm0_wflags(insn, asi);
|
||||||
|
|
||||||
/* SXTAB16 : cccc 0110 1000 xxxx xxxx xxxx 0111 xxxx : */
|
/* SXTAB16 : cccc 0110 1000 xxxx xxxx xxxx 0111 xxxx : */
|
||||||
/* SXTB : cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx : */
|
/* SXTB16 : cccc 0110 1000 1111 xxxx xxxx 0111 xxxx : */
|
||||||
/* ??? : cccc 0110 1001 xxxx xxxx xxxx 0111 xxxx : */
|
/* ??? : cccc 0110 1001 xxxx xxxx xxxx 0111 xxxx : */
|
||||||
/* SXTAB : cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx : */
|
/* SXTAB : cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx : */
|
||||||
|
/* SXTB : cccc 0110 1010 1111 xxxx xxxx 0111 xxxx : */
|
||||||
/* SXTAH : cccc 0110 1011 xxxx xxxx xxxx 0111 xxxx : */
|
/* SXTAH : cccc 0110 1011 xxxx xxxx xxxx 0111 xxxx : */
|
||||||
|
/* SXTH : cccc 0110 1011 1111 xxxx xxxx 0111 xxxx : */
|
||||||
/* UXTAB16 : cccc 0110 1100 xxxx xxxx xxxx 0111 xxxx : */
|
/* UXTAB16 : cccc 0110 1100 xxxx xxxx xxxx 0111 xxxx : */
|
||||||
|
/* UXTB16 : cccc 0110 1100 1111 xxxx xxxx 0111 xxxx : */
|
||||||
/* ??? : cccc 0110 1101 xxxx xxxx xxxx 0111 xxxx : */
|
/* ??? : cccc 0110 1101 xxxx xxxx xxxx 0111 xxxx : */
|
||||||
/* UXTAB : cccc 0110 1110 xxxx xxxx xxxx 0111 xxxx : */
|
/* UXTAB : cccc 0110 1110 xxxx xxxx xxxx 0111 xxxx : */
|
||||||
|
/* UXTB : cccc 0110 1110 1111 xxxx xxxx 0111 xxxx : */
|
||||||
/* UXTAH : cccc 0110 1111 xxxx xxxx xxxx 0111 xxxx : */
|
/* UXTAH : cccc 0110 1111 xxxx xxxx xxxx 0111 xxxx : */
|
||||||
|
/* UXTH : cccc 0110 1111 1111 xxxx xxxx 0111 xxxx : */
|
||||||
if ((insn & 0x0f8000f0) == 0x06800070) {
|
if ((insn & 0x0f8000f0) == 0x06800070) {
|
||||||
if ((insn & 0x00300000) == 0x00100000)
|
if ((insn & 0x00300000) == 0x00100000)
|
||||||
return INSN_REJECTED; /* Unallocated space */
|
return INSN_REJECTED; /* Unallocated space */
|
||||||
|
|
||||||
|
if ((insn & 0x000f0000) == 0x000f0000) {
|
||||||
|
return prep_emulate_rd12rm0(insn, asi);
|
||||||
|
} else {
|
||||||
return prep_emulate_rd12rn16rm0_wflags(insn, asi);
|
return prep_emulate_rd12rn16rm0_wflags(insn, asi);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Other instruction encodings aren't yet defined */
|
/* Other instruction encodings aren't yet defined */
|
||||||
return INSN_REJECTED;
|
return INSN_REJECTED;
|
||||||
|
Reference in New Issue
Block a user