Skip to content

Commit baad783

Browse files
seehearfeelchenhuacai
authored andcommitted
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>
1 parent f83ec76 commit baad783

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

tools/objtool/arch/loongarch/decode.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,16 @@ int arch_decode_instruction(struct objtool_file *file, const struct section *sec
310310
if (decode_insn_reg2i16_fomat(inst, insn))
311311
return 0;
312312

313-
if (inst.word == 0)
313+
if (inst.word == 0) {
314+
/* andi $zero, $zero, 0x0 */
314315
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 */
317323
insn->type = INSN_BUG;
318324
} else if (inst.reg2_format.opcode == ertn_op) {
319325
/* ertn */

0 commit comments

Comments
 (0)