Author: fireball
Date: Wed Dec 22 14:26:36 2010
New Revision: 50095
URL:
http://svn.reactos.org/svn/reactos?rev=50095&view=rev
Log:
[NTOS]
- Always initialize TrapFrame segment selectors in KiEnterTrap, because further C code
relies on at least TrapFrame->SegFs being correct. Running Arwinss on VirtualBox
exposed this bug.
I wouldn't find solution for this bug without Timo's great help!
Modified:
trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S
Modified: trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S [iso-8859-1] Wed Dec 22
14:26:36 2010
@@ -135,7 +135,17 @@
endif
/* Save segment registers? */
- if (NOT (Flags AND KI_DONT_SAVE_SEGS))
+ if (Flags AND KI_DONT_SAVE_SEGS)
+
+ /* Initialize TrapFrame segment registers with sane values */
+ mov eax, 0x23
+ mov ecx, fs
+ mov [esp - FrameSize + KTRAP_FRAME_DS], eax
+ mov [esp - FrameSize + KTRAP_FRAME_ES], eax
+ mov [esp - FrameSize + KTRAP_FRAME_FS], ecx
+ mov dword ptr [esp - FrameSize + KTRAP_FRAME_GS], 0
+
+ else
/* Check for V86 mode */
test byte ptr [esp + KTRAP_FRAME_EFLAGS + 2], (EFLAGS_V86_MASK / HEX(10000))