Newer
Older
ubixos-pre / doc / doxygen / html / elf_8h-source.html
@reddawg reddawg on 18 Jun 2004 10 KB UbixOS PreRelease
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Ubixos: elf.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.3 -->
<h1>elf.h</h1><div class="fragment"><pre>00001 <span class="comment">/**************************************************************************************</span>
00002 <span class="comment"> Copyright (c) 2002 The UbixOS Project</span>
00003 <span class="comment"> All rights reserved.</span>
00004 <span class="comment"></span>
00005 <span class="comment">Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</span>
00006 <span class="comment"></span>
00007 <span class="comment">Redistributions of source code must retain the above copyright notice, this list of conditions, the following disclaimer and the list of authors.</span>
00008 <span class="comment">Redistributions in binary form must reproduce the above copyright notice, this list of conditions, the following disclaimer and the list of authors</span>
00009 <span class="comment">in the documentation and/or other materials provided with the distribution. Neither the name of the UbixOS Project nor the names of its</span>
00010 <span class="comment">contributors may be used to endorse or promote products derived from this software without specific prior written permission.</span>
00011 <span class="comment"></span>
00012 <span class="comment">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span>
00013 <span class="comment">WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR</span>
00014 <span class="comment">PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,</span>
00015 <span class="comment">INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE</span>
00016 <span class="comment">GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY</span>
00017 <span class="comment">OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY</span>
00018 <span class="comment">OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
00019 <span class="comment"></span>
00020 <span class="comment"> $Id$</span>
00021 <span class="comment"></span>
00022 <span class="comment">**************************************************************************************/</span>
00023 
00024 <span class="preprocessor">#ifndef _ELF_H</span>
00025 <span class="preprocessor"></span><span class="preprocessor">#define _ELF_H</span>
00026 <span class="preprocessor"></span>
00027 <span class="preprocessor">#include &lt;ubixos/types.h&gt;</span>
00028 
00029 <span class="preprocessor">#define elfExecutable 0x002</span>
00030 <span class="preprocessor"></span><span class="preprocessor">#define elfLibrary    0x003</span>
00031 <span class="preprocessor"></span>
00032 
00033 <span class="comment">/* Elf Types */</span>
00034 <span class="preprocessor">#define ET_NONE         0  // No file type</span>
00035 <span class="preprocessor"></span><span class="preprocessor">#define ET_REL          1  // Relocatable file</span>
00036 <span class="preprocessor"></span><span class="preprocessor">#define ET_EXEC         2  // Executable file</span>
00037 <span class="preprocessor"></span><span class="preprocessor">#define ET_DYN          3  // Shared object file</span>
00038 <span class="preprocessor"></span><span class="preprocessor">#define ET_CORE         4  // Core file</span>
00039 <span class="preprocessor"></span><span class="preprocessor">#define ET_LOPROC  0xff00  // Processor-specific</span>
00040 <span class="preprocessor"></span><span class="preprocessor">#define ET_HIPROC  0xffff</span>
00041 <span class="preprocessor"></span><span class="comment">/* End Elf Types */</span>
00042 
00043 <span class="comment">/* Elf Machine Types */</span>
00044 <span class="preprocessor">#define EM_NONE       0  // No machine</span>
00045 <span class="preprocessor"></span><span class="preprocessor">#define EM_M32        1  // AT&amp;T WE 32100</span>
00046 <span class="preprocessor"></span><span class="preprocessor">#define EM_SPARC      2  // SPARC</span>
00047 <span class="preprocessor"></span><span class="preprocessor">#define EM_386        3  // Intel 80386</span>
00048 <span class="preprocessor"></span><span class="preprocessor">#define EM_68K        4  // Motorola 68000</span>
00049 <span class="preprocessor"></span><span class="preprocessor">#define EM_88K        5  // Motorola 88000</span>
00050 <span class="preprocessor"></span><span class="preprocessor">#define EM_860        7  // Intel 80860</span>
00051 <span class="preprocessor"></span><span class="preprocessor">#define EM_MIPS       8  // MIPS RS3000</span>
00052 <span class="preprocessor"></span><span class="comment">/* End Elf Machines Types */</span>
00053 
00054 <span class="comment">/* Elf Version */</span>
00055 <span class="preprocessor">#define EV_NONE          0  // Invalid version</span>
00056 <span class="preprocessor"></span><span class="preprocessor">#define EV_CURRENT       1  // Current version</span>
00057 <span class="preprocessor"></span><span class="comment">/* End Elf Version */</span>
00058 
00059 <span class="comment">/* Elf Program Header Types */</span>
00060 <span class="preprocessor">#define PT_NULL          0</span>
00061 <span class="preprocessor"></span><span class="preprocessor">#define PT_LOAD          1</span>
00062 <span class="preprocessor"></span><span class="preprocessor">#define PT_DYNAMIC       2</span>
00063 <span class="preprocessor"></span><span class="comment">/* End Elf Program Header Types */</span>
00064 
00065 <span class="keyword">typedef</span> <span class="keyword">struct </span>{
00066   uChar  eIdent[16]; <span class="comment">/* File identification. */</span>
00067   uShort eType;      <span class="comment">/* File type. */</span>
00068   uShort eMachine;   <span class="comment">/* Machine architecture. */</span>
00069   uLong  eVersion;   <span class="comment">/* ELF format version. */</span>
00070   uLong  eEntry;     <span class="comment">/* Entry point. */</span>
00071   uLong  ePhoff;     <span class="comment">/* Program header file offset. */</span>
00072   uLong  eShoff;     <span class="comment">/* Section header file offset. */</span>
00073   uLong  eFlags;     <span class="comment">/* Architecture-specific flags. */</span>
00074   uShort eEhsize;    <span class="comment">/* Size of ELF header in bytes. */</span>
00075   uShort ePhentsize; <span class="comment">/* Size of program header entry. */</span>
00076   uShort ePhnum;     <span class="comment">/* Number of program header entries. */</span>
00077   uShort eShentsize; <span class="comment">/* Size of section header entry. */</span>
00078   uShort eShnum;     <span class="comment">/* Number of section header entries. */</span>
00079   uShort eShstrndx;  <span class="comment">/* Section name strings section. */</span>
00080   } elfHeader;
00081 
00082 <span class="keyword">typedef</span> <span class="keyword">struct </span>{
00083   uLong phType;         <span class="comment">/* Entry type. */</span>
00084   uLong phOffset;       <span class="comment">/* File offset of contents. */</span>
00085   uLong phVaddr;        <span class="comment">/* Virtual address in memory image. */</span>
00086   uLong phPaddr;        <span class="comment">/* Physical address (not used). */</span>
00087   uLong phFilesz;       <span class="comment">/* Size of contents in file. */</span>
00088   uLong phMemsz;        <span class="comment">/* Size of contents in memory. */</span>
00089   uLong phFlags;        <span class="comment">/* Access permission flags. */</span>
00090   uLong phAlign;        <span class="comment">/* Alignment in memory and file. */</span>
00091   } elfProgramheader;
00092 
00093 <span class="keyword">typedef</span> <span class="keyword">struct </span>{
00094   uLong shName;        <span class="comment">/* Section name (index into the section header string table). */</span>
00095   uLong shType;        <span class="comment">/* Section type. */</span>
00096   uLong shFlags;       <span class="comment">/* Section flags. */</span>
00097   uLong shAddr;        <span class="comment">/* Address in memory image. */</span>
00098   uLong shOffset;      <span class="comment">/* Offset in file. */</span>
00099   uLong shSize;        <span class="comment">/* Size in bytes. */</span>
00100   uLong shLink;        <span class="comment">/* Index of a related section. */</span>
00101   uLong shInfo;        <span class="comment">/* Depends on section type. */</span>
00102   uLong shAddralign;   <span class="comment">/* Alignment in bytes. */</span>
00103   uLong shEntsize;     <span class="comment">/* Size of each entry in section. */</span>
00104   } elfSectionheader;
00105 
00106 <span class="keyword">typedef</span> <span class="keyword">struct </span>{
00107   uLong pltOffset;
00108   uLong pltInfo;
00109   } elfPltInfo;
00110 
00111 <span class="keyword">typedef</span> <span class="keyword">struct </span>{
00112   uLong dynName;
00113   uLong dynValue;
00114   uLong dynSize;
00115   uLong dynInfo;
00116   } elfDynsym;
00117 
00118 <span class="keyword">typedef</span> <span class="keyword">struct </span>{
00119   uInt32 dynVal;
00120   uInt32 dynPtr;
00121   } elfDynamic;
00122 
00123 <span class="keywordtype">char</span> *elfGetShType(<span class="keywordtype">int</span>);
00124 <span class="keywordtype">char</span> *elfGetPhType(<span class="keywordtype">int</span>);
00125 
00126 <span class="preprocessor">#endif</span>
00127 <span class="preprocessor"></span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Wed Apr 28 17:49:33 2004 for Ubixos by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
</a>1.3.3 </small></address>
</body>
</html>