Newer
Older
UbixOS / doc / html / ld_8c-source.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>UbixOS V2: src/sys/kernel/ld.c Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
  <ul>
    <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="classes.html"><span>Data&nbsp;Structures</span></a></li>
    <li id="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="dirs.html"><span>Directories</span></a></li>
    <li>
      <form action="search.php" method="get">
        <table cellspacing="0" cellpadding="0" border="0">
          <tr>
            <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
            <td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
          </tr>
        </table>
      </form>
    </li>
  </ul></div>
<div class="tabs">
  <ul>
    <li><a href="files.html"><span>File&nbsp;List</span></a></li>
    <li><a href="globals.html"><span>Globals</span></a></li>
  </ul></div>
<div class="nav">
<a class="el" href="dir_897b6a2d7bab147dd1db58381aad3984.html">src</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_832905b1f7f5feaf61a306b40c0ac817.html">sys</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_7efffd2b1fae7bb6f2aa85845c863494.html">kernel</a></div>
<h1>ld.c</h1><a href="ld_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*****************************************************************************************</span>
<a name="l00002"></a>00002 <span class="comment"> Copyright (c) 2002-2004 The UbixOS Project</span>
<a name="l00003"></a>00003 <span class="comment"> All rights reserved.</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment"> Redistribution and use in source and binary forms, with or without modification, are</span>
<a name="l00006"></a>00006 <span class="comment"> permitted provided that the following conditions are met:</span>
<a name="l00007"></a>00007 <span class="comment"></span>
<a name="l00008"></a>00008 <span class="comment"> Redistributions of source code must retain the above copyright notice, this list of</span>
<a name="l00009"></a>00009 <span class="comment"> conditions, the following disclaimer and the list of authors.  Redistributions in binary</span>
<a name="l00010"></a>00010 <span class="comment"> form must reproduce the above copyright notice, this list of conditions, the following</span>
<a name="l00011"></a>00011 <span class="comment"> disclaimer and the list of authors in the documentation and/or other materials provided</span>
<a name="l00012"></a>00012 <span class="comment"> with the distribution. Neither the name of the UbixOS Project nor the names of its</span>
<a name="l00013"></a>00013 <span class="comment"> contributors may be used to endorse or promote products derived from this software</span>
<a name="l00014"></a>00014 <span class="comment"> without specific prior written permission.</span>
<a name="l00015"></a>00015 <span class="comment"></span>
<a name="l00016"></a>00016 <span class="comment"> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY</span>
<a name="l00017"></a>00017 <span class="comment"> EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF</span>
<a name="l00018"></a>00018 <span class="comment"> MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL</span>
<a name="l00019"></a>00019 <span class="comment"> THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span>
<a name="l00020"></a>00020 <span class="comment"> SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT</span>
<a name="l00021"></a>00021 <span class="comment"> OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)</span>
<a name="l00022"></a>00022 <span class="comment"> HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR</span>
<a name="l00023"></a>00023 <span class="comment"> TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS</span>
<a name="l00024"></a>00024 <span class="comment"> SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00025"></a>00025 <span class="comment"></span>
<a name="l00026"></a>00026 <span class="comment"> $Id: ld_8c-source.html 88 2016-01-12 00:11:29Z reddawg $</span>
<a name="l00027"></a>00027 <span class="comment"></span>
<a name="l00028"></a>00028 <span class="comment">*****************************************************************************************/</span>
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 <span class="preprocessor">#include &lt;<a class="code" href="types_8h.html">ubixos/types.h</a>&gt;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &lt;<a class="code" href="ld_8h.html">ubixos/ld.h</a>&gt;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;<a class="code" href="sched_8h.html">ubixos/sched.h</a>&gt;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;<a class="code" href="elf_8h.html">ubixos/elf.h</a>&gt;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;<a class="code" href="kpanic_8h.html">ubixos/kpanic.h</a>&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;<a class="code" href="kprintf_8h.html">lib/kprintf.h</a>&gt;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &lt;<a class="code" href="kmalloc_8h.html">lib/kmalloc.h</a>&gt;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;<a class="code" href="vfs_8h.html">vfs/vfs.h</a>&gt;</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include &lt;<a class="code" href="vmm_8h.html">vmm/vmm.h</a>&gt;</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include &lt;<a class="code" href="string_8h.html">string.h</a>&gt;</span>
<a name="l00040"></a>00040 <span class="preprocessor">#include &lt;<a class="code" href="assert_8h.html">assert.h</a>&gt;</span>
<a name="l00041"></a>00041 
<a name="l00042"></a><a class="code" href="ld_8c.html#b0622e93915d1824df770950e425875f">00042</a> <a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> <a class="code" href="ld_8h.html#b0622e93915d1824df770950e425875f">ldEnable</a>() {
<a name="l00043"></a>00043   <span class="keywordtype">int</span>               i             = 0x0;
<a name="l00044"></a>00044   <span class="keywordtype">int</span>               x             = 0x0;
<a name="l00045"></a>00045   <span class="keywordtype">int</span>               rel           = 0x0;
<a name="l00046"></a>00046   <span class="keywordtype">int</span>               sym           = 0x0;
<a name="l00047"></a>00047   <span class="keywordtype">char</span>             *newLoc        = 0x0; 
<a name="l00048"></a>00048   <span class="keywordtype">char</span>             *shStr         = 0x0;
<a name="l00049"></a>00049   <span class="keywordtype">char</span>             *dynStr        = 0x0;
<a name="l00050"></a>00050   <a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a>           *reMap         = 0x0;
<a name="l00051"></a>00051   <a class="code" href="structfileDescriptorStruct.html">fileDescriptor</a>   *ldFd          = 0x0;
<a name="l00052"></a>00052   <a class="code" href="structelfHeader.html">elfHeader</a>        *binaryHeader  = 0x0;
<a name="l00053"></a>00053   <a class="code" href="structelfProgramHeader.html">elfProgramHeader</a> *programHeader = 0x0;
<a name="l00054"></a>00054   <a class="code" href="structelfSectionHeader.html">elfSectionHeader</a> *sectionHeader = 0x0;
<a name="l00055"></a>00055   <a class="code" href="structelfDynSym.html">elfDynSym</a>        *relSymTab     = 0x0;
<a name="l00056"></a>00056   <a class="code" href="structelfPltInfo.html">elfPltInfo</a>       *elfRel        = 0x0;
<a name="l00057"></a>00057 
<a name="l00058"></a>00058   <span class="comment">/* Open our dynamic linker */</span>
<a name="l00059"></a>00059   ldFd = <a class="code" href="file_8h.html#d6a41ac88a7d46d574e8a675fdde136c">fopen</a>(<span class="stringliteral">"sys:/lib/ld.so"</span>,<span class="stringliteral">"rb"</span>);
<a name="l00060"></a>00060 
<a name="l00061"></a>00061   <span class="keywordflow">if</span> (ldFd == 0x0) {
<a name="l00062"></a>00062     <a class="code" href="kprint_8h.html#b2761bdf0cca73ad0fb5880895210cd8">kprintf</a>(<span class="stringliteral">"Can not open ld.so\n"</span>);
<a name="l00063"></a>00063     }
<a name="l00064"></a>00064  
<a name="l00065"></a>00065   <a class="code" href="file_8h.html#80528d8335cd52755f5d6a92e4f08391">fseek</a>(ldFd,0x0,0x0);
<a name="l00066"></a>00066   binaryHeader = (<a class="code" href="structelfHeader.html">elfHeader</a> *)<a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(<span class="keyword">sizeof</span>(<a class="code" href="structelfHeader.html">elfHeader</a>));
<a name="l00067"></a>00067   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(binaryHeader);
<a name="l00068"></a>00068   <a class="code" href="file_8h.html#3b06878a03209e88c008c77234b89359">fread</a>(binaryHeader,<span class="keyword">sizeof</span>(elfHeader),1,ldFd);
<a name="l00069"></a>00069 
<a name="l00070"></a>00070   programHeader = (<a class="code" href="structelfProgramHeader.html">elfProgramHeader</a> *)<a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(<span class="keyword">sizeof</span>(<a class="code" href="structelfProgramHeader.html">elfProgramHeader</a>)*binaryHeader-&gt;<a class="code" href="structelfHeader.html#4635401868104caa04fcb5bb60840df6">ePhnum</a>);
<a name="l00071"></a>00071   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(programHeader);
<a name="l00072"></a>00072   <a class="code" href="file_8h.html#80528d8335cd52755f5d6a92e4f08391">fseek</a>(ldFd,binaryHeader-&gt;<a class="code" href="structelfHeader.html#aff1ff2cb64932f1e1a1f6cf3b881787">ePhoff</a>,0);
<a name="l00073"></a>00073   <a class="code" href="file_8h.html#3b06878a03209e88c008c77234b89359">fread</a>(programHeader,<span class="keyword">sizeof</span>(<a class="code" href="structelfSectionHeader.html">elfSectionHeader</a>),binaryHeader-&gt;<a class="code" href="structelfHeader.html#4635401868104caa04fcb5bb60840df6">ePhnum</a>,ldFd);
<a name="l00074"></a>00074 
<a name="l00075"></a>00075   sectionHeader = (elfSectionHeader *)<a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(<span class="keyword">sizeof</span>(elfSectionHeader)*binaryHeader-&gt;<a class="code" href="structelfHeader.html#a5b9594ecad96ed7448dbcf95da7895f">eShnum</a>);
<a name="l00076"></a>00076   <a class="code" href="assert_8h.html#d6d5aaa966ca7424f7cb9bd01f2c838b">assert</a>(sectionHeader);
<a name="l00077"></a>00077   <a class="code" href="file_8h.html#80528d8335cd52755f5d6a92e4f08391">fseek</a>(ldFd,binaryHeader-&gt;<a class="code" href="structelfHeader.html#3d8c518903e5e4db018a336edb6ef204">eShoff</a>,0);
<a name="l00078"></a>00078   <a class="code" href="file_8h.html#3b06878a03209e88c008c77234b89359">fread</a>(sectionHeader,<span class="keyword">sizeof</span>(elfSectionHeader),binaryHeader-&gt;<a class="code" href="structelfHeader.html#a5b9594ecad96ed7448dbcf95da7895f">eShnum</a>,ldFd);
<a name="l00079"></a>00079 
<a name="l00080"></a>00080   shStr = (<span class="keywordtype">char</span> *)<a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(sectionHeader[binaryHeader-&gt;<a class="code" href="structelfHeader.html#8842d2d5aed087cd50914a46461d3f40">eShstrndx</a>].shSize);
<a name="l00081"></a>00081   <a class="code" href="file_8h.html#80528d8335cd52755f5d6a92e4f08391">fseek</a>(ldFd,sectionHeader[binaryHeader-&gt;<a class="code" href="structelfHeader.html#8842d2d5aed087cd50914a46461d3f40">eShstrndx</a>].shOffset,0);
<a name="l00082"></a>00082   <a class="code" href="file_8h.html#3b06878a03209e88c008c77234b89359">fread</a>(shStr,sectionHeader[binaryHeader-&gt;<a class="code" href="structelfHeader.html#8842d2d5aed087cd50914a46461d3f40">eShstrndx</a>].shSize,1,ldFd);
<a name="l00083"></a>00083 
<a name="l00084"></a>00084   <span class="keywordflow">for</span> (i = 0x0;i &lt; binaryHeader-&gt;<a class="code" href="structelfHeader.html#4635401868104caa04fcb5bb60840df6">ePhnum</a>;i++) {
<a name="l00085"></a>00085     <span class="keywordflow">switch</span> (programHeader[i].phType) {
<a name="l00086"></a>00086       <span class="keywordflow">case</span> <a class="code" href="elf_8h.html#84d7768fd6c6ece599d297090900cf92">PT_LOAD</a>:
<a name="l00087"></a>00087         newLoc = (<span class="keywordtype">char</span> *)programHeader[i].phVaddr + <a class="code" href="kmod_8h.html#f4d6f389174a00e0de80e1ea0e23e956">LD_START</a>;
<a name="l00088"></a>00088         <span class="comment">/*</span>
<a name="l00089"></a>00089 <span class="comment">        Allocate Memory Im Going To Have To Make This Load Memory With Correct</span>
<a name="l00090"></a>00090 <span class="comment">        Settings so it helps us in the future</span>
<a name="l00091"></a>00091 <span class="comment">        */</span>
<a name="l00092"></a>00092         <span class="keywordflow">for</span> (x=0;x &lt; (programHeader[i].<a class="code" href="structelfProgramHeader.html#b5a140ab0f0225a8459f88d905995dd0">phMemsz</a>);x += 0x1000) {
<a name="l00093"></a>00093           <span class="comment">/* make r/w or ro */</span>
<a name="l00094"></a>00094           <span class="keywordflow">if</span> ((<a class="code" href="paging_8h.html#a05f8d8947fb5bcec87fc6661f83243e">vmm_remapPage</a>(<a class="code" href="vmm_8h.html#976cf3919bf7c77c868021ec9374593b">vmmFindFreePage</a>(<a class="code" href="sched_8h.html#54397bfe18d5da4d50ff03b15f540858">_current</a>-&gt;<a class="code" href="structtaskStruct.html#30966587a60db6b40c8be6c387e11d81">id</a>),((programHeader[i].<a class="code" href="structelfProgramHeader.html#14f11176e999131fb9be875aeb500447">phVaddr</a> &amp; 0xFFFFF000) + x + <a class="code" href="kmod_8h.html#f4d6f389174a00e0de80e1ea0e23e956">LD_START</a>),<a class="code" href="paging_8h.html#f0fff7a38cd2c7a32d580787423b94ea">PAGE_DEFAULT</a>)) == 0x0) 
<a name="l00095"></a>00095             <a class="code" href="kpanic_8h.html#a5193288597f00c4f8e3b2939aa6c0ce">K_PANIC</a>(<span class="stringliteral">"vmmRemapPage: ld"</span>);
<a name="l00096"></a>00096           <a class="code" href="lib_2string_8h.html#ce4b911463887af5e748326323e99a23">memset</a>((<span class="keywordtype">void</span> *)((programHeader[i].phVaddr &amp; 0xFFFFF000) + x + <a class="code" href="kmod_8h.html#f4d6f389174a00e0de80e1ea0e23e956">LD_START</a>),0x0,0<a class="code" href="ap-boot_8S.html#f78b91f02427adef14bb8b28aa93baa5">x1000</a>);
<a name="l00097"></a>00097           }
<a name="l00098"></a>00098         <span class="comment">/* Now Load Section To Memory */</span>
<a name="l00099"></a>00099         <a class="code" href="file_8h.html#80528d8335cd52755f5d6a92e4f08391">fseek</a>(ldFd,programHeader[i].phOffset,0x0);
<a name="l00100"></a>00100         <a class="code" href="file_8h.html#3b06878a03209e88c008c77234b89359">fread</a>(newLoc,programHeader[i].phFilesz,1,ldFd);
<a name="l00101"></a>00101 
<a name="l00102"></a>00102         <span class="keywordflow">break</span>;
<a name="l00103"></a>00103       <span class="keywordflow">case</span> <a class="code" href="elf_8h.html#2121a2f01c51e8462bfd4d47725649d8">PT_DYNAMIC</a>:
<a name="l00104"></a>00104         <span class="comment">/* Now Load Section To Memory */</span>
<a name="l00105"></a>00105         <a class="code" href="file_8h.html#80528d8335cd52755f5d6a92e4f08391">fseek</a>(ldFd,programHeader[i].phOffset,0x0);
<a name="l00106"></a>00106         <a class="code" href="file_8h.html#3b06878a03209e88c008c77234b89359">fread</a>(newLoc,programHeader[i].phFilesz,1,ldFd);
<a name="l00107"></a>00107         <span class="keywordflow">break</span>;
<a name="l00108"></a>00108       <span class="keywordflow">case</span> <a class="code" href="elf_8h.html#f9283bc32e6d3e87d2bab2f55bc1949b">PT_GNU_STACK</a>:
<a name="l00109"></a>00109         <span class="comment">/* Tells us if the stack should be executable.  Failsafe to executable</span>
<a name="l00110"></a>00110 <span class="comment">           until we add checking */</span>
<a name="l00111"></a>00111         <span class="keywordflow">break</span>;
<a name="l00112"></a>00112       <span class="keywordflow">case</span> <a class="code" href="elf_8h.html#7294b5e14e1cf5becf35236381698f48">PT_PAX_FLAGS</a>:
<a name="l00113"></a>00113         <span class="comment">/* Not sure... */</span>
<a name="l00114"></a>00114         <span class="keywordflow">break</span>;
<a name="l00115"></a>00115       <span class="keywordflow">default</span>:
<a name="l00116"></a>00116         <a class="code" href="kprint_8h.html#b2761bdf0cca73ad0fb5880895210cd8">kprintf</a>(<span class="stringliteral">"Unhandled Header (kernel) : %08x\n"</span>, programHeader[i].phType);
<a name="l00117"></a>00117         <span class="keywordflow">break</span>;
<a name="l00118"></a>00118       }
<a name="l00119"></a>00119     }
<a name="l00120"></a>00120 
<a name="l00121"></a>00121   <span class="keywordflow">for</span> (i=0x0;i&lt;binaryHeader-&gt;<a class="code" href="structelfHeader.html#a5b9594ecad96ed7448dbcf95da7895f">eShnum</a>;i++) {
<a name="l00122"></a>00122     <span class="keywordflow">switch</span> (sectionHeader[i].shType) {
<a name="l00123"></a>00123      <span class="keywordflow">case</span> 3:
<a name="l00124"></a>00124         <span class="keywordflow">if</span> (!<a class="code" href="lib_2string_8h.html#6f3dcb20ff11ff9db5904c3cfb61a38c">strcmp</a>((shStr + sectionHeader[i].shName),<span class="stringliteral">".dynstr"</span>)) {
<a name="l00125"></a>00125           dynStr = (<span class="keywordtype">char</span> *)<a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(sectionHeader[i].shSize);
<a name="l00126"></a>00126           <a class="code" href="file_8h.html#80528d8335cd52755f5d6a92e4f08391">fseek</a>(ldFd,sectionHeader[i].shOffset,0x0);
<a name="l00127"></a>00127           <a class="code" href="file_8h.html#3b06878a03209e88c008c77234b89359">fread</a>(dynStr,sectionHeader[i].shSize,1,ldFd);
<a name="l00128"></a>00128           }
<a name="l00129"></a>00129         <span class="keywordflow">break</span>;
<a name="l00130"></a>00130       <span class="keywordflow">case</span> 9:
<a name="l00131"></a>00131         elfRel = (<a class="code" href="structelfPltInfo.html">elfPltInfo</a> *)<a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(sectionHeader[i].shSize);
<a name="l00132"></a>00132         <a class="code" href="file_8h.html#80528d8335cd52755f5d6a92e4f08391">fseek</a>(ldFd,sectionHeader[i].shOffset,0x0);
<a name="l00133"></a>00133         <a class="code" href="file_8h.html#3b06878a03209e88c008c77234b89359">fread</a>(elfRel,sectionHeader[i].shSize,1,ldFd);
<a name="l00134"></a>00134 
<a name="l00135"></a>00135         <span class="keywordflow">for</span> (x=0x0;x&lt;sectionHeader[i].<a class="code" href="structelfSectionHeader.html#285d41cc0ad6e460792b9524c6db5345">shSize</a>/<span class="keyword">sizeof</span>(<a class="code" href="structelfPltInfo.html">elfPltInfo</a>);x++) {
<a name="l00136"></a>00136           rel = <a class="code" href="elf_8h.html#8d1ac0f35a8999a4a8a3350ca95ab54b">ELF32_R_SYM</a>(elfRel[x].pltInfo);
<a name="l00137"></a>00137           reMap = (<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a> *)((<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a>)<a class="code" href="kmod_8h.html#f4d6f389174a00e0de80e1ea0e23e956">LD_START</a> + elfRel[x].pltOffset);
<a name="l00138"></a>00138           <span class="keywordflow">switch</span> (<a class="code" href="elf_8h.html#a4ffd69f2c1c03229686bfa3a898db00">ELF32_R_TYPE</a>(elfRel[x].pltInfo)) {
<a name="l00139"></a>00139             <span class="keywordflow">case</span> <a class="code" href="elf_8h.html#f363b787459afd7e272677d7858572c0">R_386_32</a>:
<a name="l00140"></a>00140               *reMap += ((<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a>)<a class="code" href="kmod_8h.html#f4d6f389174a00e0de80e1ea0e23e956">LD_START</a> + relSymTab[rel].dynValue);
<a name="l00141"></a>00141               <span class="keywordflow">break</span>;
<a name="l00142"></a>00142             <span class="keywordflow">case</span> <a class="code" href="elf_8h.html#d55eb4ccb6e52c4c03f99b34cc8c690b">R_386_PC32</a>:
<a name="l00143"></a>00143               *reMap += ((<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a>)<a class="code" href="kmod_8h.html#f4d6f389174a00e0de80e1ea0e23e956">LD_START</a> + relSymTab[rel].dynValue) - (<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a>)reMap;
<a name="l00144"></a>00144               <span class="keywordflow">break</span>;
<a name="l00145"></a>00145             <span class="keywordflow">case</span> <a class="code" href="elf_8h.html#ee5190154984e6176e1c6804ac13217d">R_386_RELATIVE</a>:
<a name="l00146"></a>00146               *reMap += (<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a>)<a class="code" href="kmod_8h.html#f4d6f389174a00e0de80e1ea0e23e956">LD_START</a>;
<a name="l00147"></a>00147               <span class="keywordflow">break</span>;
<a name="l00148"></a>00148             <span class="keywordflow">default</span>:
<a name="l00149"></a>00149               <a class="code" href="kprint_8h.html#b2761bdf0cca73ad0fb5880895210cd8">kprintf</a>(<span class="stringliteral">"[0x%X][0x%X](%i)[%s]\n"</span>,elfRel[x].pltOffset,elfRel[x].pltInfo,rel,<a class="code" href="elf_8h.html#18371af6e681af62767a92ac64af1ebb">elfGetRelType</a>(<a class="code" href="elf_8h.html#a4ffd69f2c1c03229686bfa3a898db00">ELF32_R_TYPE</a>(elfRel[x].pltInfo)));
<a name="l00150"></a>00150               <a class="code" href="kprint_8h.html#b2761bdf0cca73ad0fb5880895210cd8">kprintf</a>(<span class="stringliteral">"relTab [%s][0x%X][0x%X]\n"</span>,dynStr + relSymTab[rel].dynName,relSymTab[rel].dynValue,relSymTab[rel].dynName);
<a name="l00151"></a>00151               <span class="keywordflow">break</span>;
<a name="l00152"></a>00152             }
<a name="l00153"></a>00153           }
<a name="l00154"></a>00154         <a class="code" href="kmalloc_8h.html#aa9ed6886459604cf73ccdbf6410e487">kfree</a>(elfRel);
<a name="l00155"></a>00155         <span class="keywordflow">break</span>;
<a name="l00156"></a>00156       <span class="keywordflow">case</span> 11:
<a name="l00157"></a>00157         relSymTab = (<a class="code" href="structelfDynSym.html">elfDynSym</a> *)<a class="code" href="kmalloc_8h.html#150eab2ac4ce4553e21ca10e7f441762">kmalloc</a>(sectionHeader[i].shSize);
<a name="l00158"></a>00158         <a class="code" href="file_8h.html#80528d8335cd52755f5d6a92e4f08391">fseek</a>(ldFd,sectionHeader[i].shOffset,0x0);
<a name="l00159"></a>00159         <a class="code" href="file_8h.html#3b06878a03209e88c008c77234b89359">fread</a>(relSymTab,sectionHeader[i].shSize,1,ldFd);
<a name="l00160"></a>00160         sym = i;
<a name="l00161"></a>00161         <span class="keywordflow">break</span>;
<a name="l00162"></a>00162       }
<a name="l00163"></a>00163     }
<a name="l00164"></a>00164 
<a name="l00165"></a>00165   i = binaryHeader-&gt;<a class="code" href="structelfHeader.html#8ff3dd1b27053bc5a2f01afe5403e53b">eEntry</a> + <a class="code" href="kmod_8h.html#f4d6f389174a00e0de80e1ea0e23e956">LD_START</a>;
<a name="l00166"></a>00166 
<a name="l00167"></a>00167   <a class="code" href="kmalloc_8h.html#aa9ed6886459604cf73ccdbf6410e487">kfree</a>(dynStr);
<a name="l00168"></a>00168   <a class="code" href="kmalloc_8h.html#aa9ed6886459604cf73ccdbf6410e487">kfree</a>(shStr);
<a name="l00169"></a>00169   <a class="code" href="kmalloc_8h.html#aa9ed6886459604cf73ccdbf6410e487">kfree</a>(relSymTab);
<a name="l00170"></a>00170   <a class="code" href="kmalloc_8h.html#aa9ed6886459604cf73ccdbf6410e487">kfree</a>(sectionHeader);
<a name="l00171"></a>00171   <a class="code" href="kmalloc_8h.html#aa9ed6886459604cf73ccdbf6410e487">kfree</a>(programHeader);
<a name="l00172"></a>00172   <a class="code" href="kmalloc_8h.html#aa9ed6886459604cf73ccdbf6410e487">kfree</a>(binaryHeader);
<a name="l00173"></a>00173   <a class="code" href="file_8h.html#872c22366b4c63f4bdb10cd3b7980b11">fclose</a>(ldFd);
<a name="l00174"></a>00174 
<a name="l00175"></a>00175   <span class="keywordflow">return</span>((<a class="code" href="types_8h.html#5847ea0262a5aa61eee48cbe95544a78">uInt32</a>)i);
<a name="l00176"></a>00176   }
<a name="l00177"></a>00177 
<a name="l00178"></a>00178 <span class="comment">/***</span>
<a name="l00179"></a>00179 <span class="comment"> END</span>
<a name="l00180"></a>00180 <span class="comment"> ***/</span>
<a name="l00181"></a>00181 
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Dec 15 11:18:55 2006 for UbixOS V2 by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>