Author: ion
Date: Tue Mar 20 00:53:38 2007
New Revision: 26142
URL:
http://svn.reactos.org/svn/reactos?rev=26142&view=rev
Log:
- Fix an important bug which was causing us to incorrectly set the DPC Stack in the
Processor Region Control Block.
- Enable usage of the DPC Stack during DPCs.
- Enable usage of the DPC Stack during Fast System Calls and put back the correct push/pop
code in FASTCALL_PROLOG.
Modified:
trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S
trunk/reactos/ntoskrnl/ke/i386/kiinit.c
trunk/reactos/ntoskrnl/ke/i386/trap.s
trunk/reactos/ntoskrnl/ke/krnlinit.c
Modified: trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S Tue Mar 20 00:53:38 2007
@@ -699,14 +699,13 @@
// @remark None.
//
.macro FASTCALL_PROLOG Label EndLabel
- /* Set FS to PCR */
- //push KGDT_R0_PCR
- //pop fs
- mov ecx, KGDT_R0_PCR
- mov fs, cx
/* Set user selector */
mov ecx, KGDT_R3_DATA | RPL_MASK
+
+ /* Set FS to PCR */
+ push KGDT_R0_PCR
+ pop fs
/* Set DS/ES to User Selector */
mov ds, cx
Modified: trunk/reactos/ntoskrnl/ke/i386/kiinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/kiinit.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/kiinit.c (original)
+++ trunk/reactos/ntoskrnl/ke/i386/kiinit.c Tue Mar 20 00:53:38 2007
@@ -570,7 +570,7 @@
/* Allocate the DPC Stack */
DpcStack = MmCreateKernelStack(FALSE);
if (!DpcStack) KeBugCheckEx(NO_PAGES_AVAILABLE, 1, 0, 0, 0);
- Prcb->DpcStack = DpcStack;
+ Prcb->DpcStack = (PVOID)((ULONG_PTR)DpcStack + KERNEL_STACK_SIZE);
/* Allocate the IOPM save area. */
Ki386IopmSaveArea = ExAllocatePoolWithTag(PagedPool,
@@ -715,7 +715,7 @@
do
{
/* Loop until execution can continue */
- while ((volatile KSPIN_LOCK)KiFreezeExecutionLock == 1);
+ while (*(volatile PKSPIN_LOCK*)&KiFreezeExecutionLock == (PVOID)1);
} while(InterlockedBitTestAndSet((PLONG)&KiFreezeExecutionLock, 0));
/* Setup CPU-related fields */
@@ -745,17 +745,19 @@
KfRaiseIrql(HIGH_LEVEL);
/* Align stack and make space for the trap frame and NPX frame */
- InitialStack &= ~KTRAP_FRAME_ALIGN;
+ InitialStack &= -KTRAP_FRAME_ALIGN;
#ifdef __GNUC__
+ __asm__ __volatile__("xorl %ebp, %ebp");
__asm__ __volatile__("movl %0,%%esp" : :"r" (InitialStack));
__asm__ __volatile__("subl %0,%%esp" : :"r" (NPX_FRAME_LENGTH +
KTRAP_FRAME_LENGTH +
KTRAP_FRAME_ALIGN));
__asm__ __volatile__("push %0" : :"r" (CR0_EM + CR0_TS +
CR0_MP));
#else
+ __asm xor ebp, ebp;
__asm mov esp, InitialStack;
__asm sub esp, NPX_FRAME_LENGTH + KTRAP_FRAME_ALIGN + KTRAP_FRAME_LENGTH;
- __asm push CR0_EM + CR0_TS + CR0_MP
+ __asm push CR0_EM + CR0_TS + CR0_MP;
#endif
/* Call main kernel initialization */
Modified: trunk/reactos/ntoskrnl/ke/i386/trap.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/trap.s?re…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/trap.s (original)
+++ trunk/reactos/ntoskrnl/ke/i386/trap.s Tue Mar 20 00:53:38 2007
@@ -2165,7 +2165,7 @@
/* Save the stack and switch to the DPC Stack */
mov edx, esp
- //mov esp, [ebx+KPCR_PRCB_DPC_STACK]
+ mov esp, [ebx+KPCR_PRCB_DPC_STACK]
push edx
/* Deliver DPCs */
Modified: trunk/reactos/ntoskrnl/ke/krnlinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/krnlinit.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/krnlinit.c (original)
+++ trunk/reactos/ntoskrnl/ke/krnlinit.c Tue Mar 20 00:53:38 2007
@@ -289,6 +289,3 @@
KiInitMachineDependent();
return TRUE;
}
-
-
-