-
-
Notifications
You must be signed in to change notification settings - Fork 55
SIBase
SIBase class is the representation of a SIB byte which specifies the [Scale*Index + Base] addressing.
Just like ModRM, objects of this class is usually retrieved as part of an Instr object.
For construction, we need the individual parts that form the SIB byte, which then become properties.
Alternatively the constructor can be called with the SIB byte (number or hex string) itself to extract the parts.
Syntax:
new SIBase(scale, index, base)
new SIBase(byte)
Once the object is created, the following properties & functions become available.
Property name | Description |
---|---|
Scale |
Can be one of 1 , 2 , 4 or 8
|
Index |
Either the index Register or it's Index. |
Base |
Either the base Register or it's Index. |
Data |
The complete SIB byte as a number or hex string depending on how the object was constructed. |
Allows for modification of the object's members and update the Data
member.
Use null
for keeping any member intact.
Syntax:
<obj>.update(scale, index, base)
Argument | Description |
---|---|
scale |
The new Scale value. If null , the existing Scale is kept intact. |
index |
The new Index register/value. If null , the existing Index is kept intact. |
base |
The new Base register/value. If null , the existing Base is kept intact. |
Retrieves the Index
and Base
members as Register objects. Works best when the SIBase object is part of an extracted Instr.
Syntax:
<obj>.getReg(section, [bitsize])
Argument | Description |
---|---|
section |
Should be either I for Index or B for Base register |
bitsize |
Optional bit size of the register. Default is 32
|
Returns: Either the estimated/extracted register or
null
in case something went wrong
Override of toString
function for retrieving all the details of the object as a string. Useful for debugging.
Syntax;
<obj>.toString()
This function is automatically invoked when the object is used in a string context. For e.g. with the Debug function.