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 LinkFar</title> 9</head> 10 11<body> 12 13<H1>RSO Sample Demo LinkFar</H1> 14 15<H2>Location</H2> 16<p><code>$REVOLUTION_SDK_ROOT/build/demos/rsodemo/LinkFar</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>Module E (<code>e.rso</code>) allocated to <CODE>MEM2</CODE> and module F (<code>f.rso</code>) allocated to <CODE>MEM1</CODE> are set to call functions from each other. 21</p> 22 23<H2>Description</H2> 24<p> 25Typically, branch instructions (<CODE>bx</CODE>) have only a 28-bit offset (± 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 G is placed in <CODE>MEM2</CODE>, the static module function (such as <code>OSReport</code>) and a function from module H in <CODE>MEM1</CODE> (<code>IsHThere</code>) must be set as a branch using the 32-bit absolute address.<br>In addition, because module H calls the module G function (<code>IsGThere</code>), this must also be made into a branch using 32-bit absolute address branching. 28</p> 29<p> 30In the sample, the above process occurs in the local functions <code>LinkFar</code> or <code>LinkFarMem2</code>.<br>Get the required buffer size with <code><a href="../RSOGetFarCodeSize.html">RSOGetFarCodeSize</a></code>, allocate the buffer, and then output the instruction code to the buffer with <code><a href="../RSOLinkFar.html">RSOLinkFar</a></code> to link to the buffer. 31</p> 32<p> 33<STRONG>Note:</STRONG> The buffer obtained should be in the same main memory (<CODE>MEM2</CODE> or <CODE>MEM1</CODE>) as the referencing module. In addition, the code in the module is overwritten normally after linking. Thus, when using <code><a href="../RSOLinkList.html">RSOLinkListFixed</a></code>, proceed to <code><a href="../RSOFixedLevel.html">RSO_FL_INTERNAL</a></code> at the deallocation stage. 34</p> 35 36<H2>See Also</H2> 37<p> 38<a href="./demos.html">Sample List</a><br> 39<code><a href="../RSOLinkFar.html">RSOLinkFar</a></code>, 40<code><a href="../RSOGetFarCodeSize.html">RSOGetFarCodeSize</a></code>, 41</p> 42<H2>Revision History</H2> 43<p>2006/09/25 Initial version.</p> 44 45<hr><p>CONFIDENTIAL</p></body> 46</HTML> 47