Commit in reactos/ntoskrnl on MAIN
include/internal/debug.h+4-11.20 -> 1.21
                /ke.h+4-21.65 -> 1.66
ke/i386/usercall.c+16-81.31 -> 1.32
ps/kill.c+11-71.85 -> 1.86
+35-18
4 modified files
kill.c: remove useless call to KeRemoveAllWaitsThread + misc
usecall.c: fix apc delivery
debug.c: add irql asserts

reactos/ntoskrnl/include/internal
debug.h 1.20 -> 1.21
diff -u -r1.20 -r1.21
--- debug.h	22 Oct 2004 20:01:28 -0000	1.20
+++ debug.h	21 Nov 2004 18:42:58 -0000	1.21
@@ -124,7 +124,10 @@
  * ARGUMENTS:
  *        x = Maximum irql
  */
-#define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql()<=(x))
+#define ASSERT_IRQL_LESS_OR_EQUAL(x) ASSERT(KeGetCurrentIrql()<=(x))
+#define ASSERT_IRQL(x) ASSERT_IRQL_LESS_OR_EQUAL(x)
+#define ASSERT_IRQL_EQUAL(x) ASSERT(KeGetCurrentIrql()==(x))
+#define ASSERT_IRQL_LESS(x) ASSERT(KeGetCurrentIrql()<(x))
 #define assert_irql(x) assert(KeGetCurrentIrql()<=(x))
 
 #endif /* __INTERNAL_DEBUG */

reactos/ntoskrnl/include/internal
ke.h 1.65 -> 1.66
diff -u -r1.65 -r1.66
--- ke.h	14 Nov 2004 20:00:06 -0000	1.65
+++ ke.h	21 Nov 2004 18:42:58 -0000	1.66
@@ -72,7 +72,7 @@
 VOID KeReleaseDispatcherDatabaseLock(KIRQL Irql);
 VOID KeReleaseDispatcherDatabaseLockFromDpcLevel(VOID);
 
-BOOLEAN KeDispatcherObjectWake(DISPATCHER_HEADER* hdr);
+BOOLEAN KiDispatcherObjectWake(DISPATCHER_HEADER* hdr);
 VOID STDCALL KeExpireTimers(PKDPC Apc,
 			    PVOID Arg1,
 			    PVOID Arg2,
@@ -81,7 +81,9 @@
 				  ULONG Size, ULONG SignalState);
 VOID KeDumpStackFrames(PULONG Frame);
 BOOLEAN KiTestAlert(VOID);
-VOID KeRemoveAllWaitsThread(struct _ETHREAD* Thread, NTSTATUS WaitStatus, BOOL Unblock);
+
+BOOLEAN KiAbortWaitThread(struct _KTHREAD* Thread, NTSTATUS WaitStatus);
+
 PULONG KeGetStackTopThread(struct _ETHREAD* Thread);
 VOID KeContextToTrapFrame(PCONTEXT Context, PKTRAP_FRAME TrapFrame);
 VOID STDCALL KiDeliverApc(KPROCESSOR_MODE PreviousMode,

reactos/ntoskrnl/ke/i386
usercall.c 1.31 -> 1.32
diff -u -r1.31 -r1.32
--- usercall.c	10 Nov 2004 02:51:00 -0000	1.31
+++ usercall.c	21 Nov 2004 18:42:58 -0000	1.32
@@ -1,4 +1,4 @@
-/* $Id: usercall.c,v 1.31 2004/11/10 02:51:00 ion Exp $
+/* $Id: usercall.c,v 1.32 2004/11/21 18:42:58 gdalsnes Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -41,14 +41,22 @@
 VOID
 KiAfterSystemCallHook(PKTRAP_FRAME TrapFrame)
 {
-  if (KeGetCurrentThread()->Alerted[1] != 0 && TrapFrame->Cs != KERNEL_CS)
-    {
-      KiDeliverApc(KernelMode, NULL, NULL);
-    }
-  if (KeGetCurrentThread()->Alerted[0] != 0 && TrapFrame->Cs != KERNEL_CS)
-    {
+   KIRQL oldIrql;
+   
+   /* If we are returning to umode, deliver one pending umode apc.
+    * Note that kmode apcs are also delivered, even if deliverymode is UserMode.
+    * This is because we can't return to umode with pending kmode apcs!
+    * FIXME: Should we deliver pending kmode apcs when returning from a 
+    * kmode-to-kmode syscall (ZwXxx calls)?????
+    * -Gunnar
+    */
+   if (TrapFrame->Cs != KERNEL_CS)
+   {
+      KeRaiseIrql(APC_LEVEL, &oldIrql);
       KiDeliverApc(UserMode, NULL, TrapFrame);
-    }
+      KeLowerIrql(oldIrql);
+   }
+
 }
 
 

reactos/ntoskrnl/ps
kill.c 1.85 -> 1.86
diff -u -r1.85 -r1.86
--- kill.c	20 Nov 2004 23:46:37 -0000	1.85
+++ kill.c	21 Nov 2004 18:42:58 -0000	1.86
@@ -1,4 +1,4 @@
-/* $Id: kill.c,v 1.85 2004/11/20 23:46:37 blight Exp $
+/* $Id: kill.c,v 1.86 2004/11/21 18:42:58 gdalsnes Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -133,6 +133,7 @@
 
    DPRINT("terminating %x\n",CurrentThread);
 
+   CurrentThread->HasTerminated = TRUE;
    CurrentThread->ExitStatus = ExitStatus;
    KeQuerySystemTime((PLARGE_INTEGER)&CurrentThread->ExitTime);
    KeCancelTimer(&CurrentThread->Tcb.Timer);
@@ -192,7 +193,7 @@
 
    oldIrql = KeAcquireDispatcherDatabaseLock();
    CurrentThread->Tcb.DispatcherHeader.SignalState = TRUE;
-   KeDispatcherObjectWake(&CurrentThread->Tcb.DispatcherHeader);
+   KiDispatcherObjectWake(&CurrentThread->Tcb.DispatcherHeader);
    KeReleaseDispatcherDatabaseLock (oldIrql);
 
    /* The last thread shall close the door on exit */
@@ -211,8 +212,9 @@
 #ifdef _ENABLE_THRDEVTPAIR
    ExpSwapThreadEventPair(CurrentThread, NULL); /* Release the associated eventpair object, if there was one */
 #endif /* _ENABLE_THRDEVTPAIR */
-   KeRemoveAllWaitsThread (CurrentThread, STATUS_UNSUCCESSFUL, FALSE);
 
+   ASSERT(CurrentThread->Tcb.WaitBlockList == NULL);
+   
    PsDispatchThreadNoLock(THREAD_STATE_TERMINATED_1);
    DPRINT1("Unexpected return, CurrentThread %x PsGetCurrentThread() %x\n", CurrentThread, PsGetCurrentThread());
    KEBUGCHECK(0);
@@ -251,7 +253,7 @@
  */
 {
   PKAPC Apc;
-  NTSTATUS Status;
+  KIRQL OldIrql;
 
   DPRINT("PsTerminateOtherThread(Thread %x, ExitStatus %x)\n",
 	 Thread, ExitStatus);
@@ -271,12 +273,14 @@
 		   NULL,
 		   NULL,
 		   IO_NO_INCREMENT);
+
+  OldIrql = KeAcquireDispatcherDatabaseLock();          
   if (THREAD_STATE_BLOCKED == Thread->Tcb.State && UserMode == Thread->Tcb.WaitMode)
     {
       DPRINT("Unblocking thread\n");
-      Status = STATUS_THREAD_IS_TERMINATING;
-      KeRemoveAllWaitsThread(Thread, Status, TRUE);
+      KiAbortWaitThread((PKTHREAD)Thread, STATUS_THREAD_IS_TERMINATING);
     }
+  KeReleaseDispatcherDatabaseLock(OldIrql); 
 }
 
 NTSTATUS STDCALL
@@ -310,7 +314,7 @@
    }
    OldIrql = KeAcquireDispatcherDatabaseLock ();
    Process->Pcb.DispatcherHeader.SignalState = TRUE;
-   KeDispatcherObjectWake(&Process->Pcb.DispatcherHeader);
+   KiDispatcherObjectWake(&Process->Pcb.DispatcherHeader);
    KeReleaseDispatcherDatabaseLock (OldIrql);
    ObDereferenceObject(Process);
    return(STATUS_SUCCESS);
CVSspam 0.2.8