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

Detailed Description

Functions that deal with fixup information.

A loader should setup fixup information using set_fixup(). 

Classes

class  fixup_data_t
 
class  fixup_info_t
 

Functions

bool is_fixup_custom ('fixup_type_t' type)
 
bool get_fixup ('fixup_data_t' fd, ida_idaapi.ea_t source)
 
bool exists_fixup (ida_idaapi.ea_t source)
 
None set_fixup (ida_idaapi.ea_t source, 'fixup_data_t' fd)
 
None del_fixup (ida_idaapi.ea_t source)
 
ida_idaapi.ea_t get_first_fixup_ea ()
 
ida_idaapi.ea_t get_next_fixup_ea (ida_idaapi.ea_t ea)
 
ida_idaapi.ea_t get_prev_fixup_ea (ida_idaapi.ea_t ea)
 
'fixup_handler_t const *' get_fixup_handler ('fixup_type_t' type)
 
int get_fixup_value (ida_idaapi.ea_t ea, 'fixup_type_t' type)
 
bool patch_fixup_value (ida_idaapi.ea_t ea, 'fixup_data_t' fd)
 
str get_fixup_desc (ida_idaapi.ea_t source, 'fixup_data_t' fd)
 
int calc_fixup_size ('fixup_type_t' type)
 
'fixup_type_t' find_custom_fixup (str name)
 
bool get_fixups ('fixups_t *' out, ida_idaapi.ea_t ea, 'asize_t' size)
 
bool contains_fixups (ida_idaapi.ea_t ea, 'asize_t' size)
 
None gen_fix_fixups (ida_idaapi.ea_t _from, ida_idaapi.ea_t to, 'asize_t' size)
 
bool handle_fixups_in_macro ('refinfo_t' ri, ida_idaapi.ea_t ea, 'fixup_type_t' other, int macro_reft_and_flags)
 

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)
Calculate size of fixup in bytes (the number of bytes the fixup patches) 
    
@retval -1: means error

◆ contains_fixups()

bool contains_fixups ( ida_idaapi.ea_t ea,
'asize_t' size )
Does the specified address range contain any fixup information?

◆ del_fixup()

None del_fixup ( ida_idaapi.ea_t source)
Delete fixup information.

◆ exists_fixup()

bool exists_fixup ( ida_idaapi.ea_t source)
Check that a fixup exists at the given address.

◆ find_custom_fixup()

'fixup_type_t' find_custom_fixup ( str name)

◆ gen_fix_fixups()

None gen_fix_fixups ( ida_idaapi.ea_t _from,
ida_idaapi.ea_t to,
'asize_t' 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). 

◆ get_first_fixup_ea()

ida_idaapi.ea_t get_first_fixup_ea ( )

◆ get_fixup()

bool get_fixup ( 'fixup_data_t' fd,
ida_idaapi.ea_t source )
Get fixup information.

◆ get_fixup_desc()

str get_fixup_desc ( ida_idaapi.ea_t source,
'fixup_data_t' fd )
Get FIXUP description comment.

◆ get_fixup_handler()

'fixup_handler_t const *' get_fixup_handler ( 'fixup_type_t' type)
Get handler of standard or custom fixup.

◆ get_fixup_value()

int get_fixup_value ( ida_idaapi.ea_t ea,
'fixup_type_t' 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 `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. 
    
@param ea: address to get fixup bytes from, the size of the fixup bytes depends on the fixup type.
@param type: fixup type
@retval operand: value

◆ get_fixups()

bool get_fixups ( 'fixups_t *' out,
ida_idaapi.ea_t ea,
'asize_t' size )

◆ get_next_fixup_ea()

ida_idaapi.ea_t get_next_fixup_ea ( ida_idaapi.ea_t ea)

◆ get_prev_fixup_ea()

ida_idaapi.ea_t get_prev_fixup_ea ( ida_idaapi.ea_t ea)

◆ handle_fixups_in_macro()

bool handle_fixups_in_macro ( 'refinfo_t' ri,
ida_idaapi.ea_t ea,
'fixup_type_t' other,
int macro_reft_and_flags )
Handle two fixups in a macro. We often combine two instruction that load parts of a value into one macro instruction. For example: 
   ADRP  X0, #var@PAGE
       ADD   X0, X0, #var@PAGEOFF  --> ADRL X0, var
  lui   $v0, %hi(var)
       addiu $v0, $v0, %lo(var)    --> la   $v0, var


    
@returns success ('false' means that RI was not changed)

◆ is_fixup_custom()

bool is_fixup_custom ( 'fixup_type_t' type)
Is fixup processed by processor module?

◆ patch_fixup_value()

bool patch_fixup_value ( ida_idaapi.ea_t ea,
'fixup_data_t' 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. 
    
@param ea: address where data are changed, the size of the changed data depends on the fixup type.
@param fd: fixup data
@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.

◆ set_fixup()

None set_fixup ( ida_idaapi.ea_t source,
'fixup_data_t' fd )
Set fixup information. You should fill fixup_data_t and call this function and the kernel will remember information in the database. 
    
@param source: the fixup source address, i.e. the address modified by the fixup
@param fd: 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