IDA SDK

- Main Page
- Header Files
- Classes
- Modules

Macros | Functions
Segment translations
Segments

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

## 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 ea_t *transmap)
| Set new translation list. More...
bool | del_segment_translations (ea_t ea)
| Delete the translation list.
idaman ea_t *ida_export | get_segment_translations (ea_t segstart, ea_t *buf, int bufsize)
| Get segment translation list. More...

## Function Documentation

idaman bool ida_export add_segment_translation | ( | ea_t | segstart,
|  | ea_t | mappedseg
| ) |  |

Add segment translation.

Parameters

  segstart | start address of the segment to add translation to
  mappedseg | start address of the overlayed segment

Return values

  1 | ok
  0 | too many translations or bad segstart

idaman bool ida_export set_segment_translations | ( | ea_t | segstart,
|  | const ea_t * | transmap
| ) |  |

Set new translation list.

Parameters

  segstart | start address of the segment to add translation to
  transmap | array of segment start addresses for the translation list. The first element of array contains number of segments. If transmap==NULL, then translation list is deleted.

Return values

  1 | ok
  0 | too many translations or bad segstart

idaman ea_t* ida_export get_segment_translations | ( | ea_t | segstart,
|  | ea_t * | buf,
|  | int | bufsize
| ) |  |

Get segment translation list.

Parameters

  segstart | start address of the segment to get information about
  buf | buffer for the answer
  bufsize | size of the buffer in bytes

Returns
  NULL if no translation list, bad segstart, or small or bad buffer. otherwise returns translation list. the first element of the list contains number of segments.