00043 :
00044
00045 The specified LDT (which may be null) will be
made the active Ldt of
00046
the specified process,
for all threads thereof, on whichever
00047 processors they are running. The change will take effect before
the
00048 call returns.
00049
00050 An Ldt address of
NULL or a Limit of 0 will cause
the process to
00051 receive
the NULL Ldt.
00052
00053 This function
only exists on i386 and i386 compatible processors.
00054
00055 No checking
is done on
the validity of Ldt entries.
00056
00057
00058 Arguments:
00059
00060 Process - Pointer to
KPROCESS object describing
the process
for
00061 which
the Ldt
is to be set.
00062
00063 Ldt - Pointer to an array of LDT_ENTRYs (that is, a pointer to an
00064 Ldt.)
00065
00066 Limit - Ldt limit (must be 0 mod 8)
00067
00068 Return Value:
00069
00070 None.
00071
00072 --*/
00073
00074 {
00075 #
if 0
00076 KGDTENTRY LdtDescriptor;
00077 KXDESCRIPTOR XDescriptor;
00078 PTEB Teb;
00079
00080
00081
00082
00083
00084
00085 if ((Ldt == NULL) || (Limit == 0)) {
00086
00087
00088
00089
00090
00091 LdtDescriptor.LimitLow = 0;
00092 LdtDescriptor.BaseLow = 0;
00093 LdtDescriptor.HighWord.Bytes.BaseMid = 0;
00094 LdtDescriptor.HighWord.Bytes.Flags1 = 0;
00095 LdtDescriptor.HighWord.Bytes.Flags2 = 0;
00096 LdtDescriptor.HighWord.Bytes.BaseHi = 0;
00097
00098 XDescriptor.Words.DescriptorWords = (ULONGLONG) 0;
00099
00100 }
else {
00101
00102
00103
00104
00105
00106
00107
00108 LdtDescriptor.HighWord.Bytes.Flags1 = 0;
00109 LdtDescriptor.HighWord.Bytes.Flags2 = 0;
00110
00111
00112
00113
00114
00115 LdtDescriptor.LimitLow = (
USHORT) ((ULONG) Limit - 1);
00116 LdtDescriptor.BaseLow = (
USHORT) ((ULONG_PTR) Ldt & (ULONG_PTR)0xffff);
00117 LdtDescriptor.HighWord.Bytes.BaseMid = (UCHAR) (((ULONG_PTR)Ldt & (ULONG_PTR)0xff0000) >> 16);
00118 LdtDescriptor.HighWord.Bytes.BaseHi = (UCHAR) (((ULONG_PTR)Ldt & (ULONG_PTR)0xff000000) >> 24);
00119
00120
00121
00122
00123
00124 LdtDescriptor.HighWord.Bits.Type = TYPE_LDT;
00125 LdtDescriptor.HighWord.Bits.Dpl = DPL_SYSTEM;
00126
00127
00128
00129
00130
00131 LdtDescriptor.HighWord.Bits.Pres = 1;
00132
00133
00134
00135
00136 XDescriptor.Words.DescriptorWords = (ULONGLONG) 0;
00137 XDescriptor.Words.Bits.Base = (ULONG_PTR) Ldt;
00138 XDescriptor.Words.Bits.Limit = Limit - 1;
00139 XDescriptor.Words.Bits.Type = TYPE_LDT;
00140 XDescriptor.Words.Bits.Dpl = DPL_USER;
00141 XDescriptor.Words.Bits.Pres = 1;
00142
00143 }
00144
00145
00146
00147
00148
00149 Process->LdtDescriptor = LdtDescriptor;
00150 Process->UnscrambledLdtDescriptor = XDescriptor.Words.DescriptorWords;
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
ASSERT (Process == &(
PsGetCurrentProcess()->Pcb));
00162
00163
00164
00165
00166
00167
00168
00169
00170 Teb =
PsGetCurrentThread()->Tcb.Teb;
00171 *(KGDTENTRY *)(&Teb->Gdt[KGDT_LDT>3]) = LdtDescriptor;
00172
00173
00174
00175
00176 Teb->LdtDescriptor = XDescriptor.Words.DescriptorWords;
00177
00178
return;
00179
#endif
00180
}
}