[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LSU.2.21.2004241606230.11941@pobox.suse.cz>
Date: Fri, 24 Apr 2020 16:07:33 +0200 (CEST)
From: Miroslav Benes <mbenes@...e.cz>
To: Peter Zijlstra <peterz@...radead.org>
cc: jpoimboe@...hat.com, alexandre.chartre@...cle.com,
linux-kernel@...r.kernel.org, jthierry@...hat.com,
tglx@...utronix.de, x86@...nel.org
Subject: Re: [PATCH 4/8] objtool: Add support for intra-function calls
> ---
>
> diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
> index 6340ea0dd527..be6520155cfd 100644
> --- a/tools/objtool/arch/x86/decode.c
> +++ b/tools/objtool/arch/x86/decode.c
> @@ -100,6 +100,7 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
> rex_x = 0, modrm = 0, modrm_mod = 0, modrm_rm = 0,
> modrm_reg = 0, sib = 0;
> struct stack_op *op = NULL;
> + struct symbol *sym;
>
> x86_64 = is_x86_64(elf);
> if (x86_64 == -1)
> @@ -496,22 +497,24 @@ int arch_decode_instruction(const struct elf *elf, const struct section *sec,
> *type = INSN_RETURN;
> break;
>
> - case 0xcf: /* iret */
> - *type = INSN_EXCEPTION_RETURN;
> -
> - ADD_OP(op) {
> - /* add $40, %rsp */
> - op->src.type = OP_SRC_ADD;
> - op->src.reg = CFI_SP;
> - op->src.offset = 5*8;
> - op->dest.type = OP_DEST_REG;
> - op->dest.reg = CFI_SP;
> - }
> - break;
> -
> case 0xca: /* retf */
> case 0xcb: /* retf */
> + case 0xcf: /* iret */
> *type = INSN_CONTEXT_SWITCH;
> +
> + sym = find_symbol_by_offset(sec, offset);
sym = find_symbol_containing(sec, offset);
of course
> + if (sym && sym->type == STT_FUNC) {
> + *type = INSN_OTHER;
> +
> + ADD_OP(op) {
> + /* add $40, %rsp */
> + op->src.type = OP_SRC_ADD;
> + op->src.reg = CFI_SP;
> + op->src.offset = 5*8;
> + op->dest.type = OP_DEST_REG;
> + op->dest.reg = CFI_SP;
> + }
> + }
> break;
Powered by blists - more mailing lists