- Fix definition of _DESCRIPTOR/KDESCRIPTOR

- Fix all code/data structures of GDT/IDT to match new definition
- Kernel is now MSVC/WDK compilable (but not linkable yet)
- Remove two previous fixes for bootvid/kdcom MSVC/WDK compiling

svn path=/trunk/; revision=28254
This commit is contained in:
Aleksey Bragin 2007-08-09 07:12:59 +00:00
parent 56ed3e702f
commit 77ea930fcb
7 changed files with 13 additions and 23 deletions

View file

@ -1,7 +1,3 @@
#ifdef _MSC_VER
void _enable(void);
void _disable(void);
#endif
#include "ntddk.h"
#include "arc/arc.h"
#include "halfuncs.h"

View file

@ -12,11 +12,6 @@
/* INCLUDES *****************************************************************/
#ifdef _MSC_VER
void _enable(void);
void _disable(void);
#endif
#define NOEXTAPI
#include <ntddk.h>
#define NDEBUG

View file

@ -261,14 +261,12 @@ typedef struct _KIDTENTRY
USHORT ExtendedOffset;
} KIDTENTRY, *PKIDTENTRY;
#include <pshpack2.h>
typedef struct _DESCRIPTOR
{
USHORT Pad;
USHORT Limit;
ULONG Base;
USHORT Padding;
} KDESCRIPTOR, *PKDESCRIPTOR;
#include <poppack.h>
#ifndef NTOS_MODE_USER
//

View file

@ -356,8 +356,8 @@ KiRosPrepareForSystemStartup(IN ULONG Dummy,
PKGDTENTRY TssEntry;
/* Load the GDT and IDT */
Ke386SetGlobalDescriptorTable(KiGdtDescriptor);
Ke386SetInterruptDescriptorTable(KiIdtDescriptor);
Ke386SetGlobalDescriptorTable(*(PKDESCRIPTOR)&KiGdtDescriptor.Limit);
Ke386SetInterruptDescriptorTable(*(PKDESCRIPTOR)&KiIdtDescriptor.Limit);
/* Initialize the boot TSS */
Tss = &KiBootTss;

View file

@ -47,7 +47,7 @@ KGDTENTRY KiBootGdt[256] =
};
/* GDT Descriptor */
KDESCRIPTOR KiGdtDescriptor = {sizeof(KiBootGdt), (ULONG)KiBootGdt};
KDESCRIPTOR KiGdtDescriptor = {0, sizeof(KiBootGdt), (ULONG)KiBootGdt};
/* CPU Features and Flags */
ULONG KeI386CpuType;
@ -705,8 +705,8 @@ KiRestoreProcessorControlState(PKPROCESSOR_STATE ProcessorState)
//
// Restore GDT, IDT, LDT and TSS
//
Ke386SetGlobalDescriptorTable(ProcessorState->SpecialRegisters.Gdtr.Base);
Ke386SetInterruptDescriptorTable(ProcessorState->SpecialRegisters.Idtr.Base);
Ke386SetGlobalDescriptorTable(*(PKDESCRIPTOR)&ProcessorState->SpecialRegisters.Gdtr.Limit);
Ke386SetInterruptDescriptorTable(*(PKDESCRIPTOR)&ProcessorState->SpecialRegisters.Idtr.Limit);
Ke386SetTr(ProcessorState->SpecialRegisters.Tr);
Ke386SetLocalDescriptorTable(ProcessorState->SpecialRegisters.Ldtr);
}
@ -732,8 +732,8 @@ KiSaveProcessorControlState(OUT PKPROCESSOR_STATE ProcessorState)
Ke386SetDr7(0);
/* Save GDT, IDT, LDT and TSS */
Ke386GetGlobalDescriptorTable(ProcessorState->SpecialRegisters.Gdtr.Base);
Ke386GetInterruptDescriptorTable(ProcessorState->SpecialRegisters.Idtr.Base);
Ke386GetGlobalDescriptorTable(*(PKDESCRIPTOR)&ProcessorState->SpecialRegisters.Gdtr.Limit);
Ke386GetInterruptDescriptorTable(*(PKDESCRIPTOR)&ProcessorState->SpecialRegisters.Idtr.Limit);
Ke386GetTr(ProcessorState->SpecialRegisters.Tr);
Ke386GetLocalDescriptorTable(ProcessorState->SpecialRegisters.Ldtr);
}
@ -832,14 +832,14 @@ KiI386PentiumLockErrataFixup(VOID)
_disable();
/* Get the current IDT and copy it */
Ke386GetInterruptDescriptorTable(IdtDescriptor);
Ke386GetInterruptDescriptorTable(*(PKDESCRIPTOR)&IdtDescriptor.Limit);
RtlCopyMemory(NewIdt2,
(PVOID)IdtDescriptor.Base,
IdtDescriptor.Limit + 1);
IdtDescriptor.Base = (ULONG)NewIdt2;
/* Set the new IDT */
Ke386SetInterruptDescriptorTable(IdtDescriptor);
Ke386SetInterruptDescriptorTable(*(PKDESCRIPTOR)&IdtDescriptor.Limit);
((PKIPCR)KeGetPcr())->IDT = NewIdt2;
/* Restore interrupts */

View file

@ -619,8 +619,8 @@ KiGetMachineBootPointers(IN PKGDTENTRY *Gdt,
USHORT Tr = 0, Fs;
/* Get GDT and IDT descriptors */
Ke386GetGlobalDescriptorTable(GdtDescriptor);
Ke386GetInterruptDescriptorTable(IdtDescriptor);
Ke386GetGlobalDescriptorTable(*(PKDESCRIPTOR)&GdtDescriptor.Limit);
Ke386GetInterruptDescriptorTable(*(PKDESCRIPTOR)&IdtDescriptor.Limit);
/* Save IDT and GDT */
*Gdt = (PKGDTENTRY)GdtDescriptor.Base;

View file

@ -80,6 +80,7 @@ GENERATE_IDT_STUBS /* INT 30-FF: UNEXPECTED INTERRUPTS */
.globl _KiIdtDescriptor
_KiIdtDescriptor:
.short 0
.short 0x800
.long _KiIdt