- Optimized the dispatcher lock. It is now gone on non-SMP systems and IRQL is raised...
[reactos.git] / reactos / ntoskrnl / ke / i386 / ctxswitch.S
index e3d6f01..3192531 100644 (file)
@@ -13,7 +13,6 @@
 #include <roscfg.h>
 #include <internal/i386/ke.h>
 #include <ndk/asm.h>
-#include <ndk/i386/segment.h>
 .intel_syntax noprefix
 
 #define Running 2 
@@ -22,6 +21,8 @@
 
 /* GLOBALS ****************************************************************/  
 
+.extern _DispatcherDatabaseLock
+
 /* FUNCTIONS ****************************************************************/
 
 /*++
@@ -61,7 +62,7 @@ _KiThreadStartup@156:
      * expect any static data (like some badly coded usermode/win9x apps do)
      */
     xor ebx, ebx
-    xor esi, edi
+    xor esi, esi
     xor edi, edi
     xor ebp, ebp
     
@@ -197,12 +198,12 @@ NoAddressSpaceSwitch:
     /* Write the LDT Selector */
     mov ebp, [ebx+KPCR_GDT]
     mov eax, [edi+KPROCESS_LDT_DESCRIPTOR0]
-    mov [ebp+LDT_SELECTOR], eax
+    mov [ebp+KGDT_LDT], eax
     mov eax, [edi+KPROCESS_LDT_DESCRIPTOR1]
-    mov [ebp+LDT_SELECTOR+4], eax
+    mov [ebp+KGDT_LDT+4], eax
     
     /* Save LDT Selector */
-    mov eax, LDT_SELECTOR
+    mov eax, KGDT_LDT
         
 NoLdt:
     
@@ -245,7 +246,10 @@ SameProcess:
     pop [ebx+KPCR_EXCEPTION_LIST]
 
     /* Return */
-    call @KeReleaseDispatcherDatabaseLockFromDpcLevel@0
+//#ifdef CONFIG_SMP
+    mov ecx, _DispatcherDatabaseLock
+    call @KefReleaseSpinLockFromDpcLevel@4
+//#endif
     ret 
 
 /*++