ana_emu_out

summary: rewrite the representation of some instructions

description:

Implements disassembly of BUG_INSTR used in Linux kernel BUG() macro, which is architecturally undefined and is not disassembled by IDA’s ARM module

See Linux/arch/arm/include/asm/bug.h for more info

level: intermediate

Attributes

ITYPE_BUGINSN

MNEM_WIDTH

bahooks

Classes

MyHooks

Module Contents

ana_emu_out.ITYPE_BUGINSN
ana_emu_out.MNEM_WIDTH = 16
class ana_emu_out.MyHooks

Bases: ida_idp.IDP_Hooks

reported = []
ev_ana_insn(insn)

Analyze one instruction and fill ‘out’ structure. This function shouldn’t change the database, flags or anything else. All these actions should be performed only by emu_insn() function. insn_t::ea contains address of instruction to analyze.

Parameters:

out – (insn_t *)

Returns:

length of the instruction in bytes, 0 if instruction can’t be decoded.

Returns:

0: if instruction can’t be decoded.

ev_emu_insn(insn)

Emulate instruction, create cross-references, plan to analyze subsequent instructions, modify flags etc. Upon entrance to this function, all information about the instruction is in ‘insn’ structure.

Parameters:

insn – (const insn_t *)

Returns:

1: ok

Returns:

-1: the kernel will delete the instruction

ev_out_mnem(outctx)

Generate instruction mnemonics. This callback should append the colored mnemonics to ctx.outbuf Optional notification, if absent, out_mnem will be called.

Parameters:

outctx – (outctx_t *)

Returns:

1: if appended the mnemonics

Returns:

0: not implemented

ana_emu_out.bahooks