Author: sginsberg
Date: Mon May 31 14:52:16 2010
New Revision: 47487
URL:
http://svn.reactos.org/svn/reactos?rev=47487&view=rev
Log:
[NTOS] Re-enable the APC debug check in the system call exit code that somehow got removed
in 46247.
[NTOS] Use an inline for emitting the iret instruction in C code for portability.
[NTOS] Simplify the MSC assembly in KiSwitchToBootStack.
Modified:
trunk/reactos/ntoskrnl/include/internal/i386/ke.h
trunk/reactos/ntoskrnl/include/internal/trap_x.h
trunk/reactos/ntoskrnl/ke/i386/traphdlr.c
Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/ke.h [iso-8859-1] Mon May 31 14:52:16
2010
@@ -774,8 +774,7 @@
VOID NTAPI KiSystemStartupBootStack(VOID);
__asm
{
- mov ecx, InitialStack
- mov esp, ecx
+ mov esp, InitialStack
sub esp, (NPX_FRAME_LENGTH + KTRAP_FRAME_ALIGN + KTRAP_FRAME_LENGTH)
push (CR0_EM | CR0_TS | CR0_MP)
jmp KiSystemStartupBootStack
@@ -786,6 +785,30 @@
}
//
+// Emits the iret instruction for C code
+//
+DECLSPEC_NORETURN
+VOID
+FORCEINLINE
+KiIret(VOID)
+{
+#if defined(__GNUC__)
+ __asm__ __volatile__
+ (
+ "iret\n"
+ );
+#elif defined(_MSC_VER)
+ __asm
+ {
+ iret
+ }
+#else
+#error Unsupported compiler
+#endif
+ UNREACHABLE;
+}
+
+//
// Normally this is done by the HAL, but on x86 as an optimization, the kernel
// initiates the end by calling back into the HAL and exiting the trap here.
//
Modified: trunk/reactos/ntoskrnl/include/internal/trap_x.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/trap_x.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/trap_x.h [iso-8859-1] Mon May 31 14:52:16
2010
@@ -8,7 +8,7 @@
#pragma once
-//#define TRAP_DEBUG 1
+#define TRAP_DEBUG 0
//
// Unreachable code hint for GCC 4.5.x, older GCC versions, and MSVC
@@ -81,7 +81,7 @@
DbgPrint("V86Gs: %x\n", TrapFrame->V86Gs);
}
-#ifdef TRAP_DEBUG
+#if TRAP_DEBUG
VOID
FORCEINLINE
KiFillTrapFrameDebug(IN PKTRAP_FRAME TrapFrame)
@@ -168,7 +168,7 @@
0,
0);
}
-#if 0
+
/* Make sure we're not attached and that APCs are not disabled */
if ((KeGetCurrentThread()->ApcStateIndex != CurrentApcEnvironment) ||
(KeGetCurrentThread()->CombinedApcDisable != 0))
@@ -180,7 +180,6 @@
KeGetCurrentThread()->CombinedApcDisable,
0);
}
-#endif
}
}
#else
@@ -200,9 +199,11 @@
DECLSPEC_NORETURN VOID FASTCALL KiTrapReturnNoSegments(IN PKTRAP_FRAME TrapFrame);
typedef
-VOID
-(FASTCALL
-*PFAST_SYSTEM_CALL_EXIT)(IN PKTRAP_FRAME TrapFrame);
+DECLSPEC_NORETURN
+VOID
+(FASTCALL *PFAST_SYSTEM_CALL_EXIT)(
+ IN PKTRAP_FRAME TrapFrame
+);
extern PFAST_SYSTEM_CALL_EXIT KiFastCallExitHandler;
@@ -222,7 +223,7 @@
while (TRUE)
{
/* Return if this isn't V86 mode anymore */
- if (!(TrapFrame->EFlags & EFLAGS_V86_MASK)) KiEoiHelper(TrapFrame);;
+ if (!(TrapFrame->EFlags & EFLAGS_V86_MASK)) KiEoiHelper(TrapFrame);
/* Turn off the alerted state for kernel mode */
Thread->Alerted[KernelMode] = FALSE;
Modified: trunk/reactos/ntoskrnl/ke/i386/traphdlr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/traphdlr.…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/traphdlr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/traphdlr.c [iso-8859-1] Mon May 31 14:52:16 2010
@@ -547,7 +547,7 @@
//
// Handled, return from interrupt
//
- __asm__ __volatile__ ("iret\n");
+ KiIret();
}
//