[ros-diffs] [sir_richard] 45353: [PERF]: Omit setting certain useless trap frame fields. [NTOS]: Fix KiEnterInterruptFrame. In the case of a V86 trap, the segments were overriden because this wasn't a kernel trap (missing if/elseif).

sir_richard at svn.reactos.org sir_richard at svn.reactos.org
Sat Jan 30 19:25:30 CET 2010


Author: sir_richard
Date: Sat Jan 30 19:25:30 2010
New Revision: 45353

URL: http://svn.reactos.org/svn/reactos?rev=45353&view=rev
Log:
[PERF]: Omit setting certain useless trap frame fields.
[NTOS]: Fix KiEnterInterruptFrame. In the case of a V86 trap, the segments were overriden because this wasn't a kernel trap (missing if/elseif).

Modified:
    trunk/reactos/ntoskrnl/include/internal/trap_x.h

Modified: trunk/reactos/ntoskrnl/include/internal/trap_x.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/trap_x.h?rev=45353&r1=45352&r2=45353&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/trap_x.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/trap_x.h [iso-8859-1] Sat Jan 30 19:25:30 2010
@@ -616,8 +616,7 @@
     Ke386SetDs(KGDT_R3_DATA | RPL_MASK);
     Ke386SetEs(KGDT_R3_DATA | RPL_MASK);
 
-    /* Save exception list and bogus previous mode */
-    TrapFrame->PreviousPreviousMode = -1;
+    /* Save exception list */
     TrapFrame->ExceptionList = KeGetPcr()->Tib.ExceptionList;
 
     /* Clear direction flag */
@@ -639,10 +638,7 @@
 FORCEINLINE
 KiEnterInterruptTrap(IN PKTRAP_FRAME TrapFrame)
 {
-    /* Set bogus previous mode */
-    TrapFrame->PreviousPreviousMode = -1;
-    
-    /* Check for V86 mode */
+    /* Check for V86 mode, otherwise check for ring 3 code */
     if (__builtin_expect(TrapFrame->EFlags & EFLAGS_V86_MASK, 0))
     {
         /* Restore V8086 segments into Protected Mode segments */
@@ -651,9 +647,7 @@
         TrapFrame->SegDs = TrapFrame->V86Ds;
         TrapFrame->SegEs = TrapFrame->V86Es;
     }
-    
-    /* Check if this wasn't kernel code */
-    if (__builtin_expect(TrapFrame->SegCs != KGDT_R0_CODE, 1)) /* Ring 3 is more common */
+    else if (__builtin_expect(TrapFrame->SegCs != KGDT_R0_CODE, 1)) /* Ring 3 is more common */
     {
         /* Save segments and then switch to correct ones */
         TrapFrame->SegFs = Ke386GetFs();
@@ -668,10 +662,7 @@
     /* Save exception list and terminate it */
     TrapFrame->ExceptionList = KeGetPcr()->Tib.ExceptionList;
     KeGetPcr()->Tib.ExceptionList = EXCEPTION_CHAIN_END;
-    
-    /* No error code */
-    TrapFrame->ErrCode = 0;
-    
+
     /* Clear direction flag */
     Ke386ClearDirectionFlag();
     
@@ -718,8 +709,7 @@
     TrapFrame->SegGs = Ke386GetGs();
     Ke386SetFs(KGDT_R0_PCR);
 
-    /* Save exception list and bogus previous mode */
-    TrapFrame->PreviousPreviousMode = -1;
+    /* Save exception list */
     TrapFrame->ExceptionList = KeGetPcr()->Tib.ExceptionList;
     
     /* Check for V86 mode */




More information about the Ros-diffs mailing list