IDAPython 9.0
Loading...
Searching...
No Matches
ida_fixup Namespace Reference

Detailed Description

A loader should setup fixup information using set_fixup().

Classes

class  fixup_data_t
 Proxy of C++ fixup_data_t class. More...
 
class  fixup_info_t
 Proxy of C++ fixup_info_t class. More...
 

Functions

"bool" is_fixup_custom ("fixup_type_t" type)
 is_fixup_custom(type) -> bool Is fixup processed by processor module?
 
"bool" get_fixup ("fixup_data_t" fd, "ea_t" source)
 get_fixup(fd, source) -> bool Get fixup information.
 
"bool" exists_fixup ("ea_t" source)
 exists_fixup(source) -> bool Check that a fixup exists at the given address.
 
"void" set_fixup ("ea_t" source, "fixup_data_t" fd)
 set_fixup(source, fd) Set fixup information.
 
"void" del_fixup ("ea_t" source)
 del_fixup(source) Delete fixup information.
 
"ea_t" get_first_fixup_ea ()
 get_first_fixup_ea() -> ea_t
 
"ea_t" get_next_fixup_ea ("ea_t" ea)
 get_next_fixup_ea(ea) -> ea_t Find next address with fixup information
 
"ea_t" get_prev_fixup_ea ("ea_t" ea)
 get_prev_fixup_ea(ea) -> ea_t Find previous address with fixup information
 
"fixup_handler_t const *" get_fixup_handler ("fixup_type_t" type)
 get_fixup_handler(type) -> fixup_handler_t const * Get handler of standard or custom fixup.
 
"uval_t" get_fixup_value ("ea_t" ea, "fixup_type_t" type)
 get_fixup_value(ea, type) -> uval_t Get the operand value.
 
"bool" patch_fixup_value ("ea_t" ea, "fixup_data_t" fd)
 patch_fixup_value(ea, fd) -> bool Patch the fixup bytes.
 
"fixup_data_t const &" get_fixup_desc ("ea_t" source, "fixup_data_t" fd)
 get_fixup_desc(source, fd) -> str Get FIXUP description comment.
 
"int" calc_fixup_size ("fixup_type_t" type)
 calc_fixup_size(type) -> int Calculate size of fixup in bytes (the number of bytes the fixup patches)
 
"fixup_type_t" find_custom_fixup ("char const *" name)
 find_custom_fixup(name) -> fixup_type_t Get id of a custom fixup handler.
 
"bool" get_fixups ("fixups_t *" out, "ea_t" ea, "asize_t" size)
 get_fixups(out, ea, size) -> bool
 
"bool" contains_fixups ("ea_t" ea, "asize_t" size)
 contains_fixups(ea, size) -> bool Does the specified address range contain any fixup information?
 
"void" gen_fix_fixups ("ea_t" _from, "ea_t" to, "asize_t" size)
 gen_fix_fixups(_from, to, size) Relocate the bytes with fixup information once more (generic function).
 
"bool" handle_fixups_in_macro ("refinfo_t" ri, "ea_t" ea, "fixup_type_t" other, "uint32" macro_reft_and_flags)
 handle_fixups_in_macro(ri, ea, other, macro_reft_and_flags) -> bool Handle two fixups in a macro.
 

Variables

 FIXUP_OFF8 = _ida_fixup.FIXUP_OFF8
 
 FIXUP_OFF16 = _ida_fixup.FIXUP_OFF16
 
 FIXUP_SEG16 = _ida_fixup.FIXUP_SEG16
 
 FIXUP_PTR16 = _ida_fixup.FIXUP_PTR16
 
 FIXUP_OFF32 = _ida_fixup.FIXUP_OFF32
 
 FIXUP_PTR32 = _ida_fixup.FIXUP_PTR32
 
 FIXUP_HI8 = _ida_fixup.FIXUP_HI8
 
 FIXUP_HI16 = _ida_fixup.FIXUP_HI16
 
 FIXUP_LOW8 = _ida_fixup.FIXUP_LOW8
 
 FIXUP_LOW16 = _ida_fixup.FIXUP_LOW16
 
 V695_FIXUP_VHIGH = _ida_fixup.V695_FIXUP_VHIGH
 
 V695_FIXUP_VLOW = _ida_fixup.V695_FIXUP_VLOW
 
 FIXUP_OFF64 = _ida_fixup.FIXUP_OFF64
 
 FIXUP_OFF8S = _ida_fixup.FIXUP_OFF8S
 
 FIXUP_OFF16S = _ida_fixup.FIXUP_OFF16S
 
 FIXUP_OFF32S = _ida_fixup.FIXUP_OFF32S
 
 FIXUP_CUSTOM = _ida_fixup.FIXUP_CUSTOM
 
 FIXUPF_REL = _ida_fixup.FIXUPF_REL
 
 FIXUPF_EXTDEF = _ida_fixup.FIXUPF_EXTDEF
 
 FIXUPF_UNUSED = _ida_fixup.FIXUPF_UNUSED
 
 FIXUPF_CREATED = _ida_fixup.FIXUPF_CREATED
 
 FIXUPF_LOADER_MASK = _ida_fixup.FIXUPF_LOADER_MASK
 

Function Documentation

◆ calc_fixup_size()

"int" calc_fixup_size ( "fixup_type_t" type)
Return values
-1means error
Parameters
type(C++: fixup_type_t)

◆ contains_fixups()

"bool" contains_fixups ( "ea_t" ea,
"asize_t" size )
Parameters
ea(C++: ea_t)
size(C++: asize_t)

◆ del_fixup()

"void" del_fixup ( "ea_t" source)
Parameters
source(C++: ea_t)

◆ exists_fixup()

"bool" exists_fixup ( "ea_t" source)
Parameters
source(C++: ea_t)

◆ find_custom_fixup()

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

◆ gen_fix_fixups()

"void" gen_fix_fixups ( "ea_t" _from,
"ea_t" to,
"asize_t" size )

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

"ea_t" get_first_fixup_ea ( )

◆ get_fixup()

"bool" get_fixup ( "fixup_data_t" fd,
"ea_t" source )
Parameters
fd(C++: fixup_data_t *)
source(C++: ea_t)

◆ get_fixup_desc()

"fixup_data_t const &" get_fixup_desc ( "ea_t" source,
"fixup_data_t" fd )
Parameters
source(C++: ea_t)
fd(C++: const fixup_data_t &) fixup_data_t const &

◆ get_fixup_handler()

"fixup_handler_t const *" get_fixup_handler ( "fixup_type_t" type)
Parameters
type(C++: fixup_type_t)

◆ get_fixup_value()

"uval_t" get_fixup_value ( "ea_t" ea,
"fixup_type_t" type )

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

Parameters
ea(C++: ea_t) address to get fixup bytes from, the size of the fixup bytes depends on the fixup type.
See also
: fixup_handler_t::size
Parameters
type(C++: fixup_type_t) fixup type
Return values
operandvalue

◆ get_fixups()

"bool" get_fixups ( "fixups_t *" out,
"ea_t" ea,
"asize_t" size )
Parameters
outfixups_t *
eaea_t
sizeasize_t

◆ get_next_fixup_ea()

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

◆ get_prev_fixup_ea()

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

◆ handle_fixups_in_macro()

"bool" handle_fixups_in_macro ( "refinfo_t" ri,
"ea_t" ea,
"fixup_type_t" other,
"uint32" macro_reft_and_flags )

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.

Parameters
ri(C++: refinfo_t *)
ea(C++: ea_t)
other(C++: fixup_type_t)
macro_reft_and_flags(C++: uint32)
Returns
: success ('false' means that RI was not changed)

◆ is_fixup_custom()

"bool" is_fixup_custom ( "fixup_type_t" type)
Parameters
type(C++: fixup_type_t)

◆ patch_fixup_value()

"bool" patch_fixup_value ( "ea_t" ea,
"fixup_data_t" fd )

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.

Parameters
ea(C++: ea_t) address where data are changed, the size of the changed data depends on the fixup type.
See also
: fixup_handler_t::size
Parameters
fd(C++: const fixup_data_t &) fixup data
Return values
falsethe fixup bytes do not fit (e.g. fd->off is greater than 0xFFFFFFC for BRANCH26). The database is changed even in this case.

◆ set_fixup()

"void" set_fixup ( "ea_t" source,
"fixup_data_t" fd )

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

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

Variable Documentation

◆ FIXUP_CUSTOM

FIXUP_CUSTOM = _ida_fixup.FIXUP_CUSTOM

◆ FIXUP_HI16

FIXUP_HI16 = _ida_fixup.FIXUP_HI16

◆ FIXUP_HI8

FIXUP_HI8 = _ida_fixup.FIXUP_HI8

◆ FIXUP_LOW16

FIXUP_LOW16 = _ida_fixup.FIXUP_LOW16

◆ FIXUP_LOW8

FIXUP_LOW8 = _ida_fixup.FIXUP_LOW8

◆ FIXUP_OFF16

FIXUP_OFF16 = _ida_fixup.FIXUP_OFF16

◆ FIXUP_OFF16S

FIXUP_OFF16S = _ida_fixup.FIXUP_OFF16S

◆ FIXUP_OFF32

FIXUP_OFF32 = _ida_fixup.FIXUP_OFF32

◆ FIXUP_OFF32S

FIXUP_OFF32S = _ida_fixup.FIXUP_OFF32S

◆ FIXUP_OFF64

FIXUP_OFF64 = _ida_fixup.FIXUP_OFF64

◆ FIXUP_OFF8

FIXUP_OFF8 = _ida_fixup.FIXUP_OFF8

◆ FIXUP_OFF8S

FIXUP_OFF8S = _ida_fixup.FIXUP_OFF8S

◆ FIXUP_PTR16

FIXUP_PTR16 = _ida_fixup.FIXUP_PTR16

◆ FIXUP_PTR32

FIXUP_PTR32 = _ida_fixup.FIXUP_PTR32

◆ FIXUP_SEG16

FIXUP_SEG16 = _ida_fixup.FIXUP_SEG16

◆ FIXUPF_CREATED

FIXUPF_CREATED = _ida_fixup.FIXUPF_CREATED

◆ FIXUPF_EXTDEF

FIXUPF_EXTDEF = _ida_fixup.FIXUPF_EXTDEF

◆ FIXUPF_LOADER_MASK

FIXUPF_LOADER_MASK = _ida_fixup.FIXUPF_LOADER_MASK

◆ FIXUPF_REL

FIXUPF_REL = _ida_fixup.FIXUPF_REL

◆ FIXUPF_UNUSED

FIXUPF_UNUSED = _ida_fixup.FIXUPF_UNUSED

◆ V695_FIXUP_VHIGH

V695_FIXUP_VHIGH = _ida_fixup.V695_FIXUP_VHIGH

◆ V695_FIXUP_VLOW

V695_FIXUP_VLOW = _ida_fixup.V695_FIXUP_VLOW