Skip to content
Neo edited this page Feb 21, 2022 · 4 revisions

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.

Table of Contents


Constructor

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.


Properties

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.

Functions

update

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.

getReg

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


toString

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.


Return to top


Further reading

Clone this wiki locally