Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

gdtsup.c File Reference

#include "ki.h"

Go to the source code of this file.

Functions

VOID KeIA32GetGdtEntryThread (IN PKTHREAD Thread, IN ULONG Offset, OUT PKGDTENTRY Descriptor)


Function Documentation

VOID KeIA32GetGdtEntryThread IN PKTHREAD  Thread,
IN ULONG  Offset,
OUT PKGDTENTRY  Descriptor
 

Definition at line 32 of file ia64/gdtsup.c.

References ASSERT, CHAR, L, Offset, PsGetCurrentProcess, and USHORT.

00039 : 00040 00041 This routine returns the contents of an entry in the Gdt. If the 00042 entry is thread specific, the entry for the specified thread is 00043 created and returned (KGDT_LDT, and KGDT_R3_TEB). If the selector 00044 is processor dependent, the entry for the current processor is 00045 returned (KGDT_R0_PCR). 00046 00047 Arguments: 00048 00049 Thread -- Supplies a pointer to the thread to return the entry for. 00050 00051 Offset -- Supplies the offset in the Gdt. This value must be 0 00052 mod 8. 00053 00054 Descriptor -- Returns the contents of the Gdt descriptor 00055 00056 Return Value: 00057 00058 None. 00059 00060 --*/ 00061 00062 { 00063 #if 0 00064 PKGDTENTRY Gdt; 00065 PKPROCESS Process; 00066 00067 // 00068 // If the entry is out of range, don't return anything 00069 // 00070 00071 if (Offset >= GDT_TABLE_SIZE) { 00072 return ; 00073 } 00074 00075 if (Offset == KGDT_LDT) { 00076 00077 // 00078 // Materialize Ldt selector 00079 // 00080 00081 Process = Thread->ApcState.Process; 00082 00083 // 00084 // Assume same process 00085 // 00086 ASSERT (&(PsGetCurrentProcess()->Pcb) == Process); 00087 00088 *Descriptor = Process->LdtDescriptor; 00089 00090 } else { 00091 00092 // 00093 // Copy Selector from Gdt 00094 // 00095 // N.B. We will change the base later, if it is KGDT_R3_TEB 00096 // 00097 00098 PTEB Teb = (PTEB)(Thread->Teb); 00099 00100 *Descriptor = *((PKGDTENTRY)((PCHAR)(Teb->Gdt) + Offset)); 00101 00102 // 00103 // if it is the TEB selector, fix the base 00104 // 00105 00106 if (Offset == KGDT_R3_TEB) { 00107 Descriptor->BaseLow = (USHORT)((ULONG_PTR)(Thread->Teb) & 0xFFFF); 00108 Descriptor->HighWord.Bytes.BaseMid = 00109 (UCHAR) ( ( (ULONG_PTR)(Thread->Teb) & ((ULONG_PTR)0xFF0000L)) >> 16); 00110 Descriptor->HighWord.Bytes.BaseHi = 00111 (CHAR) ( ( (ULONG_PTR)(Thread->Teb) & ((ULONG_PTR)0xFF000000L)) >> 24); 00112 } 00113 } 00114 00115 return ; 00116 #endif 00117 } }


Generated on Sat May 15 19:43:48 2004 for test by doxygen 1.3.7