[ros-diffs] [sginsberg] 56234: [NTOS] - Fix a crazy bug in KiTrap0EHandler, it didn't enable interrupts unless it trapped when interrupts were already disabled (during a page fault during page fault handling, ...

sginsberg at svn.reactos.org sginsberg at svn.reactos.org
Mon Mar 26 13:00:17 UTC 2012


Author: sginsberg
Date: Mon Mar 26 13:00:16 2012
New Revision: 56234

URL: http://svn.reactos.org/svn/reactos?rev=56234&view=rev
Log:
[NTOS]
- Fix a crazy bug in KiTrap0EHandler, it didn't enable interrupts unless it trapped when interrupts were already disabled (during a page fault during page fault handling, for example). This seems to have worked because the old non-newcc version of MiReadPage appears to rely on a page fault to bring the paged out page in. Thanks Timo.

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

Modified: trunk/reactos/ntoskrnl/ke/i386/traphdlr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/traphdlr.c?rev=56234&r1=56233&r2=56234&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/traphdlr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/traphdlr.c [iso-8859-1] Mon Mar 26 13:00:16 2012
@@ -1183,27 +1183,23 @@
             while (TRUE);
         }
     }
-    
+
     /* Save CR2 */
     Cr2 = __readcr2();
-    
-    /* HACK: Check if interrupts are disabled and enable them */
+
+    /* Enable interupts */
+    _enable();
+
+    /* Check if we faulted with interrupts disabled */
     if (!(TrapFrame->EFlags & EFLAGS_INTERRUPT_MASK))
     {
-        /* Enable interupts */
-        _enable();
-#ifdef HACK_ABOVE_FIXED
-        if (!(TrapFrame->EFlags & EFLAGS_INTERRUPT_MASK))
-        {
-            /* This is illegal */
-            KeBugCheckWithTf(IRQL_NOT_LESS_OR_EQUAL,
-                             Cr2,
-                             -1,
-                             TrapFrame->ErrCode & 2 ? TRUE : FALSE,
-                             TrapFrame->Eip,
-                             TrapFrame);
-        }
-#endif
+        /* This is completely illegal, bugcheck the system */
+        KeBugCheckWithTf(IRQL_NOT_LESS_OR_EQUAL,
+                         Cr2,
+                         -1,
+                         TrapFrame->ErrCode & 2 ? TRUE : FALSE,
+                         TrapFrame->Eip,
+                         TrapFrame);
     }
 
     /* Check for S-LIST fault in kernel mode */




More information about the Ros-diffs mailing list