Module ida_fixup
[frames] | no frames]

Module ida_fixup

IDA Plugin SDK API wrapper: fixup

Classes
  fixup_data_t
Proxy of C++ fixup_data_t class.
  fixup_info_t
Proxy of C++ fixup_info_t class.
Functions
int
calc_fixup_size(type)
Calculate size of fixup in bytes (the number of bytes the fixup patches)
bool
contains_fixups(ea, size)
Does the specified address range contain any fixup information?
 
del_fixup(source)
Delete fixup information.
bool
exists_fixup(source)
Check that a fixup exists at the given address.
fixup_type_t
find_custom_fixup(name)
Get id of a custom fixup handler.
 
gen_fix_fixups(_from, to, size)
Relocate the bytes with fixup information once more (generic function).
ea_t
get_first_fixup_ea()
Get the first address with fixup information
bool
get_fixup(fd, source)
Get fixup information.
str
get_fixup_desc(source, fd)
Get FIXUP description comment.
fixup_handler_t const *
get_fixup_handler(type)
Get handler of standard or custom fixup.
uval_t
get_fixup_value(ea, type)
Get the operand value.
bool
get_fixups(out, ea, size)
ea_t
get_next_fixup_ea(ea)
Find next address with fixup information
ea_t
get_prev_fixup_ea(ea)
Find previous address with fixup information
bool
is_fixup_custom(type)
Is fixup processed by processor module?
bool
patch_fixup_value(ea, fd)
Patch the fixup bytes.
 
set_fixup(source, fd)
Set fixup information.
Variables
  FIXUPF_CREATED = 8
  FIXUPF_EXTDEF = 2
  FIXUPF_LOADER_MASK = -268435456
  FIXUPF_REL = 1
  FIXUPF_UNUSED = 4
  FIXUP_CUSTOM = 32768
  FIXUP_HI16 = 7
  FIXUP_HI8 = 6
  FIXUP_LOW16 = 9
  FIXUP_LOW8 = 8
  FIXUP_OFF16 = 1
  FIXUP_OFF32 = 4
  FIXUP_OFF64 = 12
  FIXUP_OFF8 = 13
  FIXUP_PTR16 = 3
  FIXUP_PTR32 = 5
  FIXUP_SEG16 = 2
  SWIG_PYTHON_LEGACY_BOOL = 1
  V695_FIXUP_VHIGH = 10
  V695_FIXUP_VLOW = 11
  __package__ = None
Function Details

calc_fixup_size(type)

 

Calculate size of fixup in bytes (the number of bytes the fixup patches)

Parameters:
  • type, (C++ - fixup_type_t)
Returns: int

contains_fixups(ea, size)

 

Does the specified address range contain any fixup information?

Parameters:
  • ea, (C++ - ea_t)
  • size, (C++ - asize_t)
Returns: bool

del_fixup(source)

 

Delete fixup information.

Parameters:
  • source, (C++ - ea_t)

exists_fixup(source)

 

Check that a fixup exists at the given address.

Parameters:
  • source, (C++ - ea_t)
Returns: bool

find_custom_fixup(name)

 

Get id of a custom fixup handler.

Parameters:
  • name - name of the custom fixup handler (C++: const char *)
Returns: fixup_type_t
id with FIXUP_CUSTOM bit set or 0

gen_fix_fixups(_from, to, size)

 

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).

Parameters:
  • _from, (C++ - ea_t)
  • to, (C++ - ea_t)
  • size, (C++ - asize_t)

get_first_fixup_ea()

 

Get the first address with fixup information

Returns: ea_t
the first address with fixup information, or BADADDR

get_fixup(fd, source)

 

Get fixup information.

Parameters:
  • fd, (C++ - fixup_data_t *)
  • source, (C++ - ea_t)
Returns: bool

get_fixup_desc(source, fd)

 

Get FIXUP description comment.

Parameters:
  • source, (C++ - ea_t)
  • fd, (C++ - const fixup_data_t &)
Returns: str

get_fixup_handler(type)

 

Get handler of standard or custom fixup.

Parameters:
  • type, (C++ - fixup_type_t)
Returns: fixup_handler_t const *

get_fixup_value(ea, type)

 

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'

Parameters:
  • 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)
Returns: uval_t

get_next_fixup_ea(ea)

 

Find next address with fixup information

Parameters:
  • ea - current address (C++: ea_t)
Returns: ea_t
the next address with fixup information, or BADADDR

get_prev_fixup_ea(ea)

 

Find previous address with fixup information

Parameters:
  • ea - current address (C++: ea_t)
Returns: ea_t
the previous address with fixup information, or BADADDR

is_fixup_custom(type)

 

Is fixup processed by processor module?

Parameters:
  • type, (C++ - fixup_type_t)
Returns: bool

patch_fixup_value(ea, fd)

 

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'

Parameters:
  • 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 &)
Returns: bool

set_fixup(source, fd)

 

Set fixup information. You should fill 'fixup_data_t' and call this function and the kernel will remember information in the database.

Parameters:
  • source - the fixup source address, i.e. the address modified by the fixup (C++: ea_t)
  • fd - fixup data (C++: const fixup_data_t &)