Skip to content

Commit

Permalink
objtool,x86: Teach decode about LOOP* instructions
Browse files Browse the repository at this point in the history
When 'discussing' control flow Masami mentioned the LOOP* instructions
and I realized objtool doesn't decode them properly.

As it turns out, these instructions are somewhat inefficient and as
such unlikely to be emitted by the compiler (a few vmlinux.o checks
can't find a single one) so this isn't critical, but still, best to
decode them properly.

Reported-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/Yxhd4EMKyoFoH9y4@hirez.programming.kicks-ass.net
  • Loading branch information
Peter Zijlstra committed Sep 15, 2022
1 parent 3c6f390 commit 7a7621d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/objtool/arch/x86/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,12 @@ int arch_decode_instruction(struct objtool_file *file, const struct section *sec
*type = INSN_CONTEXT_SWITCH;
break;

case 0xe0: /* loopne */
case 0xe1: /* loope */
case 0xe2: /* loop */
*type = INSN_JUMP_CONDITIONAL;
break;

case 0xe8:
*type = INSN_CALL;
/*
Expand Down

0 comments on commit 7a7621d

Please sign in to comment.