[ros-diffs] [tkreuzer] 52253: [FREELDR] - Add underscore to names of trap handlers and add C prototypes (will be needed later) - Move multiboot code to seperate file multiboot.S, not compiled atm, the code was...

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Wed Jun 15 19:17:01 UTC 2011


Author: tkreuzer
Date: Wed Jun 15 19:17:00 2011
New Revision: 52253

URL: http://svn.reactos.org/svn/reactos?rev=52253&view=rev
Log:
[FREELDR]
- Add underscore to names of trap handlers and add C prototypes (will be needed later)
- Move multiboot code to seperate file multiboot.S, not compiled atm, the code wasn't in use anyway
- Remove EnableA20 dummy

Added:
    trunk/reactos/boot/freeldr/freeldr/arch/i386/multiboot.S   (with props)
Modified:
    trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S
    trunk/reactos/boot/freeldr/freeldr/arch/i386/i386idt.S
    trunk/reactos/boot/freeldr/freeldr/arch/i386/i386trap.S
    trunk/reactos/boot/freeldr/freeldr/arch/i386/machpc.c
    trunk/reactos/boot/freeldr/freeldr/arch/i386/ntoskrnl.c
    trunk/reactos/boot/freeldr/freeldr/arch/i386/realmode.S
    trunk/reactos/boot/freeldr/freeldr/include/arch/i386/i386.h

Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S?rev=52253&r1=52252&r2=52253&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S [iso-8859-1] Wed Jun 15 19:17:00 2011
@@ -17,12 +17,12 @@
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-.intel_syntax noprefix
-#define HEX(y) 0x##y
-
 #include <asm.inc>
 #include <arch/pc/x86common.h>
 #include <multiboot.h>
+
+EXTERN _BootMain:PROC
+EXTERN _InitIdt:PROC
 
 .code32
 
@@ -74,6 +74,7 @@
 	nop
 	nop
 
+#ifndef _USE_ML
 /*
  * Switches the processor to protected mode
  * it destroys eax
@@ -213,12 +214,9 @@
 
 	/* Now return in r-mode! */
 	ret
-
+#endif
 
 .code32
-PUBLIC _EnableA20
-_EnableA20:
-    ret
 
 Int386_regsin:
 	.long 0
@@ -295,153 +293,6 @@
     nop
 
 
-/* Multiboot support
- *
- * Allows freeldr to be loaded as a "multiboot kernel" by
- * other boot loaders like Grub
- */
-
-#define MB_INFO_SIZE                90
-#define MB_INFO_FLAGS_OFFSET        0
-#define MB_INFO_BOOT_DEVICE_OFFSET  12
-#define MB_INFO_COMMAND_LINE_OFFSET 16
-#define CMDLINE_SIZE                256
-
-/*
- * We want to execute at 0x8000 (to be compatible with bootsector
- * loading), but Grub only allows loading of multiboot kernels
- * above 1MB. So we let Grub load us there and then relocate
- * ourself to 0x8000
- */
-#define FREELDR_BASE HEX(8000)
-#define INITIAL_BASE HEX(200000)
-
-	/* Align 32 bits boundary */
-.align 4
-
-	/* Multiboot header */
-MultibootHeader:
-	/* magic */
-	.long MULTIBOOT_HEADER_MAGIC
-	/* flags */
-	.long MULTIBOOT_HEADER_FLAGS
-	/* checksum */
-	.long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
-	/* header_addr */
-	.long INITIAL_BASE + MultibootHeader - FREELDR_BASE
-	/* load_addr */
-	.long INITIAL_BASE
-	/* load_end_addr */
-	.long INITIAL_BASE + __bss_start__ - FREELDR_BASE
-	/* bss_end_addr */
-	.long INITIAL_BASE + __bss_end__ - FREELDR_BASE
-	/* entry_addr */
-	.long INITIAL_BASE + MultibootEntry - FREELDR_BASE
-
-MultibootEntry:
-	cli		/* Even after setting up the our IDT below we are
-			 * not ready to handle hardware interrupts (no entries
-			 * in IDT), so there's no sti here. Interrupts will be
-			 * enabled in due time */
-
-	/* Although the multiboot spec says we should be called with the
-	 * segment registers set to 4GB flat mode, let's be sure and set up
-	 * our own */
-	lgdt	gdtptrhigh + INITIAL_BASE - FREELDR_BASE
-	/* Reload segment selectors */
-	//ljmp	$PMODE_CS, $(mb1 + INITIAL_BASE - FREELDR_BASE)
-	jmp far ptr PMODE_CS: (mb1 + INITIAL_BASE - FREELDR_BASE)
-mb1:
-	mov dx, PMODE_DS
-	mov ds, dx
-	mov es, dx
-
-	/* Check for valid multiboot signature */
-	cmp eax, MULTIBOOT_BOOTLOADER_MAGIC
-	jne mbfail
-
-	/* Store multiboot info in a safe place */
-	mov esi, ebx
-	mov edi, offset mb_info + INITIAL_BASE - FREELDR_BASE
-	mov ecx, MB_INFO_SIZE
-	rep movsb
-
-	/* Save commandline */
-	mov edx, [ebx + MB_INFO_FLAGS_OFFSET]
-	test dword ptr [ebx + MB_INFO_FLAGS_OFFSET], MB_INFO_FLAG_COMMAND_LINE
-	jz mb3
-	mov esi, [ebx + MB_INFO_COMMAND_LINE_OFFSET]
-	mov edi, offset cmdline + INITIAL_BASE - FREELDR_BASE
-	mov ecx, CMDLINE_SIZE
-mb2:	lodsb
-	stosb
-	test al, al
-	jz mb3
-	dec ecx
-	jnz mb2
-mb3:
-
-	/* Copy to low mem */
-	mov esi, INITIAL_BASE
-	mov edi, FREELDR_BASE
-	mov ecx, (offset __bss_end__ - FREELDR_BASE)
-	add ecx, 3
-	shr ecx, 2
-	rep movsd
-
-	/* Load the GDT and IDT */
-	lgdt	gdtptr
-	lidt	i386idtptr
-
-	/* Clear prefetch queue & correct CS,
-	 * jump to low mem */
-	//ljmp	$PMODE_CS, $mb4
-	jmp far ptr PMODE_CS:mb4
-mb4:
-	/* Reload segment selectors */
-	mov dx, PMODE_DS
-	mov ds, dx
-	mov es, dx
-	mov fs, dx
-	mov gs, dx
-	mov ss, dx
-	mov esp, STACK32ADDR
-
-	mov ebx, offset mb_info
-	/* See if the boot device was passed in */
-	mov edx, [ebx + MB_INFO_FLAGS_OFFSET]
-	test edx, MB_INFO_FLAG_BOOT_DEVICE
-	jz mb5
-	/* Retrieve boot device info */
-	mov eax, [ebx + MB_INFO_BOOT_DEVICE_OFFSET]
-	shr eax, 16
-	inc al
-	mov byte ptr [_FrldrBootPartition], al
-	mov byte ptr [_FrldrBootDrive], ah
-	jmp mb6
-mb5:	/* No boot device known, assume first partition of first harddisk */
-	mov byte ptr [_FrldrBootDrive], HEX(80)
-	mov byte ptr [_FrldrBootPartition], 1
-mb6:
-	/* Check for command line */
-	mov eax, offset cmdline
-	test dword ptr [ebx + MB_INFO_FLAGS_OFFSET], MB_INFO_FLAG_COMMAND_LINE
-	jnz mb7
-	xor eax, eax
-mb7:
-
-	/* GO! */
-	push eax
-	call	_BootMain
-
-mbfail:
-	call	switch_to_real
-	.code16
-	int	0x19
-mbstop:	jmp	mbstop	/* We should never get here */
-
-	.code32
-
 	/* 16-bit stack pointer */
 stack16:
 	.word	STACK16ADDR
@@ -496,22 +347,11 @@
 	.word HEX(27)		/* Limit */
 	.long gdt			/* Base Address */
 
-/* Initial GDT table pointer for multiboot */
-gdtptrhigh:
-	.word HEX(27)		/* Limit */
-	.long gdt + INITIAL_BASE - FREELDR_BASE	/* Base Address */
-
 /* Real-mode IDT pointer */
 rmode_idtptr:
 	.word HEX(3ff)		/* Limit */
 	.long 0			/* Base Address */
 
-mb_info:
-	.fill	MB_INFO_SIZE, 1, 0
-
-cmdline:
-	.fill	CMDLINE_SIZE, 1, 0
-
 PUBLIC _FrldrBootDrive
 _FrldrBootDrive:
     .long 0

Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/i386idt.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i386/i386idt.S?rev=52253&r1=52252&r2=52253&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/i386idt.S [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/i386idt.S [iso-8859-1] Wed Jun 15 19:17:00 2011
@@ -26,91 +26,91 @@
 	.p2align	2	/* force 4-byte alignment */
 EXTERN(i386idt)
 	/* Exception 0 - Divide By Zero */
-	.word	i386DivideByZero				/* Offset 0 - 15 */
+	.word	_i386DivideByZero				/* Offset 0 - 15 */
 	.word	0x0008						/* Selector */
 	.word	0x8e00						/* Flags, Zero Byte */
 	.word	0x0000						/* Offset 16 - 31 */
 
 	/* Exception 1 - Debug Exception */
-	.word	i386DebugException				/* Offset 0 - 15 */
+	.word	_i386DebugException				/* Offset 0 - 15 */
 	.word	0x0008						/* Selector */
 	.word	0x8e00						/* Zero byte, flags */
 	.word	0x0000						/* Offset 16 - 31 */
 
 	/* Exception 2 - NMI */
-	.word	i386NMIException				/* Offset 0 - 15 */
+	.word	_i386NMIException				/* Offset 0 - 15 */
 	.word	0x0008						/* Selector */
 	.word	0x8e00						/* Zero byte, flags */
 	.word	0x0000						/* Offset 16 - 31 */
 
 	/* Exception 3 - Breakpoint (INT 3) */
-	.word	i386Breakpoint					/* Offset 0 - 15 */
+	.word	_i386Breakpoint					/* Offset 0 - 15 */
 	.word	0x0008						/* Selector */
 	.word	0x8e00						/* Zero byte, flags */
 	.word	0x0000						/* Offset 16 - 31 */
 
 	/* Exception 4 - Overflow (INTO with EFLAGS[OF] set) */
-	.word	i386Overflow					/* Offset 0 - 15 */
+	.word	_i386Overflow					/* Offset 0 - 15 */
 	.word	0x0008						/* Selector */
 	.word	0x8e00						/* Zero byte, flags */
 	.word	0x0000						/* Offset 16 - 31 */
 
 	/* Exception 5 - Bound Exception */
-	.word	i386BoundException				/* Offset 0 - 15 */
+	.word	_i386BoundException				/* Offset 0 - 15 */
 	.word	0x0008						/* Selector */
 	.word	0x8e00						/* Zero byte, flags */
 	.word	0x0000						/* Offset 16 - 31 */
 
 	/* Exception 6 - Invalid Opcode */
-	.word	i386InvalidOpcode				/* Offset 0 - 15 */
+	.word	_i386InvalidOpcode				/* Offset 0 - 15 */
 	.word	0x0008						/* Selector */
 	.word	0x8e00						/* Zero byte, flags */
 	.word	0x0000						/* Offset 16 - 31 */
 
 	/* Exception 7 - FPU Not Available */
-	.word	i386FPUNotAvailable				/* Offset 0 - 15 */
+	.word	_i386FPUNotAvailable				/* Offset 0 - 15 */
 	.word	0x0008						/* Selector */
 	.word	0x8e00						/* Zero byte, flags */
 	.word	0x0000						/* Offset 16 - 31 */
 
 	/* Exception 8 - Double Fault */
-	.word	i386DoubleFault					/* Offset 0 - 15 */
+	.word	_i386DoubleFault					/* Offset 0 - 15 */
 	.word	0x0008						/* Selector */
 	.word	0x8e00						/* Zero byte, flags */
 	.word	0x0000						/* Offset 16 - 31 */
 
 	/* Exception 9 - Coprocessor Segment Overrun */
-	.word	i386CoprocessorSegment				/* Offset 0 - 15 */
+	.word	_i386CoprocessorSegment				/* Offset 0 - 15 */
 	.word	0x0008						/* Selector */
 	.word	0x8e00						/* Zero byte, flags */
 	.word	0x0000						/* Offset 16 - 31 */
 
 	/* Exception 10 (0x0A) - Invalid TSS */
-	.word	i386InvalidTSS					/* Offset 0 - 15 */
+	.word	_i386InvalidTSS					/* Offset 0 - 15 */
 	.word	0x0008						/* Selector */
 	.word	0x8e00						/* Zero byte, flags */
 	.word	0x0000						/* Offset 16 - 31 */
 
 	/* Exception 11 (0x0B) - Segment Not Present */
-	.word	i386SegmentNotPresent				/* Offset 0 - 15 */
+	.word	_i386SegmentNotPresent				/* Offset 0 - 15 */
 	.word	0x0008						/* Selector */
 	.word	0x8e00						/* Zero byte, flags */
 	.word	0x0000						/* Offset 16 - 31 */
 
 	/* Exception 12 (0x0C) - Stack Exception */
-	.word	i386StackException				/* Offset 0 - 15 */
+	.word	_i386StackException				/* Offset 0 - 15 */
 	.word	0x0008						/* Selector */
 	.word	0x8e00						/* Zero byte, flags */
 	.word	0x0000						/* Offset 16 - 31 */
 
 	/* Exception 13 (0x0D) - General Protection Fault */
-	.word	i386GeneralProtectionFault			/* Offset 0 - 15 */
+	.word	_i386GeneralProtectionFault			/* Offset 0 - 15 */
 	.word	0x0008						/* Selector */
 	.word	0x8e00						/* Zero byte, flags */
 	.word	0x0000						/* Offset 16 - 31 */
 
 	/* Exception 14 (0x0E) - Page Fault */
-	.word	i386PageFault					/* Offset 0 - 15 */
+	.word	_i386PageFault					/* Offset 0 - 15 */
 	.word	0x0008						/* Selector */
 	.word	0x8e00						/* Zero byte, flags */
 	.word	0x0000						/* Offset 16 - 31 */
@@ -122,19 +122,19 @@
 	.word	0x0000						/* Offset 16 - 31 */
 
 	/* Exception 16 (0x10) - Coprocessor Error */
-	.word	i386CoprocessorError				/* Offset 0 - 15 */
+	.word	_i386CoprocessorError				/* Offset 0 - 15 */
 	.word	0x0008						/* Selector */
 	.word	0x8e00						/* Zero byte, flags */
 	.word	0x0000						/* Offset 16 - 31 */
 
 	/* Exception 17 (0x11) - Alignment Check */
-	.word	i386AlignmentCheck				/* Offset 0 - 15 */
+	.word	_i386AlignmentCheck				/* Offset 0 - 15 */
 	.word	0x0008						/* Selector */
 	.word	0x8e00						/* Zero byte, flags */
 	.word	0x0000						/* Offset 16 - 31 */
 
 	/* Exception 18 (0x12) - Machine Check */
-	.word	i386MachineCheck				/* Offset 0 - 15 */
+	.word	_i386MachineCheck				/* Offset 0 - 15 */
 	.word	0x0008						/* Selector */
 	.word	0x8e00						/* Zero byte, flags */
 	.word	0x0000						/* Offset 16 - 31 */

Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/i386trap.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i386/i386trap.S?rev=52253&r1=52252&r2=52253&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/i386trap.S [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/i386trap.S [iso-8859-1] Wed Jun 15 19:17:00 2011
@@ -122,26 +122,26 @@
 .endm
 
 /************************************************************************/
-TRAP_STUB i386DivideByZero, 0
-TRAP_STUB i386DebugException, 1
-TRAP_STUB i386NMIException, 2
-TRAP_STUB i386Breakpoint, 3
-TRAP_STUB i386Overflow, 4
-TRAP_STUB i386BoundException, 5
-TRAP_STUB i386InvalidOpcode, 6
-TRAP_STUB i386FPUNotAvailable, 7
-TRAP_STUB2 i386DoubleFault, 8
-TRAP_STUB i386CoprocessorSegment, 9
-TRAP_STUB2 i386InvalidTSS, 10
-TRAP_STUB2 i386SegmentNotPresent, 11
-TRAP_STUB2 i386StackException, 12
-TRAP_STUB2 i386GeneralProtectionFault, 13
-TRAP_STUB2 i386PageFault, 14
+TRAP_STUB _i386DivideByZero, 0
+TRAP_STUB _i386DebugException, 1
+TRAP_STUB _i386NMIException, 2
+TRAP_STUB _i386Breakpoint, 3
+TRAP_STUB _i386Overflow, 4
+TRAP_STUB _i386BoundException, 5
+TRAP_STUB _i386InvalidOpcode, 6
+TRAP_STUB _i386FPUNotAvailable, 7
+TRAP_STUB2 _i386DoubleFault, 8
+TRAP_STUB _i386CoprocessorSegment, 9
+TRAP_STUB2 _i386InvalidTSS, 10
+TRAP_STUB2 _i386SegmentNotPresent, 11
+TRAP_STUB2 _i386StackException, 12
+TRAP_STUB2 _i386GeneralProtectionFault, 13
+TRAP_STUB2 _i386PageFault, 14
 // 15 is reserved
-TRAP_STUB i386CoprocessorError, 16
-TRAP_STUB i386AlignmentCheck, 17
-TRAP_STUB i386MachineCheck, 18
-TRAP_STUB i386SimdFloatError, 19
+TRAP_STUB _i386CoprocessorError, 16
+TRAP_STUB _i386AlignmentCheck, 17
+TRAP_STUB _i386MachineCheck, 18
+TRAP_STUB _i386SimdFloatError, 19
 
 /************************************************************************
  * DEBUGGING SUPPORT FUNCTIONS

Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/machpc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i386/machpc.c?rev=52253&r1=52252&r2=52253&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/machpc.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/machpc.c [iso-8859-1] Wed Jun 15 19:17:00 2011
@@ -22,8 +22,6 @@
 VOID
 PcMachInit(const char *CmdLine)
 {
-    EnableA20();
-
     /* Setup vtbl */
     MachVtbl.ConsPutChar = PcConsPutChar;
     MachVtbl.ConsKbHit = PcConsKbHit;

Added: trunk/reactos/boot/freeldr/freeldr/arch/i386/multiboot.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i386/multiboot.S?rev=52253&view=auto
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/multiboot.S (added)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/multiboot.S [iso-8859-1] Wed Jun 15 19:17:00 2011
@@ -1,0 +1,178 @@
+/*
+ *  FreeLoader
+ *  Copyright (C) 1998-2002  Brian Palmer  <brianp at sginet.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <asm.inc>
+#include <arch/pc/x86common.h>
+#include <multiboot.h>
+
+
+/* Multiboot support
+ *
+ * Allows freeldr to be loaded as a "multiboot kernel" by
+ * other boot loaders like Grub
+ */
+
+#define MB_INFO_SIZE                90
+#define MB_INFO_FLAGS_OFFSET        0
+#define MB_INFO_BOOT_DEVICE_OFFSET  12
+#define MB_INFO_COMMAND_LINE_OFFSET 16
+#define CMDLINE_SIZE                256
+
+/*
+ * We want to execute at 0x8000 (to be compatible with bootsector
+ * loading), but Grub only allows loading of multiboot kernels
+ * above 1MB. So we let Grub load us there and then relocate
+ * ourself to 0x8000
+ */
+#define INITIAL_BASE HEX(200000)
+
+	/* Align 32 bits boundary */
+.align 4
+
+	/* Multiboot header */
+MultibootHeader:
+	/* magic */
+	.long MULTIBOOT_HEADER_MAGIC
+	/* flags */
+	.long MULTIBOOT_HEADER_FLAGS
+	/* checksum */
+	.long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
+	/* header_addr */
+	.long INITIAL_BASE + MultibootHeader - FREELDR_BASE
+	/* load_addr */
+	.long INITIAL_BASE
+	/* load_end_addr */
+	.long INITIAL_BASE + __bss_start__ - FREELDR_BASE
+	/* bss_end_addr */
+	.long INITIAL_BASE + __bss_end__ - FREELDR_BASE
+	/* entry_addr */
+	.long INITIAL_BASE + MultibootEntry - FREELDR_BASE
+
+MultibootEntry:
+	cli		/* Even after setting up the our IDT below we are
+			 * not ready to handle hardware interrupts (no entries
+			 * in IDT), so there's no sti here. Interrupts will be
+			 * enabled in due time */
+
+	/* Although the multiboot spec says we should be called with the
+	 * segment registers set to 4GB flat mode, let's be sure and set up
+	 * our own */
+	lgdt	gdtptrhigh + INITIAL_BASE - FREELDR_BASE
+	/* Reload segment selectors */
+	//ljmp	$PMODE_CS, $(mb1 + INITIAL_BASE - FREELDR_BASE)
+	jmp far ptr PMODE_CS: (mb1 + INITIAL_BASE - FREELDR_BASE)
+mb1:
+	mov dx, PMODE_DS
+	mov ds, dx
+	mov es, dx
+
+	/* Check for valid multiboot signature */
+	cmp eax, MULTIBOOT_BOOTLOADER_MAGIC
+	jne mbfail
+
+	/* Store multiboot info in a safe place */
+	mov esi, ebx
+	mov edi, offset mb_info + INITIAL_BASE - FREELDR_BASE
+	mov ecx, MB_INFO_SIZE
+	rep movsb
+
+	/* Save commandline */
+	mov edx, [ebx + MB_INFO_FLAGS_OFFSET]
+	test dword ptr [ebx + MB_INFO_FLAGS_OFFSET], MB_INFO_FLAG_COMMAND_LINE
+	jz mb3
+	mov esi, [ebx + MB_INFO_COMMAND_LINE_OFFSET]
+	mov edi, offset cmdline + INITIAL_BASE - FREELDR_BASE
+	mov ecx, CMDLINE_SIZE
+mb2:	lodsb
+	stosb
+	test al, al
+	jz mb3
+	dec ecx
+	jnz mb2
+mb3:
+
+	/* Copy to low mem */
+	mov esi, INITIAL_BASE
+	mov edi, FREELDR_BASE
+	mov ecx, (offset __bss_end__ - FREELDR_BASE)
+	add ecx, 3
+	shr ecx, 2
+	rep movsd
+
+	/* Load the GDT and IDT */
+	lgdt	gdtptr
+	lidt	i386idtptr
+
+	/* Clear prefetch queue & correct CS,
+	 * jump to low mem */
+	//ljmp	$PMODE_CS, $mb4
+	jmp far ptr PMODE_CS:mb4
+mb4:
+	/* Reload segment selectors */
+	mov dx, PMODE_DS
+	mov ds, dx
+	mov es, dx
+	mov fs, dx
+	mov gs, dx
+	mov ss, dx
+	mov esp, STACK32ADDR
+
+	mov ebx, offset mb_info
+	/* See if the boot device was passed in */
+	mov edx, [ebx + MB_INFO_FLAGS_OFFSET]
+	test edx, MB_INFO_FLAG_BOOT_DEVICE
+	jz mb5
+	/* Retrieve boot device info */
+	mov eax, [ebx + MB_INFO_BOOT_DEVICE_OFFSET]
+	shr eax, 16
+	inc al
+	mov byte ptr [_FrldrBootPartition], al
+	mov byte ptr [_FrldrBootDrive], ah
+	jmp mb6
+mb5:	/* No boot device known, assume first partition of first harddisk */
+	mov byte ptr [_FrldrBootDrive], HEX(80)
+	mov byte ptr [_FrldrBootPartition], 1
+mb6:
+	/* Check for command line */
+	mov eax, offset cmdline
+	test dword ptr [ebx + MB_INFO_FLAGS_OFFSET], MB_INFO_FLAG_COMMAND_LINE
+	jnz mb7
+	xor eax, eax
+mb7:
+
+	/* GO! */
+	push eax
+	call	_BootMain
+
+mbfail:
+	call	switch_to_real
+	.code16
+	int	0x19
+mbstop:	jmp	mbstop	/* We should never get here */
+
+mb_info:
+	.fill MB_INFO_SIZE, 1, 0
+
+cmdline:
+	.fill CMDLINE_SIZE, 1, 0
+
+/* Initial GDT table pointer for multiboot */
+gdtptrhigh:
+	.word HEX(27)		/* Limit */
+	.long gdt + INITIAL_BASE - FREELDR_BASE	/* Base Address */

Propchange: trunk/reactos/boot/freeldr/freeldr/arch/i386/multiboot.S
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/ntoskrnl.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i386/ntoskrnl.c?rev=52253&r1=52252&r2=52253&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/ntoskrnl.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/ntoskrnl.c [iso-8859-1] Wed Jun 15 19:17:00 2011
@@ -72,6 +72,7 @@
     return STATUS_NOT_IMPLEMENTED;
 }
 
+#ifndef _MSC_VER
 NTHALAPI
 VOID
 NTAPI
@@ -119,3 +120,4 @@
     #error unimplemented
 #endif
 }
+#endif

Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/realmode.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i386/realmode.S?rev=52253&r1=52252&r2=52253&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/realmode.S [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/realmode.S [iso-8859-1] Wed Jun 15 19:17:00 2011
@@ -1,24 +1,11 @@
 
 
 #include <asm.inc>
-
-.code16
-PUBLIC _mainCRTStartup
-_mainCRTStartup:
-_LoaderEntry:
-    ret
-
-.endcode16
 
 .code32
 
 
 // globals
-PUBLIC _FrldrBootPartition
-_FrldrBootPartition:
-PUBLIC _FrldrBootDrive
-_FrldrBootDrive:
-
 PUBLIC _PageDirectoryStart
 _PageDirectoryStart:
 PUBLIC _PageDirectoryEnd
@@ -32,13 +19,6 @@
 _kernel_pagetable:
 PUBLIC _lowmem_pagetable
 _lowmem_pagetable:
-
-
-PUBLIC RealEntryPoint
-RealEntryPoint:
-
-PUBLIC _EnableA20
-_EnableA20:
 
 PUBLIC _ChainLoadBiosBootSectorCode
 _ChainLoadBiosBootSectorCode:
@@ -73,9 +53,6 @@
 PUBLIC _PnpBiosSupported
 _PnpBiosSupported:
 
-PUBLIC _Int386
-_Int386:
-
 PUBLIC _PxeCallApi
 _PxeCallApi:
 

Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/i386/i386.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/include/arch/i386/i386.h?rev=52253&r1=52252&r2=52253&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch/i386/i386.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch/i386/i386.h [iso-8859-1] Wed Jun 15 19:17:00 2011
@@ -24,4 +24,23 @@
 #undef KIP0PCRADDRESS
 #define KIP0PCRADDRESS                      0xffdff000
 
+void i386DivideByZero(void);
+void i386DebugException(void);
+void i386NMIException(void);
+void i386Breakpoint(void);
+void i386Overflow(void);
+void i386BoundException(void);
+void i386InvalidOpcode(void);
+void i386FPUNotAvailable(void);
+void i386DoubleFault(void);
+void i386CoprocessorSegment(void);
+void i386InvalidTSS(void);
+void i386SegmentNotPresent(void);
+void i386StackException(void);
+void i386GeneralProtectionFault(void);
+void i386PageFault(void);
+void i386CoprocessorError(void);
+void i386AlignmentCheck(void);
+void i386MachineCheck(void);
+
 /* EOF */




More information about the Ros-diffs mailing list