- Enabled SYSENTER/SYSEXIT for application processors on smp machines.
Modified: trunk/reactos/ntoskrnl/ke/i386/kernel.c

Modified: trunk/reactos/ntoskrnl/ke/i386/kernel.c
--- trunk/reactos/ntoskrnl/ke/i386/kernel.c	2005-01-25 00:05:56 UTC (rev 13260)
+++ trunk/reactos/ntoskrnl/ke/i386/kernel.c	2005-01-25 00:28:45 UTC (rev 13261)
@@ -43,7 +43,7 @@
 BOOLEAN Ke386Pae = FALSE;
 BOOLEAN Ke386PaeEnabled = FALSE;
 BOOLEAN Ke386GlobalPagesEnabled = FALSE;
-ULONG KiFastSystemCallDisable = 0;
+ULONG KiFastSystemCallDisable = 1;
 
 /* FUNCTIONS *****************************************************************/
 
@@ -192,6 +192,18 @@
 
   KeInitDpc(Pcr);
 
+  if (Pcr->PrcbData.FeatureBits & X86_FEATURE_SYSCALL)
+  {
+     extern void KiFastCallEntry(void);
+
+     /* CS Selector of the target segment. */
+     Ke386Wrmsr(0x174, KERNEL_CS, 0);
+     /* Target ESP. */
+     Ke386Wrmsr(0x175, 0, 0);
+     /* Target EIP. */
+     Ke386Wrmsr(0x176, (ULONG_PTR)KiFastCallEntry, 0);
+  }
+
   /*
    * It is now safe to process interrupts
    */
@@ -412,6 +424,7 @@
    ULONG ResultLength;
    KEY_VALUE_PARTIAL_INFORMATION ValueData;
    NTSTATUS Status;
+   ULONG FastSystemCallDisable = 0;
 
    SharedUserData->ProcessorFeatures[PF_FLOATING_POINT_PRECISION_ERRATA] = FALSE;
    SharedUserData->ProcessorFeatures[PF_FLOATING_POINT_EMULATED] = FALSE;
@@ -457,7 +470,7 @@
                                      &ValueData,
                                      sizeof(ValueData),
                                      &ResultLength);
-            RtlMoveMemory(&KiFastSystemCallDisable, ValueData.Data, sizeof(ULONG));
+            RtlMoveMemory(&FastSystemCallDisable, ValueData.Data, sizeof(ULONG));
             
             NtClose(KeyHandle);
         }
@@ -465,21 +478,12 @@
     } else {
     
         /* Disable SYSENTER/SYSEXIT, because the CPU doesn't support it */
-        KiFastSystemCallDisable = 1;
+        FastSystemCallDisable = 1;
         
     }
     
-    if (!KiFastSystemCallDisable) {
+    if (FastSystemCallDisable) {
         
-        /* Use SYSENTER */
-        SharedUserData->SystemCall[0] = 0x8B;
-        SharedUserData->SystemCall[1] = 0xD4;
-        SharedUserData->SystemCall[2] = 0x0F;
-        SharedUserData->SystemCall[3] = 0x34;
-        SharedUserData->SystemCall[4] = 0xC3;    
-                  
-    } else {
-    
         /* Use INT2E */   
         SharedUserData->SystemCall[0] = 0x8D;
         SharedUserData->SystemCall[1] = 0x54;
@@ -488,5 +492,17 @@
         SharedUserData->SystemCall[4] = 0xCD;
         SharedUserData->SystemCall[5] = 0x2E;
         SharedUserData->SystemCall[6] = 0xC3;
+	                  
+    } else {
+    
+        /* Use SYSENTER */
+        SharedUserData->SystemCall[0] = 0x8B;
+        SharedUserData->SystemCall[1] = 0xD4;
+        SharedUserData->SystemCall[2] = 0x0F;
+        SharedUserData->SystemCall[3] = 0x34;
+        SharedUserData->SystemCall[4] = 0xC3;    
+
+        /* Enable SYSENTER/SYSEXIT */
+        KiFastSystemCallDisable = 0;
     }
 }