Add a nice little KIDT_ACCESS structure for setting IDT entries in a pretty way
Modified: trunk/reactos/hal/halx86/mp/apic.c
Modified: trunk/reactos/include/ndk/ketypes.h

Modified: trunk/reactos/hal/halx86/mp/apic.c
--- trunk/reactos/hal/halx86/mp/apic.c	2005-06-29 19:05:46 UTC (rev 16328)
+++ trunk/reactos/hal/halx86/mp/apic.c	2005-06-29 19:06:28 UTC (rev 16329)
@@ -906,11 +906,19 @@
 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;
 }
 

Modified: trunk/reactos/include/ndk/ketypes.h
--- trunk/reactos/include/ndk/ketypes.h	2005-06-29 19:05:46 UTC (rev 16328)
+++ trunk/reactos/include/ndk/ketypes.h	2005-06-29 19:06:28 UTC (rev 16329)
@@ -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 @@
     } 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;