00040 :
00041
00042 This routine returns
the contents of an entry in
the Gdt. If
the
00043 entry
is thread specific,
the entry
for the specified thread
is
00044 created and returned (KGDT_LDT, and KGDT_R3_TEB). If
the selector
00045
is processor dependent,
the entry
for the current processor
is
00046 returned (KGDT_R0_PCR).
00047
00048 Arguments:
00049
00050 Thread -- Supplies a pointer to
the thread to
return the entry
for.
00051
00052
Offset -- Supplies
the offset in
the Gdt. This value must be 0
00053 mod 8.
00054
00055 Descriptor -- Returns
the contents of
the Gdt descriptor
00056
00057 Return Value:
00058
00059 None.
00060
00061 --*/
00062
00063 {
00064 PKGDTENTRY Gdt;
00065
PKPROCESS Process;
00066
00067
00068
00069
00070
00071
if (
Offset >= KGDT_NUMBER *
sizeof(KGDTENTRY)) {
00072
return ;
00073 }
00074
00075
if (
Offset == KGDT_LDT) {
00076
00077
00078
00079
00080
00081 Process = Thread->ApcState.Process;
00082 RtlMoveMemory( Descriptor,
00083 &(Process->LdtDescriptor),
00084
sizeof(KGDTENTRY)
00085 );
00086
00087 }
else {
00088
00089
00090
00091
00092
00093
00094
00095
00096 Gdt =
KiPcr()->GDT;
00097
00098 RtlMoveMemory(Descriptor, (PCHAR)Gdt + Offset,
sizeof(KGDTENTRY));
00099
00100
00101
00102
00103
00104
if (
Offset == KGDT_R3_TEB) {
00105 Descriptor->BaseLow = (
USHORT)((ULONG)(Thread->Teb) & 0xFFFF);
00106 Descriptor->HighWord.Bytes.BaseMid =
00107 (UCHAR) ( ( (ULONG)(Thread->Teb) & 0xFF0000
L) >> 16);
00108 Descriptor->HighWord.Bytes.BaseHi =
00109 (
CHAR) ( ( (ULONG)(Thread->Teb) & 0xFF000000
L) >> 24);
00110 }
00111 }
00112
00113
return ;
00114 }