mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
Add a nice little KIDT_ACCESS structure for setting IDT entries in a pretty way
svn path=/trunk/; revision=16329
This commit is contained in:
parent
356bf8d78c
commit
8ebf837814
2 changed files with 32 additions and 1 deletions
|
@ -906,11 +906,19 @@ VOID
|
|||
SetInterruptGate(ULONG index, ULONG address)
|
||||
{
|
||||
KIDTENTRY *idt;
|
||||
KIDT_ACCESS Access;
|
||||
|
||||
/* Set the IDT Access Bits */
|
||||
Access.Reserved = 0;
|
||||
Access.Present = 1;
|
||||
Access.Dpl = 0; /* Kernel-Mode */
|
||||
Access.SystemSegmentFlag = 0;
|
||||
Access.SegmentType = I386_INTERRUPT_GATE;
|
||||
|
||||
idt = (KIDTENTRY*)((ULONG)KeGetCurrentKPCR()->IDT + index * sizeof(KIDTENTRY));
|
||||
idt->Offset = address & 0xffff;
|
||||
idt->Selector = KERNEL_CS;
|
||||
idt->Access = 0x8e00;
|
||||
idt->Access = Access.Value;
|
||||
idt->ExtendedOffset = address >> 16;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,13 @@
|
|||
|
||||
#define THREAD_WAIT_OBJECTS 4
|
||||
|
||||
/* X86 80386 Segment Types */
|
||||
#define I386_TSS 0x9
|
||||
#define I386_ACTIVE_TSS 0xB
|
||||
#define I386_CALL_GATE 0xC
|
||||
#define I386_INTERRUPT_GATE 0xE
|
||||
#define I386_TRAP_GATE 0xF
|
||||
|
||||
/* EXPORTED DATA *************************************************************/
|
||||
extern CHAR NTOSAPI KeNumberProcessors;
|
||||
extern LOADER_PARAMETER_BLOCK NTOSAPI KeLoaderBlock;
|
||||
|
@ -226,6 +233,22 @@ typedef struct _KGDTENTRY
|
|||
} HighWord;
|
||||
} KGDTENTRY, *PKGDTENTRY;
|
||||
|
||||
typedef struct _KIDT_ACCESS
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
UCHAR Reserved;
|
||||
UCHAR SegmentType:4;
|
||||
UCHAR SystemSegmentFlag:1;
|
||||
UCHAR Dpl:2;
|
||||
UCHAR Present:1;
|
||||
};
|
||||
USHORT Value;
|
||||
};
|
||||
} KIDT_ACCESS, *PKIDT_ACCESS;
|
||||
|
||||
typedef struct _KIDTENTRY
|
||||
{
|
||||
USHORT Offset;
|
||||
|
|
Loading…
Reference in a new issue