That was a nice catch!

07.04.2012 0:13, [email protected] пишет:
Author: sginsberg
Date: Fri Apr  6 20:13:33 2012
New Revision: 56333

URL: http://svn.reactos.org/svn/reactos?rev=56333&view=rev
Log:
- Even while I love having the trap/fpu/context code in C, the bugs this switch 
introduced continue to amaze me. This time, fix a bug from 45156 when KiFlushNPXState was 
rewritten in C. The C version could miss to restore the interrupt state, which would lead 
to interrupts being disabled when it was not expected. This "interrupt leak" 
was seen in the page fault handler if a page fault occurred after interrupts had been 
disabled (which had sometimes been observed to occur on the test server during exception 
handling and thread creation when KiFlushNPXState had been called). This didn't 
completely hang the system because during thread creation (and other system calls where 
this may have happened) interrupts would be re-enabled when returning to user mode when 
restoring eflags, and the exception handling would result in a system call which would 
enable interrupts again (it appears exception handler would have run with interrupts 
disabled, though!). This is now fixed, as well as any other issues this might have 
caused. The hack in the page fault handler remains until another issue has been fixed.

Modified:
     trunk/reactos/ntoskrnl/ke/i386/cpu.c

Modified: trunk/reactos/ntoskrnl/ke/i386/cpu.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/cpu.c?rev=56333&r1=56332&r2=56333&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/cpu.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/cpu.c [iso-8859-1] Fri Apr  6 20:13:33 2012
@@ -1323,7 +1323,12 @@
      if (Thread->NpxState != NPX_STATE_LOADED)
      {
          /* If there's nothing to load, quit */
-        if (!SaveArea) return;
+        if (!SaveArea)
+        {
+            /* Restore interrupt state and return */
+            __writeeflags(EFlags);
+            return;
+        }

          /* Need FXSR support for this */
          ASSERT(KeI386FxsrPresent == TRUE);





_______________________________________________
Ros-dev mailing list
[email protected]
http://www.reactos.org/mailman/listinfo/ros-dev

Reply via email to