⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c-loader9.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<td colspan=1 rowspan=1><div class="CellBody"><a name="88057"> </a> <b class="library">aoutSparc</b> </div></td><td width="10">&nbsp;</td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="88084"> </a><i class="acronym_lc">a.out</i> </div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="88086"> </a>X86 </div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="88088"> </a>Aout - X86 </div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBody"><a name="88082"> </a><b class="library">aoutX86</b> </div></td><td width="10">&nbsp;</td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="88059"> </a>COFF </div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="88061"> </a> I960JX </div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="88063"> </a> coff - I960   </div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBody"><a name="88065"> </a> <b class="library">coffI960</b> </div></td><td width="10">&nbsp;</td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="88067"> </a>COFF </div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="88069"> </a> ARM7TDMI </div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="88071"> </a> coff - Arm </div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBody"><a name="88074"> </a> <b class="library">coffArm</b> </div></td><td width="10">&nbsp;</td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="88106"> </a>ELF </div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="88108"> </a> PowerPC </div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="88110"> </a> Elf - Ppc </div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBody"><a name="88104"> </a><b class="library">elfPpc</b> </div></td><td width="10">&nbsp;</td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="88112"> </a>ELF </div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="88114"> </a>MIPS </div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="88116"> </a>Elf - Mips </div></td><td width="10">&nbsp;</td><td colspan=1 rowspan=1><div class="CellBody"><a name="88096"> </a><b class="library">elfMips</b> </div></td><td width="10">&nbsp;</td></tr><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p></p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="85280">3.9.4  &nbsp;&nbsp;The RU Interface</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85283"> </a>Relocation is highly dependent on both the OMF and the target architecture. This is why the relocation unit is a separate shared library. Only one relocator can be used at a time with a given target, so only one relocation unit is linked into the target server at run-time. The relocation unit is loaded during the OMF initialization phase (see <a href="c-loader9.html#85369"><i class="title">loadOmfFmtInit(&nbsp;)</i> on p. 114</a>).</p><dd><p class="Body"><a name="85287"> </a>Each relocation unit must contain the following two interface routines or entry points:</p></dl><dl class="margin"><ul class="DashSingle" type="circle"><li><a name="85288"> </a><i class="textVariable">omfcpu</i><b class="routine"><i class="routine">SegReloc</i></b><b>(&nbsp;)</b><b class="routine"><i class="routine"> </i></b></li></ul><ul class="DashSingle" type="circle"><li><a name="85289"> </a><i class="textVariable">omfcpu</i><b class="routine"><i class="routine">ModuleVerify</i></b><b>(&nbsp;)</b><b class="routine"><i class="routine"> </i></b></li></ul></dl><dl class="margin"><dd><p class="Body"><a name="85291"> </a>It may also contain an optional initialization routine:</p></dl><dl class="margin"><ul class="DashSingle" type="circle"><li><a name="85292"> </a><i class="textVariable">omfcpu</i><b class="routine"><i class="routine">RelocInit</i></b><b>(&nbsp;)</b></li></ul></dl></dl><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="85294"><i class="textVariable">omfcpu</i><b class="routine"><i class="routine">RelocInit</i></b><b>(&nbsp;)</b><b class="routine"><i class="routine"> </i></b></a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="85295"> </a>This optional routine, if it exists in the relocation unit, is the first entry point. Its purpose is to enable the relocation unit to initialize itself.</p></dl><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="88144"><i class="textVariable">omfcpu</i><b class="routine"><i class="routine">ModuleVerify</i></b><b>(&nbsp;)</b><b class="routine"><i class="routine"> </i></b></a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="88145"> </a>This routine is the first entry point if there is no optional routine; it checks whether or not the given module is for the current target CPU.</p><dl class="margin"><dd><pre class="Code2"><b><a name="85298">BOOL <i class="term">omfcpu</i>ModuleVerify (uint32 machtype, BOOL * pSwapIsRequired);</a></b></pre></dl><dd><p class="Body"><a name="86452"> </a>The input parameter is:</p></dl><dl class="margin"><dd><div class="Item"><a name="86467"> </a><b class="symbol_lc">uint32 machtype</b> </div><dl class="margin"><dd><div class="Indent"><a name="86468"> </a>The Module's magic number.</div><br></dl></dl><dl class="margin"><dd><p class="Body"><a name="85307"> </a>The output parameter is:</p></dl><dl class="margin"><dd><div class="Item"><a name="85308"> </a><b class="symbol_UC">BOOL </b><b class="symbol_lc">* pSwapIsRequired</b></div><dl class="margin"><dd><div class="Indent"><a name="85309"> </a>A pointer to a boolean saying if object module is in the opposite byte order and requires that all information be swapped.</div><br></dl></dl><dl class="margin"><dd><p class="Body"><a name="85310"> </a>The return value is:</p></dl><dl class="margin"><dd><div class="Item"><a name="85311"> </a><b class="symbol_UC">STATUS</b> </div><dl class="margin"><dd><div class="Indent"><a name="85312"> </a><b class="symbol_UC">TRUE </b>or <b class="symbol_UC">FALSE</b>. </div><br></dl></dl><dl class="margin"><dd><p class="Body"><a name="85313"> </a>This routine is the underlying routine called by <b class="routine"><i class="routine">load</i></b><i class="term">Omf</i><b class="routine"><i class="routine">ModuleIsOk</i></b><b>(&nbsp;)</b><b> </b>(see <a href="c-loader9.html#85514">Example&nbsp;3-4</a>). </p></dl></dl><h4 class="EntityTitle"><a name="85317"><font face="Helvetica, sans-serif" size="-1" class="sans">Example 3-1:&nbsp;&nbsp;<i class="term">omfcpu</i><b class="routine"><i class="routine">ModuleVerify </i></b><b>(&nbsp;)</b> </font></a></h4><dl class="margin"><dl class="margin"><dd><pre class="Code"><b><a name="86595">/************************************************************************ * * <i class="textVariable">omfcpu</i>ModuleVerify - check the object module format for cpu target * * This routine contains the heuristic required to determine if the object * file belongs to the OMF handled by this OMF reader, with care for the * target architecture. * * It is the underlying routine for loadomfModuleIsOk(). * * RETURNS: TRUE or FALSE if the object module can't be handled. */  BOOL <i class="textVariable">omfcpu</i>FoduleVerify     (     UINT16 &nbsp;magicNumber,    /* Module's magic number */     BOOL * &nbsp;SwapIsRequired  /* TRUE if header fields must be swapped */     )     {     BOOL &nbsp;&nbsp;&nbsp;moduleIsForTarget = FALSE; /* TRUE if intended for target*/      *SwapIsRequired = FALSE;      switch(magicNumber)         {         case (SWAB_16 (MYCPUMAGIC)):             *SwapIsRequired = TRUE;             break;          case (MYCPUMAGIC):             moduleIsForTarget = TRUE;             break;          default :             errno = WTX_ERR_LOADER_UNKNOWN_OBJ_MODULE_FORMAT;     }     return moduleIsForTarget;     }</a></b></pre></dl></dl><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="85353"><i class="term">omfcpu</i><b class="routine"><i class="routine">SegReloc</i></b><b>(&nbsp;)</b> </a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="85354"> </a>This routine performs the relocation of a given segment. The relocation process is explained in <a href="c-loader9.html#85910"><i class="title">3.9.14&nbsp;Relocating the Object Modules</i></a>, and an example of a segment relocator is also explained in <a href="c-loader9.html#85954">Example&nbsp;3-14</a>. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="85362">3.9.5  &nbsp;&nbsp;The OMF Interface</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85364"> </a>Each OMF manager must contain the following three interface routines or entry points:</p></dl><dl class="margin"><ul class="DashSingle" type="circle"><li><a name="85365"> </a><b class="routine"><i class="routine">load</i></b><i class="term">Omf</i><b class="routine"><i class="routine">FmtInit</i></b><b>(&nbsp;)</b> </li></ul><ul class="DashSingle" type="circle"><li><a name="85366"> </a><b class="routine"><i class="routine">load</i></b><i class="term">Omf</i><b class="routine"><i class="routine">FmtCheck</i></b><b>(&nbsp;)</b> </li></ul><ul class="DashSingle" type="circle"><li><a name="85367"> </a><b class="routine"><i class="routine">load</i></b><i class="term">Omf</i><b class="routine"><i class="routine">FmtManage</i></b><b>(&nbsp;)</b></li></ul></dl></dl><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="85369"><b class="routine"><i class="routine">load</i></b><i class="term">Omf</i><b class="routine"><i class="routine">FmtInit</i></b><b>(&nbsp;)</b> </a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="85370"> </a>This routine is the first entry point; it loads the correct relocation unit for the current target CPU.</p><dl class="margin"><dd><pre class="Code2"><b><a name="85371">STATUS load<i class="textVariable">Omf</i>FmtInit (void)</a></b></pre></dl><dd><p class="Body"><a name="85372"> </a>The return value is:</p></dl><dl class="margin"><dd><div class="Item"><a name="85373"> </a><b class="symbol_UC">STATUS</b> </div><dl class="margin"><dd><div class="Indent"><a name="85374"> </a><b class="symbol_UC">OK</b> or <b class="symbol_UC">ERROR</b>. (See <i class="textVariable">installDir</i><b class="file">/host/include/host.h</b> for a description of error types and macros.)</div><br></dl></dl></dl><h4 class="EntityTitle"><a name="85376"><font face="Helvetica, sans-serif" size="-1" class="sans">Example 3-2:&nbsp;&nbsp;<b class="routine"><i class="routine">load</i></b><i class="term">Omf</i><b class="routine"><i class="routine">FmtInit</i></b><b>(&nbsp;)</b> </font></a></h4><dl class="margin"><dl class="margin"><dd><pre class="Code"><b><a name="86657">/************************************************************************ 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -