1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
6<META http-equiv="Content-Style-Type" content="text/css">
7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
8<title>RSO Sample Demo LinkJump</title>
9</head>
10
11<body>
12
13<H1>RSO Sample Demo LinkJump</H1>
14
15<H2>Location</H2>
16<p><code>$REVOLUTION_SDK_ROOT/build/demos/rsodemo/LinkJump</code></p>
17
18<H2>Overview</H2>
19<p>
20This is a demo program showing allocation of a dynamic module to external main memory (the <CODE>MEM2</CODE> area).<br>It places module I (<code>i.rso</code>) and module J (<code>j.rso</code>) in <CODE>MEM2</CODE> and then links it using a static module and relay code.
21</p>
22
23<H2>Description</H2>
24<p>
25Typically, the branch instructions (<CODE>bx</CODE>) have only the 28-bit offset (&plusmn; 32 MB). Therefore, when a dynamic module is placed in external main memory (<CODE>MEM2</CODE>), functions in internal main memory (<CODE>MEM1</CODE>) 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.
26<p>
27When module I and J is placed in <CODE>MEM2</CODE>, the functions of the static module (such as <code>OSReport</code>) must be made a 32-bit absolute address branch.
28</p>
29<p>
30
31In the sample, a relay code is created using the local function <code>makeCodeMem2</code>. The required buffer size is obtained with <code><a href="../RSOGetJumpCodeSize.html">RSOGetJumpCodeSize</a></code>, the buffer is allocated, and then a relay code is output to the buffer, using <code><a href="../RSOMakeJumpCode.html">RSOMakeJumpCode</a></code>. The module code is then changed with <code><a href="../RSOLinkJump.html">RSOLinkJump</a></code>.
32</p>
33<p>
34<b>Note:</b> Make sure to allocate the buffer from the same main memory (<CODE>MEM2</CODE>) as the referencing side (module I and J in the example).<br>However, there is no need for the relay code if this is the same memory as the referenced size (<CODE>rsoExp</CODE>).
35</p>
36
37<H2>See Also</H2>
38<p>
39<a href="./demos.html">Sample List</a><br> <code><a href="../RSOLinkJump.html">RSOLinkJump</a></code>, <code><a href="../RSOMakeJumpCode.html">RSOMakeJumpCode</a></code>, <code><a href="../RSOGetJumpCodeSize.html">RSOGetJumpCodeSize</a></code>
40</p>
41<H2>Revision History</H2>
42<p>2006/12/19 Initial version.</p>
43
44<hr><p>CONFIDENTIAL</p></body>
45</HTML>
46