RSO Sample Demo LinkJump

Location

$REVOLUTION_SDK_ROOT/build/demos/rsodemo/LinkJump

Overview

This is a demo program showing allocation of a dynamic module to external main memory (the MEM2 area).
It places module I (i.rso) and module J (j.rso) in MEM2 and then links them, using a static module and relay code.

Description

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. One workaround is to obtain a buffer in the range that can be jumped to with a normal branch instruction (28 bits), output the instruction for the 32-bit absolute address branch to that buffer, and then link to that buffer.

When module I and J are placed in MEM2, the functions of the static module (such as OSReport) must be made a 32-bit absolute address branch.

In the sample, a relay code is created using the local function makeCodeMem2. The required buffer size is obtained with RSOGetJumpCodeSize, the buffer is allocated, and then a relay code is output to the buffer, using RSOMakeJumpCode. The module code is then changed with RSOLinkJump.

Note: Make sure to allocate the buffer from the same main memory (MEM2) as the referencing side (module I and J in the example).
However, there is no need for the relay code if this is the same memory as the referenced side (rsoExp).

See Also

Sample List
RSOLinkJump, RSOMakeJumpCode, RSOGetJumpCodeSize,

Revision History

2006/12/19 Initial version.


CONFIDENTIAL