Author: dgorbachev
Date: Thu Jul 30 19:54:01 2009
New Revision: 42305
URL:
http://svn.reactos.org/svn/reactos?rev=42305&view=rev
Log:
Add a hack in KiSystemStartupReal function until Better Times.
Modified:
trunk/reactos/ntoskrnl/ke/i386/kiinit.c
Modified: trunk/reactos/ntoskrnl/ke/i386/kiinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/kiinit.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/kiinit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/kiinit.c [iso-8859-1] Thu Jul 30 19:54:01 2009
@@ -712,18 +712,34 @@
Ke386SetDs(KGDT_R3_DATA | RPL_MASK);
Ke386SetEs(KGDT_R3_DATA | RPL_MASK);
- /* Save NMI and double fault traps */
- RtlCopyMemory(&NmiEntry, &Idt[2], sizeof(KIDTENTRY));
- RtlCopyMemory(&DoubleFaultEntry, &Idt[8], sizeof(KIDTENTRY));
-
- /* Copy kernel's trap handlers */
- RtlCopyMemory(Idt,
- (PVOID)KiIdtDescriptor.Base,
- KiIdtDescriptor.Limit + 1);
-
- /* Restore NMI and double fault */
- RtlCopyMemory(&Idt[2], &NmiEntry, sizeof(KIDTENTRY));
- RtlCopyMemory(&Idt[8], &DoubleFaultEntry, sizeof(KIDTENTRY));
+ /* HACK compensates for KiRosPrepareForSystemStartup hack */
+ if ((ULONG)Idt == KiIdtDescriptor.Base)
+ {
+ USHORT FlippedSelector;
+
+ FlippedSelector = KiIdt[2].Selector;
+ KiIdt[2].Selector = KiIdt[2].ExtendedOffset;
+ KiIdt[2].ExtendedOffset = FlippedSelector;
+
+ FlippedSelector = KiIdt[8].Selector;
+ KiIdt[8].Selector = KiIdt[8].ExtendedOffset;
+ KiIdt[8].ExtendedOffset = FlippedSelector;
+ }
+ else
+ {
+ /* Save NMI and double fault traps */
+ RtlCopyMemory(&NmiEntry, &Idt[2], sizeof(KIDTENTRY));
+ RtlCopyMemory(&DoubleFaultEntry, &Idt[8], sizeof(KIDTENTRY));
+
+ /* Copy kernel's trap handlers */
+ RtlCopyMemory(Idt,
+ (PVOID)KiIdtDescriptor.Base,
+ KiIdtDescriptor.Limit + 1);
+
+ /* Restore NMI and double fault */
+ RtlCopyMemory(&Idt[2], &NmiEntry, sizeof(KIDTENTRY));
+ RtlCopyMemory(&Idt[8], &DoubleFaultEntry, sizeof(KIDTENTRY));
+ }
AppCpuInit:
/* Loop until we can release the freeze lock */