beautypg.com

6 absolute jump/call addresses, 7 entry locations, Absolute jump/call addresses – Avago Technologies LSI53C1010 User Manual

Page 176: Entry locations

background image

7-10

Integrating SCRIPTS Programs into “C” Language Drivers

first Dword along with the opcode, be sure to OR in the byte count
instead of doing a straight assignment. Byte counts to be patched are
usually defined as EXTERNS, RELATIVES, or ABSOLUTES. The
general format of this type of patch is:

SCRIPT[X_bytecount_Used[n]] |= c_byte_count;

Where

X

is either E, R, or A

n

is the nth occurrence of this byte count in the SCRIPTS program.

c_byte_count

is a variable/constant byte count value.

See

Chapter 5, “The NASM Output File,”

for more information on the

_Used

array.

7.2.6 Absolute JUMP/CALL Addresses

Use the LABELPATCHES array to patch in absolute JUMP or CALL
addresses. The absolute offset from the beginning of the SCRIPTS
instruction is encoded in the JUMP instruction at assembly. All that needs
to be added is the base physical address of the SCRIPTS array. The
general format of this type of patch is:

SCRIPT[LABELPATCHES[n]] += VirttoPhys(SCRIPT);

Where

n

is the nth jump instruction to be patched.

This can be automated using a loop and the PATCHES values.

See

Chapter 5, “The NASM Output File,”

for more information on the

LABELPATCHES array.

7.2.7 Entry Locations

Entry offsets are byte offsets, not Dword offsets. Divide the Entry offset
by 4 to get to a SCRIPTS instruction offset. This method can be used to
modify any SCRIPTS instruction that normally does not need patching,
but needs to be modified in a special circumstance. The general format
of this type of patch is:

SCRIPT[Ent_entrylabel/4 + n] = value;

Where

n

is either 0, 1 or 2 depending on the particular Dword of the

instruction that needs to be accessed.

This manual is related to the following products: