#include <revolution/rso.h>
int RSOLinkJump(RSOObjectHeader* rsoImp,const RSOObjectHeader* rsoExp,void *buff);
rsoImp |
Pointer to the module information to link. |
rsoExp |
Pointer to the module information to reference. |
buff |
Jump code for the referenced module. |
If linking succeeded, returns the number of codes that were processed.
Returns -1 if linking failed.
Typically, branch instructions (bx) have only a 28-bit offset (± 32 MB). Therefore, when a dynamic module is placed in external main memory (MEM2), functions in internal main memory (MEM1) cannot be accessed.
Use RSOLinkJump to link between the two.
The LinkJump function in the demo outputs a relay jump code, buff. The external module is then accessed through this by linking from rsoImp.
RSOGetJumpCodeSize gets the buffer size needed to create a relay jump code using RSOMakeJumpCode.
Note: Allocate the buffer from the same main memory (MEM2 or MEM1) as the referencing module (rsoImp). However, there is no need for the relay code if this is the same memory as the referenced side (rsoExp).
If this function returns -1, indicating that linking failed, it means that rsoImp and buff are separated by ±32MB or more and cannot reach each other with a relative jump. When you allocate memory for rsoImp and buff, make sure to locate them within ±32MB of each other.
In the RSOLinkFar function, the relay jump code is dependent on the module that is referred to, but RSOLinkJump is dependent on the referring module.
This is an effective method when the module being referenced across the memory is known.
RSO API Introduction
RSOGetJumpCodeSize
RSOMakeJumpCode
2008/07/10 Removed RSOLink.h from Syntax. Added a note indicating when a jump cannot be reached.
2006/12/19 Initial version.
CONFIDENTIAL