Author: fireball
Date: Fri Jun 22 01:18:19 2007
New Revision: 27257
URL:
http://svn.reactos.org/svn/reactos?rev=27257&view=rev
Log:
- Set GDT and IDT to the values ReactOS kernel expects. This gets us lots farther in the
kernel, up to the BSOD with CONFIG_INITIALIZATION_FAILED.
Modified:
branches/olpc/boot/freeldr/freeldr/arch/i386/arch.S
branches/olpc/boot/freeldr/freeldr/arch/i386/loader.c
Modified: branches/olpc/boot/freeldr/freeldr/arch/i386/arch.S
URL:
http://svn.reactos.org/svn/reactos/branches/olpc/boot/freeldr/freeldr/arch/…
==============================================================================
--- branches/olpc/boot/freeldr/freeldr/arch/i386/arch.S (original)
+++ branches/olpc/boot/freeldr/freeldr/arch/i386/arch.S Fri Jun 22 01:18:19 2007
@@ -480,7 +480,7 @@
.word 0x0000
/* GDT table pointer */
-gdtptr:
+EXTERN(gdtptr)
.word 0x27 /* Limit */
.long gdt /* Base Address */
Modified: branches/olpc/boot/freeldr/freeldr/arch/i386/loader.c
URL:
http://svn.reactos.org/svn/reactos/branches/olpc/boot/freeldr/freeldr/arch/…
==============================================================================
--- branches/olpc/boot/freeldr/freeldr/arch/i386/loader.c (original)
+++ branches/olpc/boot/freeldr/freeldr/arch/i386/loader.c Fri Jun 22 01:18:19 2007
@@ -19,6 +19,8 @@
*/
#define _NTSYSTEM_
#include <freeldr.h>
+
+#include <arch.h>
#define NDEBUG
#include <debug.h>
@@ -56,6 +58,10 @@
PUCHAR SymbolName,
USHORT Hint);
+VOID FASTCALL
+FrLdrResetGdtIdt();
+
+
/* FUNCTIONS *****************************************************************/
/*++
@@ -87,12 +93,54 @@
/* Re-initalize EFLAGS */
Ke386EraseFlags();
+ /* Point GDT+IDT to FreeLdr instead of OFW */
+ FrLdrResetGdtIdt();
+
/* Initialize the page directory */
FrLdrSetupPageDirectory();
/* Initialize Paging, Write-Protection and Load NTOSKRNL */
FrLdrSetupPae(Magic);
}
+
+/*++
+ * FrLdrResetGdtIdt
+ * INTERNAL
+ *
+ * Sets GDT and IDT as to what ReactOS expects
+ *
+ * Params:
+ * Magic - Multiboot Magic
+ *
+ * Returns:
+ * None.
+ *
+ * Remarks:
+ * None.
+ *
+ *--*/
+VOID
+FASTCALL
+FrLdrResetGdtIdt()
+{
+ /* Load the GDT and IDT */
+ asm("lgdt gdtptr\n\
+ lidt i386idtptr\n");
+
+ /* Clear prefetch queue & correct CS,
+ * jump to low mem */
+ asm("ljmp $0x08, $mb4\n\
+ mb4:\n");
+
+ /* Reload segment selectors */
+ asm("movw $0x10,%dx\n\
+ movw %dx,%ds\n\
+ movw %dx,%es\n\
+ movw %dx,%fs\n\
+ movw %dx,%gs\n\
+ movw %dx,%ss\n");
+}
+
/*++
* FrLdrSetupPae