IDA C++ SDK 9.2
|
The kernel maintains a table to translate selector values to segment base paragraphs. More...
Functions | |
idaman bool ida_export | getn_selector (sel_t *sel, ea_t *base, int n) |
Get description of selector (0..get_selector_qty()-1) | |
idaman size_t ida_export | get_selector_qty (void) |
Get number of defined selectors. | |
idaman sel_t ida_export | setup_selector (ea_t segbase) |
Allocate a selector for a segment if necessary. | |
idaman sel_t ida_export | allocate_selector (ea_t segbase) |
Allocate a selector for a segment unconditionally. | |
idaman sel_t ida_export | find_free_selector (void) |
Find first unused selector. | |
idaman int ida_export | set_selector (sel_t selector, ea_t paragraph) |
Set mapping of selector to a paragraph. | |
idaman void ida_export | del_selector (sel_t selector) |
Delete mapping of a selector. | |
idaman ea_t ida_export | sel2para (sel_t selector) |
Get mapping of a selector. | |
ea_t idaapi | sel2ea (sel_t selector) |
Get mapping of a selector as a linear address. | |
idaman sel_t ida_export | find_selector (ea_t base) |
Find a selector that has mapping to the specified paragraph. | |
idaman int ida_export | enumerate_selectors (int(idaapi *func)(sel_t sel, ea_t para)) |
Enumerate all selectors from the translation table. | |
idaman ea_t ida_export | enumerate_segments_with_selector (sel_t selector, ea_t(idaapi *func)(segment_t *s, void *ud), void *ud=nullptr) |
Enumerate all segments with the specified selector. | |
idaman segment_t *ida_export | get_segm_by_sel (sel_t selector) |
Get pointer to segment structure. |
The kernel maintains a table to translate selector values to segment base paragraphs.
A Paragraph is a 16byte quantity. This table and translation is necessary because IBM PC uses 16bit selectors in instructions but segments may reside anywhere in the linear addressing space. For example, if a segment with selector 5 resides at 0x400000, we need to have selector translation 5 -> 0x400000. For 16bit programs the selector translation table is usually empty, selector values are equal to segment base paragraphs.
Get description of selector (0..get_selector_qty()-1)
idaman size_t ida_export get_selector_qty | ( | void | ) |
Get number of defined selectors.
Allocate a selector for a segment if necessary.
You must call this function before calling add_segm_ex(). add_segm() calls this function itself, so you don't need to allocate a selector. This function will allocate a selector if 'segbase' requires more than 16 bits and the current processor is IBM PC. Otherwise it will return the segbase value.
segbase | a new segment base paragraph |
Allocate a selector for a segment unconditionally.
You must call this function before calling add_segm_ex(). add_segm() calls this function itself, so you don't need to allocate a selector. This function will allocate a new free selector and setup its mapping using find_free_selector() and set_selector() functions.
segbase | a new segment base paragraph |
Find first unused selector.
Set mapping of selector to a paragraph.
You should call this function before creating a segment which uses the selector, otherwise the creation of the segment will fail.
selector | number of selector to map
|
paragraph | paragraph to map selector |
1 | ok |
0 | failure (bad selector or too many mappings) |
Delete mapping of a selector.
Be wary of deleting selectors that are being used in the program, this can make a mess in the segments.
selector | number of selector to remove from the translation table |
Get mapping of a selector.
selector | number of selector to translate |
Get mapping of a selector as a linear address.
selector | number of selector to translate to linear address |
Find a selector that has mapping to the specified paragraph.
base | paragraph to search in the translation table |
Enumerate all selectors from the translation table.
This function calls 'func' for each selector in the translation table. If 'func' returns non-zero code, enumeration is stopped and this code is returned.
func | callback function
|
idaman ea_t ida_export enumerate_segments_with_selector | ( | sel_t | selector, |
ea_t(idaapi *func)(segment_t *s, void *ud) | , | ||
void * | ud = nullptr ) |
Enumerate all segments with the specified selector.
This function will call the callback function 'func' for each segment that has the specified selector. Enumeration starts from the last segment and stops at the first segment (reverse order). If the callback function 'func' returns a value != #BADADDR, the enumeration is stopped and this value is returned to the caller.
selector | segments that have this selector are enumerated |
func | callback function
|
ud | pointer to user data. this pointer will be passed to the callback function |
Get pointer to segment structure.
This function finds a segment by its selector. If there are several segments with the same selectors, the last one will be returned.
selector | a segment with the specified selector will be returned |