<!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/include/sys/gdt.h 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 Page</span></a></li> <li><a href="classes.html"><span>Data 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> <u>S</u>earch for </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 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> » <a class="el" href="dir_832905b1f7f5feaf61a306b40c0ac817.html">sys</a> » <a class="el" href="dir_caf4200c438ae9601464168e21e8e4d8.html">include</a> » <a class="el" href="dir_d26f37d6397a53073c964316867e8d67.html">sys</a></div> <h1>gdt.h</h1><a href="gdt_8h.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: gdt_8h-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">#ifndef _GDT_H</span> <a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#define _GDT_H</span> <a name="l00032"></a>00032 <span class="preprocessor"></span> <a name="l00033"></a>00033 <span class="comment">/* Descriptor Definitions */</span> <a name="l00034"></a><a class="code" href="gdt_8h.html#84806600e03a4a34f20aeb9cdacdb4f9">00034</a> <span class="preprocessor">#define dCall 0x0C00 </span><span class="comment">/* 386 Call Gate */</span> <a name="l00035"></a><a class="code" href="gdt_8h.html#f37890c8c59b0fd3d83cea8d6034a035">00035</a> <span class="preprocessor">#define dCode 0x1800 </span><span class="comment">/* Code Segment */</span> <a name="l00036"></a><a class="code" href="gdt_8h.html#fcbb50cc521f6214eda9bca84aaee513">00036</a> <span class="preprocessor">#define dData 0x1000 </span><span class="comment">/* Data Segment */</span> <a name="l00037"></a><a class="code" href="gdt_8h.html#7eb6dc7004c613df58764da5df7d85d8">00037</a> <span class="preprocessor">#define dInt 0x0E00 </span><span class="comment">/* 386 Interrupt Gate */</span> <a name="l00038"></a><a class="code" href="gdt_8h.html#5ebc94affcfbf066336ac0910680345e">00038</a> <span class="preprocessor">#define dLdt 0x200 </span><span class="comment">/* Local Descriptor Table (LDT) */</span> <a name="l00039"></a><a class="code" href="gdt_8h.html#1521354f2c1fc307021a9a75dfc805f8">00039</a> <span class="preprocessor">#define dTask 0x500 </span><span class="comment">/* Task gate */</span> <a name="l00040"></a><a class="code" href="gdt_8h.html#b566353a8383ed84a5d0328677dc05dd">00040</a> <span class="preprocessor">#define dTrap 0x0F00 </span><span class="comment">/* 386 Trap Gate */</span> <a name="l00041"></a><a class="code" href="gdt_8h.html#4d5c962ea8bc3d8422e6c3b92ce4b74f">00041</a> <span class="preprocessor">#define dTss 0x900 </span><span class="comment">/* Task State Segment (TSS) */</span> <a name="l00042"></a>00042 <a name="l00043"></a>00043 <span class="comment">/* Descriptor Options */</span> <a name="l00044"></a><a class="code" href="gdt_8h.html#2e29d1e158d5e81dc70dfae75f17d7f4">00044</a> <span class="preprocessor">#define dDpl3 0x6000 </span><span class="comment">/* DPL3 or mask for DPL */</span> <a name="l00045"></a><a class="code" href="gdt_8h.html#609771e14bb3788ff7586d3d7a58fb62">00045</a> <span class="preprocessor">#define dDpl2 0x4000 </span><span class="comment">/* DPL2 or mask for DPL */</span> <a name="l00046"></a><a class="code" href="gdt_8h.html#ace18aa461784b516613570ef3e369a8">00046</a> <span class="preprocessor">#define dDpl1 0x2000 </span><span class="comment">/* DPL1 or mask for DPL */</span> <a name="l00047"></a><a class="code" href="gdt_8h.html#5ee8638767e24765a2690483745d60d0">00047</a> <span class="preprocessor">#define dDpl0 0x0000 </span><span class="comment">/* DPL0 or mask for DPL */</span> <a name="l00048"></a><a class="code" href="gdt_8h.html#be5eb76416aff1d9114e1cdb8b0797fe">00048</a> <span class="preprocessor">#define dPresent 0x8000 </span><span class="comment">/* Present */</span> <a name="l00049"></a><a class="code" href="gdt_8h.html#98924c500f63ccfe4e9566ee472490e2">00049</a> <span class="preprocessor">#define dNpresent 0x8000 </span><span class="comment">/* Not Present */</span> <a name="l00050"></a><a class="code" href="gdt_8h.html#ad9c89b1e259b5cf08fd3610fd721402">00050</a> <span class="preprocessor">#define dAcc 0x100 </span><span class="comment">/* Accessed (Data or Code) */</span> <a name="l00051"></a><a class="code" href="gdt_8h.html#9785c919d49cacd1b0fa92590a7562c8">00051</a> <span class="preprocessor">#define dWrite 0x200 </span><span class="comment">/* Writable (Data segments only) */</span> <a name="l00052"></a><a class="code" href="gdt_8h.html#4427d6b09e5682b1c554a5a61e9bee55">00052</a> <span class="preprocessor">#define dRead 0x200 </span><span class="comment">/* Readable (Code segments only) */</span> <a name="l00053"></a><a class="code" href="gdt_8h.html#bd5637ceae4810b07f63f34a6efe3af0">00053</a> <span class="preprocessor">#define dBusy 0xB00 </span><span class="comment">/* Busy (TSS only) was 200 */</span> <a name="l00054"></a><a class="code" href="gdt_8h.html#06255d29c48480c11a63195508ce39b5">00054</a> <span class="preprocessor">#define dEexdown 0x400 </span><span class="comment">/* Expand down (Data segments only) */</span> <a name="l00055"></a><a class="code" href="gdt_8h.html#a8b04f84cbfdce2f778108416f654650">00055</a> <span class="preprocessor">#define dConform 0x400 </span><span class="comment">/* Conforming (Code segments only) */</span> <a name="l00056"></a><a class="code" href="gdt_8h.html#6b595357c10a17c620edcbeeb1c7f6a1">00056</a> <span class="preprocessor">#define dBig 0x40 </span><span class="comment">/* Default to 32 bit mode */</span> <a name="l00057"></a><a class="code" href="gdt_8h.html#bc269d96e027bb39b828cadb2fc8660f">00057</a> <span class="preprocessor">#define dBiglim 0x80 </span><span class="comment">/* Limit is in 4K units */</span> <a name="l00058"></a>00058 <a name="l00059"></a>00059 <span class="comment">/* GDT Descriptor */</span> <a name="l00060"></a><a class="code" href="structgdtDescriptor.html">00060</a> <span class="keyword">struct </span><a class="code" href="structgdtDescriptor.html">gdtDescriptor</a> { <a name="l00061"></a><a class="code" href="structgdtDescriptor.html#3b6f25eeaf186c263985eabffb96cb1a">00061</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="structgdtDescriptor.html#3b6f25eeaf186c263985eabffb96cb1a">limitLow</a>; <span class="comment">/* Limit 0..15 */</span> <a name="l00062"></a><a class="code" href="structgdtDescriptor.html#d8fb7196c3b0b2d15ebbc0d20006d0a8">00062</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="structgdtDescriptor.html#d8fb7196c3b0b2d15ebbc0d20006d0a8">baseLow</a>; <span class="comment">/* Base 0..15 */</span> <a name="l00063"></a><a class="code" href="structgdtDescriptor.html#ef125e8406580a85d2201c2d63245575">00063</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="structgdtDescriptor.html#ef125e8406580a85d2201c2d63245575">baseMed</a>; <span class="comment">/* Base 16..23 */</span> <a name="l00064"></a><a class="code" href="structgdtDescriptor.html#e0bca342b5caa6d39826f21fc9ac4d56">00064</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="structgdtDescriptor.html#e0bca342b5caa6d39826f21fc9ac4d56">access</a>; <span class="comment">/* Access Byte */</span> <a name="l00065"></a><a class="code" href="structgdtDescriptor.html#8f380d84a88a1982542a08fd9b53698f">00065</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structgdtDescriptor.html#8f380d84a88a1982542a08fd9b53698f">limitHigh</a>:4; <span class="comment">/* Limit 16..19 */</span> <a name="l00066"></a><a class="code" href="structgdtDescriptor.html#1c5e6d9ddc74b0998b968a383e5f314c">00066</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structgdtDescriptor.html#1c5e6d9ddc74b0998b968a383e5f314c">granularity</a>:4; <span class="comment">/* Granularity */</span> <a name="l00067"></a><a class="code" href="structgdtDescriptor.html#2cd45ddaee984e45ef519b5f96cb4151">00067</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="structgdtDescriptor.html#2cd45ddaee984e45ef519b5f96cb4151">baseHigh</a>; <span class="comment">/* Base 24..31 */</span> <a name="l00068"></a>00068 } __attribute__ ((<a class="code" href="gdt_8h.html#a8e25552752eade51544ff9e9fbd7bdf">packed</a>)); <a name="l00069"></a>00069 <a name="l00070"></a><a class="code" href="structgdtGate.html">00070</a> <span class="keyword">struct </span><a class="code" href="structgdtGate.html">gdtGate</a> { <a name="l00071"></a><a class="code" href="structgdtGate.html#bc0d1d719871949fd4a56d71ba97076e">00071</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="structgdtGate.html#bc0d1d719871949fd4a56d71ba97076e">offsetLow</a>; <span class="comment">/* Offset 0..15 */</span> <a name="l00072"></a><a class="code" href="structgdtGate.html#71d7780bce5bd08890088cab94d6c415">00072</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="structgdtGate.html#71d7780bce5bd08890088cab94d6c415">selector</a>; <span class="comment">/* Selector */</span> <a name="l00073"></a><a class="code" href="structgdtGate.html#78486d8b9aa678859910a54e16ca043c">00073</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="structgdtGate.html#78486d8b9aa678859910a54e16ca043c">access</a>; <span class="comment">/* Access Flags */</span> <a name="l00074"></a><a class="code" href="structgdtGate.html#acfb0c1ac599c92b3aa941bbf146cab6">00074</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="structgdtGate.html#acfb0c1ac599c92b3aa941bbf146cab6">offsetHigh</a>; <span class="comment">/* Offset 16..31 */</span> <a name="l00075"></a>00075 } __attribute__ ((<a class="code" href="gdt_8h.html#a8e25552752eade51544ff9e9fbd7bdf">packed</a>)); <a name="l00076"></a>00076 <a name="l00077"></a><a class="code" href="uniondescriptorTableUnion.html">00077</a> <span class="keyword">union </span><a class="code" href="uniondescriptorTableUnion.html">descriptorTableUnion</a> { <a name="l00078"></a><a class="code" href="uniondescriptorTableUnion.html#5c0b66fcfd449657154ad846df5cf701">00078</a> <span class="keyword">struct </span><a class="code" href="structgdtDescriptor.html">gdtDescriptor</a> <a class="code" href="uniondescriptorTableUnion.html#5c0b66fcfd449657154ad846df5cf701">descriptor</a>; <span class="comment">/* Normal descriptor */</span> <a name="l00079"></a><a class="code" href="uniondescriptorTableUnion.html#6040720faa184813d93d2521a9558e5d">00079</a> <span class="keyword">struct </span><a class="code" href="structgdtGate.html">gdtGate</a> <a class="code" href="uniondescriptorTableUnion.html#6040720faa184813d93d2521a9558e5d">gate</a>; <span class="comment">/* Gate descriptor */</span> <a name="l00080"></a><a class="code" href="uniondescriptorTableUnion.html#088ef1c7d8872dc929903de980a91b86">00080</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="uniondescriptorTableUnion.html#088ef1c7d8872dc929903de980a91b86">dummy</a>; <span class="comment">/* Any other info */</span> <a name="l00081"></a>00081 }; <a name="l00082"></a>00082 <a name="l00083"></a>00083 <a name="l00084"></a><a class="code" href="gdt_8h.html#f3cff64995ffb5584c82c7bf27ee802d">00084</a> <span class="preprocessor">#define ubixDescriptorTable(name,length) union descriptorTableUnion name[length] =</span> <a name="l00085"></a><a class="code" href="gdt_8h.html#c84a835fad3118c457254bf67013ad5b">00085</a> <span class="preprocessor"></span><span class="preprocessor">#define ubixStandardDescriptor(base, limit, control) {descriptor: \</span> <a name="l00086"></a>00086 <span class="preprocessor"> {(limit & 0xffff), \</span> <a name="l00087"></a>00087 <span class="preprocessor"> (base & 0xffff), \</span> <a name="l00088"></a>00088 <span class="preprocessor"> ((base >> 16) & 0xff), \</span> <a name="l00089"></a>00089 <span class="preprocessor"> ((control+dPresent) >> 8), \</span> <a name="l00090"></a>00090 <span class="preprocessor"> (limit >> 16), \</span> <a name="l00091"></a>00091 <span class="preprocessor"> ((control & 0xff) >> 4), \</span> <a name="l00092"></a>00092 <span class="preprocessor"> (base >> 24)}}</span> <a name="l00093"></a><a class="code" href="gdt_8h.html#7eb57f465bcbf5080c587a469a3a5a08">00093</a> <span class="preprocessor"></span><span class="preprocessor">#define ubixGateDescriptor(offset, selector, control) {gate: {(offset & 0xffff), selector, \</span> <a name="l00094"></a>00094 <span class="preprocessor"> (control+dPresent), (offset >> 16) }}</span> <a name="l00095"></a>00095 <span class="preprocessor"></span> <a name="l00096"></a>00096 <span class="keyword">extern</span> <span class="keyword">union </span><a class="code" href="uniondescriptorTableUnion.html">descriptorTableUnion</a> ubixGDT[9]; <a name="l00097"></a>00097 <a name="l00098"></a>00098 <span class="preprocessor">#endif</span> <a name="l00099"></a>00099 <span class="preprocessor"></span> <a name="l00100"></a>00100 <span class="comment">/***</span> <a name="l00101"></a>00101 <span class="comment"> $Log: gdt_8h-source.html,v $ <a name="l00101"></a>00101 <span class="comment"> Revision 1.7 2006/12/15 17:47:05 reddawg <a name="l00101"></a>00101 <span class="comment"> Updates <a name="l00101"></a>00101 <span class="comment"></span> <a name="l00102"></a>00102 <span class="comment"> Revision 1.1.1.1 2006/06/01 12:46:15 reddawg</span> <a name="l00103"></a>00103 <span class="comment"> ubix2</span> <a name="l00104"></a>00104 <span class="comment"></span> <a name="l00105"></a>00105 <span class="comment"> Revision 1.2 2005/10/12 00:13:37 reddawg</span> <a name="l00106"></a>00106 <span class="comment"> Removed</span> <a name="l00107"></a>00107 <span class="comment"></span> <a name="l00108"></a>00108 <span class="comment"> Revision 1.1.1.1 2005/09/26 17:23:52 reddawg</span> <a name="l00109"></a>00109 <span class="comment"> no message</span> <a name="l00110"></a>00110 <span class="comment"></span> <a name="l00111"></a>00111 <span class="comment"> Revision 1.5 2004/08/15 16:47:49 reddawg</span> <a name="l00112"></a>00112 <span class="comment"> Fixed</span> <a name="l00113"></a>00113 <span class="comment"></span> <a name="l00114"></a>00114 <span class="comment"> Revision 1.4 2004/07/22 20:53:07 reddawg</span> <a name="l00115"></a>00115 <span class="comment"> atkbd: fixed problem</span> <a name="l00116"></a>00116 <span class="comment"></span> <a name="l00117"></a>00117 <span class="comment"> Revision 1.3 2004/05/21 15:12:17 reddawg</span> <a name="l00118"></a>00118 <span class="comment"> Cleaned up</span> <a name="l00119"></a>00119 <span class="comment"></span> <a name="l00120"></a>00120 <span class="comment"></span> <a name="l00121"></a>00121 <span class="comment"> END</span> <a name="l00122"></a>00122 <span class="comment"> ***/</span> </pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Dec 15 11:18:54 2006 for UbixOS V2 by <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>