3 * Copyright (C) 2000 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 * PROJECT: ReactOS kernel
21 * FILE: ntoskrnl/ke/i386/ldt.c
22 * PURPOSE: LDT managment
23 * PROGRAMMER: David Welch (welch@cwcom.net)
28 /* INCLUDES *****************************************************************/
30 #include <ddk/ntddk.h>
31 #include <internal/ke.h>
32 #include <internal/ps.h>
33 #include <internal/i386/segment.h>
36 #include <internal/debug.h>
38 /* GLOBALS *******************************************************************/
41 * Empty LDT shared by every process that doesn't have its own.
43 STATIC UCHAR KiNullLdt[8];
45 /* FUNCTIONS *****************************************************************/
48 NtSetLdtEntries (HANDLE Thread,
52 return(STATUS_NOT_IMPLEMENTED);
56 Ki386InitializeLdt(VOID)
58 PUSHORT Gdt = KeGetCurrentKPCR()->GDT;
59 unsigned int base, length;
62 * Set up an a descriptor for the LDT
64 base = (unsigned int)&KiNullLdt;
65 length = sizeof(KiNullLdt) - 1;
67 Gdt[(LDT_SELECTOR / 2) + 0] = (length & 0xFFFF);
68 Gdt[(LDT_SELECTOR / 2) + 1] = (base & 0xFFFF);
69 Gdt[(LDT_SELECTOR / 2) + 2] = ((base & 0xFF0000) >> 16) | 0x8200;
70 Gdt[(LDT_SELECTOR / 2) + 3] = ((length & 0xF0000) >> 16) |
71 ((base & 0xFF000000) >> 16);