Latest available version: IDA and decompilers v8.4.240320sp1 see all releases
Hex-Rays logo State-of-the-art binary code analysis tools
email icon
Segment translations

Used to represent overlayed memory banks. More...

Macros

#define MAX_SEGM_TRANSLATIONS   64
 max number of segment translations
 

Functions

idaman bool ida_export add_segment_translation (ea_t segstart, ea_t mappedseg)
 Add segment translation. More...
 
idaman bool ida_export set_segment_translations (ea_t segstart, const eavec_t &transmap)
 Set new translation list. More...
 
idaman void ida_export del_segment_translations (ea_t segstart)
 Delete the translation list. More...
 
idaman ssize_t ida_export get_segment_translations (eavec_t *transmap, ea_t segstart)
 Get segment translation list. More...
 

Detailed Description

Used to represent overlayed memory banks.

Segment translations are used to redirect access to overlayed segments so that the correct overlay is accessed. Each segment has its own translation list. For example, suppose we have four segments:

     A               1000-2000
     B               1000-2000
       C             2000-3000
       D             2000-3000
   

A and B occupy the same virtual addresses. The same with C and D. Segment A works with segment C, segment B works with segment D.

So all references from A to 2000-3000 should go to C. For this we add translation C for segment A. The same with B,D: add translation D for segment B. Also, we need to specify the correct segment to be accessed from C, thus we add translation A for segment C. And we add translation B for segment D.

After this, all references to virtual addresses 2000-3000 made from A go to segment C (even if segment A would be large and occupy 1000-3000) So, we need the following translations:

     A:      C
     B:      D
     C:      A
     D:      B
  

With translations, the segments may reside at any linear addresses, all references will pass through the translation mechanism and go to the correct segment.

Segment translation works only for code segments (see map_code_ea())

Function Documentation

◆ add_segment_translation()

idaman bool ida_export add_segment_translation ( ea_t  segstart,
ea_t  mappedseg 
)

Add segment translation.

Parameters
segstartstart address of the segment to add translation to
mappedsegstart address of the overlayed segment
Return values
1ok
0too many translations or bad segstart

◆ set_segment_translations()

idaman bool ida_export set_segment_translations ( ea_t  segstart,
const eavec_t transmap 
)

Set new translation list.

Parameters
segstartstart address of the segment to add translation to
transmapvector of segment start addresses for the translation list. If transmap is empty, the translation list is deleted.
Return values
1ok
0too many translations or bad segstart

◆ del_segment_translations()

idaman void ida_export del_segment_translations ( ea_t  segstart)

Delete the translation list.

Parameters
segstartstart address of the segment to delete translation list

◆ get_segment_translations()

idaman ssize_t ida_export get_segment_translations ( eavec_t transmap,
ea_t  segstart 
)

Get segment translation list.

Parameters
transmapvector of segment start addresses for the translation list
segstartstart address of the segment to get information about
Returns
-1 if no translation list or bad segstart. otherwise returns size of translation list.