Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

objtool/LoongArch: Mark types based on break immediate code

If the break immediate code is 0, it should mark the type as
INSN_TRAP. If the break immediate code is 1, it should mark the
type as INSN_BUG.

While at it, format the code style and add the code comment for nop.

Cc: stable@vger.kernel.org
Suggested-by: WANG Rui <wangrui@loongson.cn>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>

authored by

Tiezhu Yang and committed by
Huacai Chen
baad7830 f83ec76b

+9 -3
+9 -3
tools/objtool/arch/loongarch/decode.c
··· 310 310 if (decode_insn_reg2i16_fomat(inst, insn)) 311 311 return 0; 312 312 313 - if (inst.word == 0) 313 + if (inst.word == 0) { 314 + /* andi $zero, $zero, 0x0 */ 314 315 insn->type = INSN_NOP; 315 - else if (inst.reg0i15_format.opcode == break_op) { 316 - /* break */ 316 + } else if (inst.reg0i15_format.opcode == break_op && 317 + inst.reg0i15_format.immediate == 0x0) { 318 + /* break 0x0 */ 319 + insn->type = INSN_TRAP; 320 + } else if (inst.reg0i15_format.opcode == break_op && 321 + inst.reg0i15_format.immediate == 0x1) { 322 + /* break 0x1 */ 317 323 insn->type = INSN_BUG; 318 324 } else if (inst.reg2_format.opcode == ertn_op) { 319 325 /* ertn */