<!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: gdt.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.3.3 --> <h1>gdt.h</h1><div class="fragment"><pre>00001 00002 00003 00004 <span class="comment">/**************************************************************************************</span> 00005 <span class="comment"> Copyright (c) 2002 The UbixOS Project</span> 00006 <span class="comment"> All rights reserved.</span> 00007 <span class="comment"></span> 00008 <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> 00009 <span class="comment"></span> 00010 <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> 00011 <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> 00012 <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> 00013 <span class="comment">contributors may be used to endorse or promote products derived from this software without specific prior written permission.</span> 00014 <span class="comment"></span> 00015 <span class="comment">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span> 00016 <span class="comment">WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR</span> 00017 <span class="comment">PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,</span> 00018 <span class="comment">INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE</span> 00019 <span class="comment">GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY</span> 00020 <span class="comment">OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY</span> 00021 <span class="comment">OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span> 00022 <span class="comment"></span> 00023 <span class="comment"> $Id$</span> 00024 <span class="comment"></span> 00025 <span class="comment">**************************************************************************************/</span> 00026 00027 <span class="preprocessor">#ifndef _GDT_H</span> 00028 <span class="preprocessor"></span><span class="preprocessor">#define _GDT_H</span> 00029 <span class="preprocessor"></span> 00030 <span class="comment">/* Descriptor Definitions */</span> 00031 <span class="preprocessor">#define dCall 0x0C00 </span><span class="comment">/* 386 Call Gate */</span> 00032 <span class="preprocessor">#define dCode 0x1800 </span><span class="comment">/* Code Segment */</span> 00033 <span class="preprocessor">#define dData 0x1000 </span><span class="comment">/* Data Segment */</span> 00034 <span class="preprocessor">#define dInt 0x0E00 </span><span class="comment">/* 386 Interrupt Gate */</span> 00035 <span class="preprocessor">#define dLdt 0x200 </span><span class="comment">/* Local Descriptor Table (LDT) */</span> 00036 <span class="preprocessor">#define dTask 0x500 </span><span class="comment">/* Task gate */</span> 00037 <span class="preprocessor">#define dTrap 0x0F00 </span><span class="comment">/* 386 Trap Gate */</span> 00038 <span class="preprocessor">#define dTss 0x900 </span><span class="comment">/* Task State Segment (TSS) */</span> 00039 00040 <span class="comment">/* Descriptor Options */</span> 00041 <span class="preprocessor">#define dDpl3 0x6000 </span><span class="comment">/* DPL3 or mask for DPL */</span> 00042 <span class="preprocessor">#define dDpl2 0x4000 </span><span class="comment">/* DPL2 or mask for DPL */</span> 00043 <span class="preprocessor">#define dDpl1 0x2000 </span><span class="comment">/* DPL1 or mask for DPL */</span> 00044 <span class="preprocessor">#define dPresent 0x8000 </span><span class="comment">/* Present */</span> 00045 <span class="preprocessor">#define dNpresent 0x8000 </span><span class="comment">/* Not Present */</span> 00046 <span class="preprocessor">#define dAcc 0x100 </span><span class="comment">/* Accessed (Data or Code) */</span> 00047 <span class="preprocessor">#define dWrite 0x200 </span><span class="comment">/* Writable (Data segments only) */</span> 00048 <span class="preprocessor">#define dRead 0x200 </span><span class="comment">/* Readable (Code segments only) */</span> 00049 <span class="preprocessor">#define dBusy 0xB00 </span><span class="comment">/* Busy (TSS only) was 200 */</span> 00050 <span class="preprocessor">#define dEexdown 0x400 </span><span class="comment">/* Expand down (Data segments only) */</span> 00051 <span class="preprocessor">#define dConform 0x400 </span><span class="comment">/* Conforming (Code segments only) */</span> 00052 <span class="preprocessor">#define dBig 0x40 </span><span class="comment">/* Default to 32 bit mode */</span> 00053 <span class="preprocessor">#define dBiglim 0x80 </span><span class="comment">/* Limit is in 4K units */</span> 00054 00055 <span class="comment">/* GDT Descriptor */</span> 00056 <span class="keyword">struct </span>gdtDescriptor { 00057 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> limitLow; <span class="comment">/* Limit 0..15 */</span> 00058 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> baseLow; <span class="comment">/* Base 0..15 */</span> 00059 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> baseMed; <span class="comment">/* Base 16..23 */</span> 00060 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> access; <span class="comment">/* Access Byte */</span> 00061 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> limitHigh:4; <span class="comment">/* Limit 16..19 */</span> 00062 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> granularity:4; <span class="comment">/* Granularity */</span> 00063 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> baseHigh; <span class="comment">/* Base 24..31 */</span> 00064 } __attribute__ ((packed)); 00065 00066 <span class="keyword">struct </span>gdtGate { 00067 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> offsetLow; <span class="comment">/* Offset 0..15 */</span> 00068 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> selector; <span class="comment">/* Selector */</span> 00069 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> access; <span class="comment">/* Access Flags */</span> 00070 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> offsetHigh; <span class="comment">/* Offset 16..31 */</span> 00071 } __attribute__ ((packed)); 00072 00073 <span class="keyword">union </span>descriptorTableunion { 00074 <span class="keyword">struct </span>gdtDescriptor descriptor; <span class="comment">/* Normal descriptor */</span> 00075 <span class="keyword">struct </span>gdtGate gate; <span class="comment">/* Gate descriptor */</span> 00076 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> dummy; <span class="comment">/* Any other info */</span> 00077 }; 00078 00079 00080 <span class="preprocessor">#define descriptorTable(name,length) union descriptorTableunion name[length] =</span> 00081 <span class="preprocessor"></span><span class="preprocessor">#define standardDescriptor(base, limit, control) {descriptor: {(limit & 0xffff), (base & 0xffff), ((base >> 16) & 0xff), \</span> 00082 <span class="preprocessor"> ((control+dPresent) >> 8), (limit >> 16), \</span> 00083 <span class="preprocessor"> ((control & 0xff) >> 4), (base >> 24)}}</span> 00084 <span class="preprocessor"></span><span class="preprocessor">#define gateDescriptor(offset, selector, control) {gate: {(offset & 0xffff), selector, \</span> 00085 <span class="preprocessor"> (control+dPresent), (offset >> 16) }}</span> 00086 <span class="preprocessor"></span> 00087 <span class="preprocessor">#endif</span> 00088 <span class="preprocessor"></span> </pre></div><hr size="1"><address style="align: right;"><small>Generated on Wed Apr 28 17:49:34 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>