Author: ion
Date: Sun Sep 3 11:13:02 2006
New Revision: 23895
URL:
http://svn.reactos.org/svn/reactos?rev=23895&view=rev
Log:
- Remove LDT initialization, LDT shouldn't be initialized at bootup.
- Move LDT-only GDT routines to ldt.c
- Cleanup formatting of GDT-related exported function stubs in gdt.c and rename file to
abios.c. Those routines deal specifically with the ABIOS GDT selectors and are for ABIOS
support.
- Move the lone 2 routines in fpu.c to cpu.c.
Added:
trunk/reactos/ntoskrnl/ke/i386/abios.c
- copied, changed from r23894, trunk/reactos/ntoskrnl/ke/i386/gdt.c
Removed:
trunk/reactos/ntoskrnl/ke/i386/fpu.c
trunk/reactos/ntoskrnl/ke/i386/gdt.c
Modified:
trunk/reactos/ntoskrnl/include/internal/ke.h
trunk/reactos/ntoskrnl/ke/i386/cpu.c
trunk/reactos/ntoskrnl/ke/i386/kernel.c
trunk/reactos/ntoskrnl/ke/i386/ldt.c
trunk/reactos/ntoskrnl/ntoskrnl.rbuild
Modified: trunk/reactos/ntoskrnl/include/internal/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ke.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/ke.h Sun Sep 3 11:13:02 2006
@@ -96,6 +96,7 @@
extern BOOLEAN KeI386VirtualIntExtensions;
extern KIDTENTRY KiIdt[];
extern KGDTENTRY KiBootGdt[];
+extern KTSS KiBootTss;
extern FAST_MUTEX KernelAddressSpaceLock;
extern ULONG KiMaximumDpcQueueDepth;
extern ULONG KiMinimumDpcRate;
@@ -111,6 +112,7 @@
extern KMUTEX KiGenericCallDpcMutex;
extern LIST_ENTRY KiProfileListHead, KiProfileSourceListHead;
extern KSPIN_LOCK KiProfileLock;
+extern LIST_ENTRY KiProcessListHead;
extern LIST_ENTRY KiProcessInSwapListHead, KiProcessOutSwapListHead;
extern LIST_ENTRY KiStackInSwapListHead;
extern KEVENT KiSwapEvent;
Copied: trunk/reactos/ntoskrnl/ke/i386/abios.c (from r23894,
trunk/reactos/ntoskrnl/ke/i386/gdt.c)
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/abios.c?p…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/gdt.c (original)
+++ trunk/reactos/ntoskrnl/ke/i386/abios.c Sun Sep 3 11:13:02 2006
@@ -1,11 +1,9 @@
-/* $Id$
- *
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: ntoskrnl/ke/i386/gdt.c
- * PURPOSE: GDT managment
- *
- * PROGRAMMERS: David Welch (welch(a)cwcom.net)
+/*
+ * PROJECT: ReactOS Kernel
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: ntoskrnl/ke/i386/abios.c
+ * PURPOSE: Routines for ABIOS Support
+ * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org)
*/
/* INCLUDES *****************************************************************/
@@ -14,127 +12,43 @@
#define NDEBUG
#include <debug.h>
-/* GLOBALS *******************************************************************/
-
-KGDTENTRY KiBootGdt[11] =
-{
- {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}}, /* Null */
- {0xffff, 0x0000, {{0x00, 0x9a, 0xcf, 0x00}}}, /* Kernel CS */
- {0xffff, 0x0000, {{0x00, 0x92, 0xcf, 0x00}}}, /* Kernel DS */
- {0xffff, 0x0000, {{0x00, 0xfa, 0xcf, 0x00}}}, /* User CS */
- {0xffff, 0x0000, {{0x00, 0xf2, 0xcf, 0x00}}}, /* User DS */
- {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}}, /* TSS */
- {0x0fff, 0x0000, {{0x00, 0x92, 0x00, 0xff}}}, /* PCR */
- {0x0fff, 0x0000, {{0x00, 0xf2, 0x00, 0x00}}}, /* TEB */
- {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}}, /* Reserved */
- {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}}, /* LDT */
- {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}} /* Trap TSS */
-};
-
-KDESCRIPTOR KiGdtDescriptor = {sizeof(KiBootGdt), (ULONG)KiBootGdt};
-
-static KSPIN_LOCK GdtLock;
-
/* FUNCTIONS *****************************************************************/
/*
* @unimplemented
*/
-NTSTATUS STDCALL
-KeI386FlatToGdtSelector(
- IN ULONG Base,
- IN USHORT Length,
- IN USHORT Selector
-)
+NTSTATUS
+STDCALL
+KeI386FlatToGdtSelector(IN ULONG Base,
+ IN USHORT Length,
+ IN USHORT Selector)
{
- UNIMPLEMENTED;
- return 0;
+ UNIMPLEMENTED;
+ return 0;
}
/*
* @unimplemented
*/
-NTSTATUS STDCALL
-KeI386ReleaseGdtSelectors(
- OUT PULONG SelArray,
- IN ULONG NumOfSelectors
-)
+NTSTATUS
+NTAPI
+KeI386ReleaseGdtSelectors(OUT PULONG SelArray,
+ IN ULONG NumOfSelectors)
{
- UNIMPLEMENTED;
- return 0;
+ UNIMPLEMENTED;
+ return 0;
}
/*
* @unimplemented
*/
-NTSTATUS STDCALL
-KeI386AllocateGdtSelectors(
- OUT PULONG SelArray,
- IN ULONG NumOfSelectors
-)
+NTSTATUS
+NTAPI
+KeI386AllocateGdtSelectors(OUT PULONG SelArray,
+ IN ULONG NumOfSelectors)
{
- UNIMPLEMENTED;
- return 0;
-}
-
-VOID
-KeSetBaseGdtSelector(ULONG Entry,
- PVOID Base)
-{
- KIRQL oldIrql;
- PUSHORT Gdt;
-
- DPRINT("KeSetBaseGdtSelector(Entry %x, Base %x)\n",
- Entry, Base);
-
- KeAcquireSpinLock(&GdtLock, &oldIrql);
-
- Gdt = KeGetCurrentKPCR()->GDT;
- Entry = (Entry & (~0x3)) / 2;
-
- Gdt[Entry + 1] = (USHORT)(((ULONG)Base) & 0xffff);
-
- Gdt[Entry + 2] = Gdt[Entry + 2] & ~(0xff);
- Gdt[Entry + 2] = (USHORT)(Gdt[Entry + 2] |
- ((((ULONG)Base) & 0xff0000) >> 16));
-
- Gdt[Entry + 3] = Gdt[Entry + 3] & ~(0xff00);
- Gdt[Entry + 3] = (USHORT)(Gdt[Entry + 3] |
- ((((ULONG)Base) & 0xff000000) >> 16));
-
- DPRINT("%x %x %x %x\n",
- Gdt[Entry + 0],
- Gdt[Entry + 1],
- Gdt[Entry + 2],
- Gdt[Entry + 3]);
-
- KeReleaseSpinLock(&GdtLock, oldIrql);
-}
-
-VOID
-KeSetGdtSelector(ULONG Entry,
- ULONG Value1,
- ULONG Value2)
-{
- KIRQL oldIrql;
- PULONG Gdt;
-
- DPRINT("KeSetGdtSelector(Entry %x, Value1 %x, Value2 %x)\n",
- Entry, Value1, Value2);
-
- KeAcquireSpinLock(&GdtLock, &oldIrql);
-
- Gdt = (PULONG) KeGetCurrentKPCR()->GDT;
- Entry = (Entry & (~0x3)) / 4;
-
- Gdt[Entry] = Value1;
- Gdt[Entry + 1] = Value2;
-
- DPRINT("%x %x\n",
- Gdt[Entry + 0],
- Gdt[Entry + 1]);
-
- KeReleaseSpinLock(&GdtLock, oldIrql);
+ UNIMPLEMENTED;
+ return 0;
}
/* EOF */
Modified: trunk/reactos/ntoskrnl/ke/i386/cpu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/cpu.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/cpu.c (original)
+++ trunk/reactos/ntoskrnl/ke/i386/cpu.c Sun Sep 3 11:13:02 2006
@@ -26,6 +26,27 @@
/* The TSS to use for Double Fault Traps (INT 0x9) */
UCHAR KiDoubleFaultTSS[KTSS_IO_MAPS];
+/* The Boot GDT (FIXME: should have more entries */
+KGDTENTRY KiBootGdt[12] =
+{
+ {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}}, /* KGDT_NULL */
+ {0xffff, 0x0000, {{0x00, 0x9a, 0xcf, 0x00}}}, /* KGDT_R0_CODE */
+ {0xffff, 0x0000, {{0x00, 0x92, 0xcf, 0x00}}}, /* KGDT_R0_DATA */
+ {0xffff, 0x0000, {{0x00, 0xfa, 0xcf, 0x00}}}, /* KGDT_R3_CODE */
+ {0xffff, 0x0000, {{0x00, 0xf2, 0xcf, 0x00}}}, /* KGDT_R3_DATA*/
+ {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}}, /* KGDT_TSS */
+ {0x0fff, 0x0000, {{0x00, 0x92, 0x00, 0xff}}}, /* KGDT_R0_PCR */
+ {0x0fff, 0x0000, {{0x00, 0xf2, 0x00, 0x00}}}, /* KGDT_R3_TEB */
+ {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}}, /* KGDT_UNUSED */
+ {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}}, /* KGDT_LDT */
+ {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}}, /* KGDT_DF_TSS */
+ {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}} /* KGDT_NMI_TSS */
+};
+
+/* GDT Descriptor */
+KDESCRIPTOR KiGdtDescriptor = {sizeof(KiBootGdt), (ULONG)KiBootGdt};
+
+/* CPU Features and Flags */
ULONG KeI386CpuType;
ULONG KeI386CpuStep;
ULONG KeProcessorArchitecture;
@@ -42,6 +63,7 @@
ULONG Ke386NoExecute = FALSE;
BOOLEAN KiI386PentiumLockErrataPresent;
+/* CPU Signatures */
CHAR CmpIntelID[] = "GenuineIntel";
CHAR CmpAmdID[] = "AuthenticAMD";
CHAR CmpCyrixID[] = "CyrixInstead";
@@ -576,7 +598,45 @@
TssEntry->LimitLow = KTSS_IO_MAPS;
}
-VOID INIT_FUNCTION
+/* This is a rather naive implementation of Ke(Save/Restore)FloatingPointState
+ which will not work for WDM drivers. Please feel free to improve */
+NTSTATUS
+NTAPI
+KeSaveFloatingPointState(OUT PKFLOATING_SAVE Save)
+{
+ PFNSAVE_FORMAT FpState;
+ ASSERT_IRQL(DISPATCH_LEVEL);
+
+ /* check if we are doing software emulation */
+ if (!KeI386NpxPresent) return STATUS_ILLEGAL_FLOAT_CONTEXT;
+
+ FpState = ExAllocatePool(NonPagedPool, sizeof (FNSAVE_FORMAT));
+ if (!FpState) return STATUS_INSUFFICIENT_RESOURCES;
+
+ *((PVOID *) Save) = FpState;
+ asm volatile("fnsave %0\n\t" : "=m" (*FpState));
+
+ KeGetCurrentThread()->DispatcherHeader.NpxIrql = KeGetCurrentIrql();
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS
+NTAPI
+KeRestoreFloatingPointState(IN PKFLOATING_SAVE Save)
+{
+ PFNSAVE_FORMAT FpState = *((PVOID *) Save);
+
+ ASSERT(KeGetCurrentThread()->DispatcherHeader.NpxIrql == KeGetCurrentIrql());
+
+ asm volatile("fnclex\n\t");
+ asm volatile("frstor %0\n\t" : "=m" (*FpState));
+
+ ExFreePool(FpState);
+ return STATUS_SUCCESS;
+}
+
+VOID
+INIT_FUNCTION
Ki386SetProcessorFeatures(VOID)
{
OBJECT_ATTRIBUTES ObjectAttributes;
@@ -667,7 +727,6 @@
}
}
-
VOID
NTAPI
KeFlushCurrentTb(VOID)
Removed: trunk/reactos/ntoskrnl/ke/i386/fpu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/fpu.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/fpu.c (original)
+++ trunk/reactos/ntoskrnl/ke/i386/fpu.c (removed)
@@ -1,80 +1,0 @@
-/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: ntoskrnl/ke/i386/fpu.c
- * PURPOSE: Handles the FPU
- * PROGRAMMERS: David Welch (welch(a)mcmail.com)
- * Gregor Anich
- */
-
-/* INCLUDES *****************************************************************/
-
-#include <roscfg.h>
-#include <ntoskrnl.h>
-#define NDEBUG
-#include <internal/debug.h>
-
-/* FUNCTIONS *****************************************************************/
-
-/* This is a rather naive implementation of Ke(Save/Restore)FloatingPointState
- which will not work for WDM drivers. Please feel free to improve */
-
-NTSTATUS STDCALL
-KeSaveFloatingPointState(OUT PKFLOATING_SAVE Save)
-{
- PFNSAVE_FORMAT FpState;
-
- ASSERT_IRQL(DISPATCH_LEVEL);
-
- /* check if we are doing software emulation */
- if (!KeI386NpxPresent)
- {
- return STATUS_ILLEGAL_FLOAT_CONTEXT;
- }
-
- FpState = ExAllocatePool(NonPagedPool, sizeof (FNSAVE_FORMAT));
- if (NULL == FpState)
- {
- return STATUS_INSUFFICIENT_RESOURCES;
- }
- *((PVOID *) Save) = FpState;
-
-#if defined(__GNUC__)
- asm volatile("fnsave %0\n\t" : "=m" (*FpState));
-#elif defined(_MSC_VER)
- __asm mov eax, FpState;
- __asm fsave [eax];
-#else
-#error Unknown compiler for inline assembler
-#endif
-
- KeGetCurrentThread()->DispatcherHeader.NpxIrql = KeGetCurrentIrql();
-
- return STATUS_SUCCESS;
-}
-
-
-NTSTATUS STDCALL
-KeRestoreFloatingPointState(IN PKFLOATING_SAVE Save)
-{
- PFNSAVE_FORMAT FpState = *((PVOID *) Save);
-
- if (KeGetCurrentThread()->DispatcherHeader.NpxIrql != KeGetCurrentIrql())
- {
- KEBUGCHECK(UNDEFINED_BUG_CODE);
- }
-
-#if defined(__GNUC__)
- asm volatile("fnclex\n\t");
- asm volatile("frstor %0\n\t" : "=m" (*FpState));
-#elif defined(_MSC_VER)
- __asm mov eax, FpState;
- __asm frstor [eax];
-#else
-#error Unknown compiler for inline assembler
-#endif
-
- ExFreePool(FpState);
-
- return STATUS_SUCCESS;
-}
Removed: trunk/reactos/ntoskrnl/ke/i386/gdt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/gdt.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/gdt.c (original)
+++ trunk/reactos/ntoskrnl/ke/i386/gdt.c (removed)
@@ -1,140 +1,0 @@
-/* $Id$
- *
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: ntoskrnl/ke/i386/gdt.c
- * PURPOSE: GDT managment
- *
- * PROGRAMMERS: David Welch (welch(a)cwcom.net)
- */
-
-/* INCLUDES *****************************************************************/
-
-#include <ntoskrnl.h>
-#define NDEBUG
-#include <debug.h>
-
-/* GLOBALS *******************************************************************/
-
-KGDTENTRY KiBootGdt[11] =
-{
- {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}}, /* Null */
- {0xffff, 0x0000, {{0x00, 0x9a, 0xcf, 0x00}}}, /* Kernel CS */
- {0xffff, 0x0000, {{0x00, 0x92, 0xcf, 0x00}}}, /* Kernel DS */
- {0xffff, 0x0000, {{0x00, 0xfa, 0xcf, 0x00}}}, /* User CS */
- {0xffff, 0x0000, {{0x00, 0xf2, 0xcf, 0x00}}}, /* User DS */
- {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}}, /* TSS */
- {0x0fff, 0x0000, {{0x00, 0x92, 0x00, 0xff}}}, /* PCR */
- {0x0fff, 0x0000, {{0x00, 0xf2, 0x00, 0x00}}}, /* TEB */
- {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}}, /* Reserved */
- {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}}, /* LDT */
- {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}} /* Trap TSS */
-};
-
-KDESCRIPTOR KiGdtDescriptor = {sizeof(KiBootGdt), (ULONG)KiBootGdt};
-
-static KSPIN_LOCK GdtLock;
-
-/* FUNCTIONS *****************************************************************/
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-KeI386FlatToGdtSelector(
- IN ULONG Base,
- IN USHORT Length,
- IN USHORT Selector
-)
-{
- UNIMPLEMENTED;
- return 0;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-KeI386ReleaseGdtSelectors(
- OUT PULONG SelArray,
- IN ULONG NumOfSelectors
-)
-{
- UNIMPLEMENTED;
- return 0;
-}
-
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-KeI386AllocateGdtSelectors(
- OUT PULONG SelArray,
- IN ULONG NumOfSelectors
-)
-{
- UNIMPLEMENTED;
- return 0;
-}
-
-VOID
-KeSetBaseGdtSelector(ULONG Entry,
- PVOID Base)
-{
- KIRQL oldIrql;
- PUSHORT Gdt;
-
- DPRINT("KeSetBaseGdtSelector(Entry %x, Base %x)\n",
- Entry, Base);
-
- KeAcquireSpinLock(&GdtLock, &oldIrql);
-
- Gdt = KeGetCurrentKPCR()->GDT;
- Entry = (Entry & (~0x3)) / 2;
-
- Gdt[Entry + 1] = (USHORT)(((ULONG)Base) & 0xffff);
-
- Gdt[Entry + 2] = Gdt[Entry + 2] & ~(0xff);
- Gdt[Entry + 2] = (USHORT)(Gdt[Entry + 2] |
- ((((ULONG)Base) & 0xff0000) >> 16));
-
- Gdt[Entry + 3] = Gdt[Entry + 3] & ~(0xff00);
- Gdt[Entry + 3] = (USHORT)(Gdt[Entry + 3] |
- ((((ULONG)Base) & 0xff000000) >> 16));
-
- DPRINT("%x %x %x %x\n",
- Gdt[Entry + 0],
- Gdt[Entry + 1],
- Gdt[Entry + 2],
- Gdt[Entry + 3]);
-
- KeReleaseSpinLock(&GdtLock, oldIrql);
-}
-
-VOID
-KeSetGdtSelector(ULONG Entry,
- ULONG Value1,
- ULONG Value2)
-{
- KIRQL oldIrql;
- PULONG Gdt;
-
- DPRINT("KeSetGdtSelector(Entry %x, Value1 %x, Value2 %x)\n",
- Entry, Value1, Value2);
-
- KeAcquireSpinLock(&GdtLock, &oldIrql);
-
- Gdt = (PULONG) KeGetCurrentKPCR()->GDT;
- Entry = (Entry & (~0x3)) / 4;
-
- Gdt[Entry] = Value1;
- Gdt[Entry + 1] = Value2;
-
- DPRINT("%x %x\n",
- Gdt[Entry + 0],
- Gdt[Entry + 1]);
-
- KeReleaseSpinLock(&GdtLock, oldIrql);
-}
-
-/* EOF */
Modified: trunk/reactos/ntoskrnl/ke/i386/kernel.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/kernel.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/kernel.c (original)
+++ trunk/reactos/ntoskrnl/ke/i386/kernel.c Sun Sep 3 11:13:02 2006
@@ -25,11 +25,8 @@
ETHREAD KiInitialThread;
EPROCESS KiInitialProcess;
-extern LIST_ENTRY KiProcessListHead;
extern ULONG Ke386GlobalPagesEnabled;
-extern KGDTENTRY KiBootGdt[];
extern PVOID trap_stack, init_stack;
-extern KTSS KiBootTss;
/* System-defined Spinlocks */
KSPIN_LOCK KiDispatcherLock;
@@ -518,9 +515,6 @@
/* Setup the boot (Freeldr should've done), double fault and NMI TSS */
Ki386InitializeTss();
- /* Setup the LDT */
- Ki386InitializeLdt();
-
/* Setup CPU-related fields */
Pcr->Number = Cpu;
Pcr->SetMember = 1 << Cpu;
Modified: trunk/reactos/ntoskrnl/ke/i386/ldt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/ldt.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/ldt.c (original)
+++ trunk/reactos/ntoskrnl/ke/i386/ldt.c Sun Sep 3 11:13:02 2006
@@ -17,11 +17,69 @@
/* GLOBALS *******************************************************************/
static KSPIN_LOCK LdtLock;
+static KSPIN_LOCK GdtLock;
/* FUNCTIONS *****************************************************************/
-/* gdt.c */
-extern VOID KeSetGdtSelector(ULONG Entry, ULONG Value1, ULONG Value2);
+VOID
+KeSetBaseGdtSelector(ULONG Entry,
+ PVOID Base)
+{
+ KIRQL oldIrql;
+ PUSHORT Gdt;
+
+ DPRINT("KeSetBaseGdtSelector(Entry %x, Base %x)\n",
+ Entry, Base);
+
+ KeAcquireSpinLock(&GdtLock, &oldIrql);
+
+ Gdt = KeGetCurrentKPCR()->GDT;
+ Entry = (Entry & (~0x3)) / 2;
+
+ Gdt[Entry + 1] = (USHORT)(((ULONG)Base) & 0xffff);
+
+ Gdt[Entry + 2] = Gdt[Entry + 2] & ~(0xff);
+ Gdt[Entry + 2] = (USHORT)(Gdt[Entry + 2] |
+ ((((ULONG)Base) & 0xff0000) >> 16));
+
+ Gdt[Entry + 3] = Gdt[Entry + 3] & ~(0xff00);
+ Gdt[Entry + 3] = (USHORT)(Gdt[Entry + 3] |
+ ((((ULONG)Base) & 0xff000000) >> 16));
+
+ DPRINT("%x %x %x %x\n",
+ Gdt[Entry + 0],
+ Gdt[Entry + 1],
+ Gdt[Entry + 2],
+ Gdt[Entry + 3]);
+
+ KeReleaseSpinLock(&GdtLock, oldIrql);
+}
+
+VOID
+KeSetGdtSelector(ULONG Entry,
+ ULONG Value1,
+ ULONG Value2)
+{
+ KIRQL oldIrql;
+ PULONG Gdt;
+
+ DPRINT("KeSetGdtSelector(Entry %x, Value1 %x, Value2 %x)\n",
+ Entry, Value1, Value2);
+
+ KeAcquireSpinLock(&GdtLock, &oldIrql);
+
+ Gdt = (PULONG) KeGetCurrentKPCR()->GDT;
+ Entry = (Entry & (~0x3)) / 4;
+
+ Gdt[Entry] = Value1;
+ Gdt[Entry + 1] = Value2;
+
+ DPRINT("%x %x\n",
+ Gdt[Entry + 0],
+ Gdt[Entry + 1]);
+
+ KeReleaseSpinLock(&GdtLock, oldIrql);
+}
BOOL PspIsDescriptorValid(PLDT_ENTRY ldt_entry)
{
@@ -172,20 +230,3 @@
return STATUS_SUCCESS;
}
-VOID
-Ki386InitializeLdt(VOID)
-{
- PUSHORT Gdt = KeGetCurrentKPCR()->GDT;
- unsigned int base, length;
-
- /*
- * Set up an a descriptor for the LDT
- */
- base = length = 0;
-
- Gdt[(KGDT_LDT / 2) + 0] = (length & 0xFFFF);
- Gdt[(KGDT_LDT / 2) + 1] = (base & 0xFFFF);
- Gdt[(KGDT_LDT / 2) + 2] = ((base & 0xFF0000) >> 16) | 0x8200;
- Gdt[(KGDT_LDT / 2) + 3] = ((length & 0xF0000) >> 16) |
- ((base & 0xFF000000) >> 16);
-}
Modified: trunk/reactos/ntoskrnl/ntoskrnl.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.rbuild?r…
==============================================================================
--- trunk/reactos/ntoskrnl/ntoskrnl.rbuild (original)
+++ trunk/reactos/ntoskrnl/ntoskrnl.rbuild Sun Sep 3 11:13:02 2006
@@ -27,12 +27,11 @@
<if property="ARCH" value="i386">
<directory name="i386">
<file first="true">main_asm.S</file>
+ <file>abios.c</file>
<file>cpu.c</file>
<file>ctxswitch.S</file>
<file>clock.S</file>
<file>exp.c</file>
- <file>fpu.c</file>
- <file>gdt.c</file>
<!-- <file>irq.c</file> -->
<file>kernel.c</file>
<file>ldt.c</file>