Module index

Module ida_fixup

IDA Plugin SDK API wrapper: fixup

Global variables

var FIXUPF_CREATED
fixup was not present in the input file
var FIXUPF_EXTDEF
target is a location (otherwise - segment). Use this bit if the target is a symbol rather than an offset from the beginning of a segment.
var FIXUPF_LOADER_MASK
additional flags. The bits from this mask are not stored in the database and can be used by the loader at its discretion.
var FIXUPF_REL
fixup is relative to the linear address `base' . Otherwise fixup is relative to the start of the segment with `sel' selector.
var FIXUPF_UNUSED
fixup is ignored by IDAdisallows the kernel to convert operandsthis fixup is not used during output
var FIXUP_CUSTOM
FIXUP_CUSTOM = 32768
var FIXUP_HI16
FIXUP_HI16 = 7
var FIXUP_HI8
FIXUP_HI8 = 6
var FIXUP_LOW16
FIXUP_LOW16 = 9
var FIXUP_LOW8
FIXUP_LOW8 = 8
var FIXUP_OFF16
FIXUP_OFF16 = 1
var FIXUP_OFF16S
FIXUP_OFF16S = 15
var FIXUP_OFF32
FIXUP_OFF32 = 4
var FIXUP_OFF32S
FIXUP_OFF32S = 16
var FIXUP_OFF64
FIXUP_OFF64 = 12
var FIXUP_OFF8
FIXUP_OFF8 = 13
var FIXUP_OFF8S
FIXUP_OFF8S = 14
var FIXUP_PTR16
FIXUP_PTR16 = 3
var FIXUP_PTR32
FIXUP_PTR32 = 5
var FIXUP_SEG16
FIXUP_SEG16 = 2
var V695_FIXUP_VHIGH
V695_FIXUP_VHIGH = 10
var V695_FIXUP_VLOW
V695_FIXUP_VLOW = 11

Functions

def calc_fixup_size(*args) ‑> int
Calculate size of fixup in bytes (the number of bytes the fixup patches)
calc_fixup_size(type) -> int
type (C++: fixup_type_t)
retval: -1 - means error
def contains_fixups(*args) ‑> bool
Does the specified address range contain any fixup information?
contains_fixups(ea, size) -> bool
ea (C++: ea_t)
size (C++: asize_t)
def del_fixup(*args) ‑> void
Delete fixup information.
del_fixup(source)
source (C++: ea_t)
def exists_fixup(*args) ‑> bool
Check that a fixup exists at the given address.
exists_fixup(source) -> bool
source (C++: ea_t)
def find_custom_fixup(*args) ‑> fixup_type_t
Get id of a custom fixup handler.
find_custom_fixup(name) -> fixup_type_t
name: name of the custom fixup handler (C++: const char *)
return: id with FIXUP_CUSTOM bit set or 0
def gen_fix_fixups(*args) ‑> void
Relocate the bytes with fixup information once more (generic function). This function may be called from 'loader_t::move_segm()' if it suits the goal. If 'loader_t::move_segm' is not defined then this function will be called automatically when moving segments or rebasing the entire program. Special parameter values (from = BADADDR, size = 0, to = delta) are used when the function is called from rebase_program(delta).
gen_fix_fixups(_from, to, size)
_from (C++: ea_t)
to (C++: ea_t)
size (C++: asize_t)
def get_first_fixup_ea(*args) ‑> ea_t
Get the first address with fixup information
def get_fixup(*args) ‑> bool
Get fixup information.
get_fixup(fd, source) -> bool
fd (C++: fixup_data_t *)
source (C++: ea_t)
def get_fixup_desc(*args) ‑> fixup_data_t const &
Get FIXUP description comment.
get_fixup_desc(source, fd) -> str
source (C++: ea_t)
fd (C++: const fixup_data_t &)
def get_fixup_handler(*args) ‑> fixup_handler_t const *
Get handler of standard or custom fixup.
get_fixup_handler(type) -> fixup_handler_t const *
type (C++: fixup_type_t)
def get_fixup_value(*args) ‑> uval_t
Get the operand value. This function get fixup bytes from data or an instruction at `ea' and convert them to the operand value (maybe partially). It is opposite in meaning to the 'patch_fixup_value()' . For example, FIXUP_HI8 read a byte at 'patch_fixup_value()' `ea' and shifts it left by 8 bits, or AArch64's custom fixup BRANCH26 get low 26 bits of the insn at `ea' and shifts it left by 2 bits. This function is mainly used to get a relocation addend. 'fixup_handler_t::size'
get_fixup_value(ea, type) -> uval_t
ea: address to get fixup bytes from, the size of the fixup
bytes depends on the fixup type. (C++: ea_t)
type (C++: fixup_type_t)
retval: operand - value
def get_fixups(*args) ‑> bool
get_fixups(out, ea, size) -> bool
out (C++: fixups_t *)
ea (C++: ea_t)
size (C++: asize_t)
def get_next_fixup_ea(*args) ‑> ea_t
Find next address with fixup information
get_next_fixup_ea(ea) -> ea_t
ea: current address (C++: ea_t)
return: the next address with fixup information, or BADADDR
def get_prev_fixup_ea(*args) ‑> ea_t
Find previous address with fixup information
get_prev_fixup_ea(ea) -> ea_t
ea: current address (C++: ea_t)
return: the previous address with fixup information, or BADADDR
def handle_fixups_in_macro(*args) ‑> bool
Handle two fixups in a macro. We often combine two instruction that load parts of a value into one macro instruction. For example: ARM: ADRP X0, #var@PAGE ADD X0, X0, #var@PAGEOFF --> ADRL X0, var MIPS: lui $v0, hi(var) addiu $v0, $v0, lo(var) --> la $v0, var When applying the fixups that fall inside such a macro, we should convert them to one refinfo. This function does exactly that. It should be called from the apply() callback of a custom fixup.
handle_fixups_in_macro(ri, ea, other, macro_reft_and_flags) -> bool
ri (C++: refinfo_t *)
ea (C++: ea_t)
other (C++: fixup_type_t)
macro_reft_and_flags (C++: uint32)
return: success ('false' means that RI was not changed)
def is_fixup_custom(*args) ‑> bool
Is fixup processed by processor module?
is_fixup_custom(type) -> bool
type (C++: fixup_type_t)
def patch_fixup_value(*args) ‑> bool
Patch the fixup bytes. This function updates data or an instruction at `ea' to the fixup bytes. For example, FIXUP_HI8 updates a byte at `ea' to the high byte of `fd->off' , or AArch64's custom fixup BRANCH26 updates low 26 bits of the insn at `ea' to the value of `fd->off' shifted right by 2. 'fixup_handler_t::size'
patch_fixup_value(ea, fd) -> bool
ea: address where data are changed, the size of the changed
data depends on the fixup type. (C++: ea_t)
fd (C++: const fixup_data_t &)
retval: false - the fixup bytes do not fit (e.g. fd->off is greater
than 0xFFFFFFC for BRANCH26). The database is changed even in this case.
def set_fixup(*args) ‑> void
Set fixup information. You should fill 'fixup_data_t' and call this function and the kernel will remember information in the database.
set_fixup(source, fd)
source: the fixup source address, i.e. the address modified by
the fixup (C++: ea_t)
fd: fixup data (C++: const fixup_data_t &)

Classes

class fixup_data_t (*args)
Proxy of C++ fixup_data_t class.
__init__(self) -> fixup_data_t
type_: fixup_type_t flags_: uint32

Instance variables

var displacement
fixup_data_t_displacement_get(self) -> adiff_t
var off
fixup_data_t_off_get(self) -> ea_t
var sel
fixup_data_t_sel_get(self) -> sel_t

Methods

def calc_size(self, *args) ‑> int
'calc_fixup_size()'
def clr_extdef(self, *args) ‑> void
clr_extdef(self)
def clr_unused(self, *args) ‑> void
clr_unused(self)
def get(self, *args) ‑> bool
'get_fixup()'
get(self, source) -> bool
source (C++: ea_t)
def get_base(self, *args) ‑> ea_t
Get base of fixup.The target is calculated as 'get_base()' + off. 'get_base()' + off 'FIXUPF_REL'
def get_desc(self, *args) ‑> char const *
'get_fixup_desc()'
get_desc(self, source) -> char const *
source (C++: ea_t)
def get_flags(self, *args) ‑> uint32
Fixup flags 'Fixup flags' .
def get_handler(self, *args) ‑> fixup_handler_t const *
'get_fixup_handler()'
def get_type(self, *args) ‑> fixup_type_t
Fixup type 'Types of fixups' .
def get_value(self, *args) ‑> uval_t
'get_fixup_value()'
get_value(self, ea) -> uval_t
ea (C++: ea_t)
def has_base(self, *args) ‑> bool
Is fixup relative?
def is_custom(self, *args) ‑> bool
'is_fixup_custom()'
def is_extdef(self, *args) ‑> bool
is_extdef(self) -> bool
def is_unused(self, *args) ‑> bool
is_unused(self) -> bool
def patch_value(self, *args) ‑> bool
'patch_fixup_value()'
patch_value(self, ea) -> bool
ea (C++: ea_t)
def set(self, *args) ‑> void
'set_fixup()'
set(self, source)
source (C++: ea_t)
def set_base(self, *args) ‑> void
Set base of fixup. The target should be set before a call of this function.
set_base(self, new_base)
new_base (C++: ea_t)
def set_extdef(self, *args) ‑> void
set_extdef(self)
def set_sel(self, *args) ‑> void
set_sel(self, seg)
seg (C++: const segment_t *)
def set_target_sel(self, *args) ‑> void
Set selector of fixup to the target. The target should be set before a call of this function.
def set_type(self, *args) ‑> void
set_type(self, type_)
type_ (C++: fixup_type_t)
def set_type_and_flags(self, *args) ‑> void
set_type_and_flags(self, type_, flags_=0)
type_ (C++: fixup_type_t)
flags_ (C++: uint32)
def set_unused(self, *args) ‑> void
set_unused(self)
def was_created(self, *args) ‑> bool
Is fixup artificial?
class fixup_info_t (*args)
Proxy of C++ fixup_info_t class.
__init__(self) -> fixup_info_t

Instance variables

var ea
fixup_info_t_ea_get(self) -> ea_t
var fd
fixup_info_t_fd_get(self) -> fixup_data_t