Move final stage of boot to architecture-dependent files Modified: branches/xen/reactos/boot/freeldr/freeldr/Makefile Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/i386boot.c Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/i386boot.h Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machpc.c Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machpc.h Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxbox.h Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/pcboot.c Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xboxboot.c Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenboot.c Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenvideo.c Modified: branches/xen/reactos/boot/freeldr/freeldr/include/machine.h Modified: branches/xen/reactos/boot/freeldr/freeldr/include/multiboot.h Modified: branches/xen/reactos/boot/freeldr/freeldr/machine.c Modified: branches/xen/reactos/boot/freeldr/freeldr/multiboot.c Modified: branches/xen/reactos/boot/freeldr/freeldr/reactos/reactos.c Modified: branches/xen/reactos/boot/freeldr/freeldr/reactos/setupldr.c _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/Makefile --- branches/xen/reactos/boot/freeldr/freeldr/Makefile 2005-05-17 21:18:04 UTC (rev 15390) +++ branches/xen/reactos/boot/freeldr/freeldr/Makefile 2005-05-17 22:15:18 UTC (rev 15391) @@ -135,7 +135,7 @@
# fathelp.o must come first in the link line because it contains bootsector helper code # arch.o must come second in the link line because it contains the startup code -ARCH_I386_OBJS = fathelp.o \ +ARCH_I386_OBJS = fathelp.o \ arch.o \ i386idt.o \ i386trap.o \ @@ -144,8 +144,9 @@ boot.o \ linux.o \ mb.o \ - i386rtl.o \ - i386vid.o \ + i386boot.o \ + i386rtl.o \ + i386vid.o \ drvmap.o \ int386.o \ i386disk.o \ @@ -159,18 +160,21 @@ machpc.o \ machxbox.o \ machxen.o \ + pcboot.o \ pccons.o \ pcdisk.o \ pcmem.o \ pcrtc.o \ - pcvideo.o \ + pcvideo.o \ + xboxboot.o \ xboxcons.o \ xboxdisk.o \ xboxfont.o \ xboxhw.o \ - xboxmem.o \ - xboxrtc.o \ - xboxvideo.o \ + xboxmem.o \ + xboxrtc.o \ + xboxvideo.o \ + xenboot.o \ xencons.o \ xenctrlif.o \ xendisk.o \ _____
Copied: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/i386boot.c (from rev 15334, branches/xen/reactos/boot/freeldr/freeldr/multiboot.c) --- branches/xen/reactos/boot/freeldr/freeldr/multiboot.c 2005-05-16 11:06:57 UTC (rev 15334) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/i386boot.c 2005-05-17 22:15:18 UTC (rev 15391) @@ -0,0 +1,449 @@
+/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: Freeloader + * FILE: boot/freeldr/freeldr/multiboot.c + * PURPOSE: ReactOS Loader + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + * Hartmut Birr - SMP/PAE Code + */ + +#include <freeldr.h> +#include <internal/i386/ke.h> + +#define NDEBUG +#include <debug.h> + +#include "i386boot.h" + +/* Bits to shift to convert a Virtual Address into an Offset in the Page Table */ +#define PFN_SHIFT 12 + +/* Bits to shift to convert a Virtual Address into an Offset in the Page Directory */ +#define PDE_SHIFT 20 +#define PDE_SHIFT_PAE 18 + + +/* Converts a Phsyical Address Pointer into a Page Frame Number */ +#define PaPtrToPfn(p) \ + (((ULONG_PTR)&p) >> PFN_SHIFT) + +/* Converts a Phsyical Address into a Page Frame Number */ +#define PaToPfn(p) \ + ((p) >> PFN_SHIFT) + +#define STARTUP_BASE 0xF0000000 +#define HYPERSPACE_BASE 0xF0800000 +#define APIC_BASE 0xFEC00000 +#define KPCR_BASE 0xFF000000 + +#define LowMemPageTableIndex 0 +#define StartupPageTableIndex (STARTUP_BASE >> 20) / sizeof(HARDWARE_PTE_X86) +#define HyperspacePageTableIndex (HYPERSPACE_BASE >> 20) / sizeof(HARDWARE_PTE_X86) +#define KpcrPageTableIndex (KPCR_BASE >> 20) / sizeof(HARDWARE_PTE_X86) +#define ApicPageTableIndex (APIC_BASE >> 20) / sizeof(HARDWARE_PTE_X86) + +#define LowMemPageTableIndexPae 0 +#define StartupPageTableIndexPae (STARTUP_BASE >> 21) +#define HyperspacePageTableIndexPae (HYPERSPACE_BASE >> 21) +#define KpcrPageTableIndexPae (KPCR_BASE >> 21) +#define ApicPageTableIndexPae (APIC_BASE >> 21) + + +#define KernelEntryPoint (KernelEntry - KERNEL_BASE_PHYS) + KernelBase + +/* Unrelocated Kernel Base in Virtual Memory */ +extern ULONG_PTR KernelBase; + +/* Kernel Entrypoint in Physical Memory */ +extern ULONG_PTR KernelEntry; + +/* Page Directory and Tables for non-PAE Systems */ +extern ULONG_PTR startup_pagedirectory; +extern ULONG_PTR lowmem_pagetable; +extern ULONG_PTR kernel_pagetable; +extern ULONG_PTR hyperspace_pagetable; +extern ULONG_PTR _pae_pagedirtable; +extern ULONG_PTR apic_pagetable; +extern ULONG_PTR kpcr_pagetable; + +/* Page Directory and Tables for PAE Systems */ +extern ULONG_PTR startup_pagedirectorytable_pae; +extern ULONG_PTR startup_pagedirectory_pae; +extern ULONG_PTR lowmem_pagetable_pae; +extern ULONG_PTR kernel_pagetable_pae; +extern ULONG_PTR hyperspace_pagetable_pae; +extern ULONG_PTR pagedirtable_pae; +extern ULONG_PTR apic_pagetable_pae; +extern ULONG_PTR kpcr_pagetable_pae; + +typedef struct _HARDWARE_PTE_X86 { + ULONG Valid : 1; + ULONG Write : 1; + ULONG Owner : 1; + ULONG WriteThrough : 1; + ULONG CacheDisable : 1; + ULONG Accessed : 1; + ULONG Dirty : 1; + ULONG LargePage : 1; + ULONG Global : 1; + ULONG CopyOnWrite : 1; + ULONG Prototype : 1; + ULONG reserved : 1; + ULONG PageFrameNumber : 20; +} HARDWARE_PTE_X86, *PHARDWARE_PTE_X86; + +typedef struct _HARDWARE_PTE_X64 { + ULONG Valid : 1; + ULONG Write : 1; + ULONG Owner : 1; + ULONG WriteThrough : 1; + ULONG CacheDisable : 1; + ULONG Accessed : 1; + ULONG Dirty : 1; + ULONG LargePage : 1; + ULONG Global : 1; + ULONG CopyOnWrite : 1; + ULONG Prototype : 1; + ULONG reserved : 1; + ULONG PageFrameNumber : 20; + ULONG reserved2 : 31; + ULONG NoExecute : 1; +} HARDWARE_PTE_X64, *PHARDWARE_PTE_X64; + +typedef struct _PAGE_DIRECTORY_X86 { + HARDWARE_PTE_X86 Pde[1024]; +} PAGE_DIRECTORY_x86, *PPAGE_DIRECTORY_X86; + +typedef struct _PAGE_DIRECTORY_X64 { + HARDWARE_PTE_X64 Pde[2048]; +} PAGE_DIRECTORY_X64, *PPAGE_DIRECTORY_X64; + +typedef struct _PAGE_DIRECTORY_TABLE_X64 { + HARDWARE_PTE_X64 Pde[4]; +} PAGE_DIRECTORY_TABLE_X64, *PPAGE_DIRECTORY_TABLE_X64; + +/* FUNCTIONS *****************************************************************/ + +/*++ + * i386BootStartup + * INTERNAL + * + * Prepares the system for loading the Kernel. + * + * Params: + * Magic - Multiboot Magic + * + * Returns: + * None. + * + * Remarks: + * None. + * + *--*/ +VOID +STDCALL +i386BootStartup(ULONG Magic) +{ + BOOLEAN PaeModeEnabled; + + /* Disable Interrupts */ + Ke386DisableInterrupts(); + + /* Re-initalize EFLAGS */ + Ke386EraseFlags(); + + /* Get the PAE Mode */ + PaeModeEnabled = i386BootGetPaeMode(); + + /* Initialize the page directory */ + i386BootSetupPageDirectory(PaeModeEnabled); + + /* Initialize Paging, Write-Protection and Load NTOSKRNL */ + i386BootSetupPae(PaeModeEnabled, Magic); +} + +/*++ + * i386BootSetupPae + * INTERNAL + * + * Configures PAE on a MP System, and sets the PDBR if it's supported, or if + * the system is UP. + * + * Params: + * PaeModeEnabled - TRUE if booting in PAE mode + * Magic - Multiboot Magic + * + * Returns: + * None. + * + * Remarks: + * None. + * + *--*/ +VOID +FASTCALL +i386BootSetupPae(BOOLEAN PaeModeEnabled, ULONG Magic) +{ + ULONG_PTR PageDirectoryBaseAddress = (ULONG_PTR)&startup_pagedirectory; + ASMCODE PagedJump; + + if (PaeModeEnabled) + { + PageDirectoryBaseAddress = (ULONG_PTR)&startup_pagedirectorytable_pae; + + /* Enable PAE */ + Ke386SetCr4(Ke386GetCr4() | X86_CR4_PAE); + } + + /* Set the PDBR */ + Ke386SetPageTableDirectory(PageDirectoryBaseAddress); + + /* Enable Paging and Write Protect*/ + Ke386SetCr0(Ke386GetCr0() | X86_CR0_PG | X86_CR0_WP); + + /* Jump to Kernel */ + PagedJump = (ASMCODE)KernelEntryPoint; + PagedJump(Magic, &LoaderBlock); +} + +/*++ + * i386BootGetPaeMode + * INTERNAL + * + * Determines whether PAE mode should be enabled or not. + * + * Params: + * None. + * + * Returns: + * PAE mode + * + * Remarks: + * None. + * + *--*/ +BOOLEAN +FASTCALL +i386BootGetPaeMode(VOID) +{ + BOOLEAN PaeModeEnabled; + + /* FIXME: Read command line */ + PaeModeEnabled = FALSE; + + if (PaeModeEnabled) + { + } + + return PaeModeEnabled; +} + +/*++ + * i386BootSetupPageDirectory + * INTERNAL + * + * Sets up the ReactOS Startup Page Directory. + * + * Params: + * None. + * + * Returns: + * None. + * + * Remarks: + * We are setting PDEs, but using the equvivalent (for our purpose) PTE structure. + * As such, please note that PageFrameNumber == PageEntryNumber. + * + *--*/ +VOID +FASTCALL +i386BootSetupPageDirectory(BOOLEAN PaeModeEnabled) +{ + PPAGE_DIRECTORY_X86 PageDir; + PPAGE_DIRECTORY_TABLE_X64 PageDirTablePae; + PPAGE_DIRECTORY_X64 PageDirPae; + ULONG KernelPageTableIndex; + ULONG i; + + if (PaeModeEnabled) { + + /* Get the Kernel Table Index */ + KernelPageTableIndex = (KernelBase >> 21); + + /* Get the Startup Page Directory Table */ + PageDirTablePae = (PPAGE_DIRECTORY_TABLE_X64)&startup_pagedirectorytable_pae; + + /* Get the Startup Page Directory */ + PageDirPae = (PPAGE_DIRECTORY_X64)&startup_pagedirectory_pae; + + /* Set the Startup page directory table */ + for (i = 0; i < 4; i++) + { + PageDirTablePae->Pde[i].Valid = 1; + PageDirTablePae->Pde[i].PageFrameNumber = PaPtrToPfn(startup_pagedirectory_pae) + i; + } + + /* Set up the Low Memory PDE */ + for (i = 0; i < 2; i++) + { + PageDirPae->Pde[LowMemPageTableIndexPae + i].Valid = 1; + PageDirPae->Pde[LowMemPageTableIndexPae + i].Write = 1; + PageDirPae->Pde[LowMemPageTableIndexPae + i].PageFrameNumber = PaPtrToPfn(lowmem_pagetable_pae) + i; + } + + /* Set up the Kernel PDEs */ + for (i = 0; i < 3; i++) + { + PageDirPae->Pde[KernelPageTableIndex + i].Valid = 1; + PageDirPae->Pde[KernelPageTableIndex + i].Write = 1; + PageDirPae->Pde[KernelPageTableIndex + i].PageFrameNumber = PaPtrToPfn(kernel_pagetable_pae) + i; + } + + /* Set up the Startup PDE */ + for (i = 0; i < 4; i++) + { + PageDirPae->Pde[StartupPageTableIndexPae + i].Valid = 1; + PageDirPae->Pde[StartupPageTableIndexPae + i].Write = 1; + PageDirPae->Pde[StartupPageTableIndexPae + i].PageFrameNumber = PaPtrToPfn(startup_pagedirectory_pae) + i; + } + + /* Set up the Hyperspace PDE */ + for (i = 0; i < 2; i++) + { + PageDirPae->Pde[HyperspacePageTableIndexPae + i].Valid = 1; + PageDirPae->Pde[HyperspacePageTableIndexPae + i].Write = 1; + PageDirPae->Pde[HyperspacePageTableIndexPae + i].PageFrameNumber = PaPtrToPfn(hyperspace_pagetable_pae) + i; + } + + /* Set up the Apic PDE */ + for (i = 0; i < 2; i++) + { + PageDirPae->Pde[ApicPageTableIndexPae + i].Valid = 1; + PageDirPae->Pde[ApicPageTableIndexPae + i].Write = 1; + PageDirPae->Pde[ApicPageTableIndexPae + i].PageFrameNumber = PaPtrToPfn(apic_pagetable_pae) + i; + } + + /* Set up the KPCR PDE */ + PageDirPae->Pde[KpcrPageTableIndexPae].Valid = 1; + PageDirPae->Pde[KpcrPageTableIndexPae].Write = 1; + PageDirPae->Pde[KpcrPageTableIndexPae].PageFrameNumber = PaPtrToPfn(kpcr_pagetable_pae); + + /* Set up Low Memory PTEs */ + PageDirPae = (PPAGE_DIRECTORY_X64)&lowmem_pagetable_pae; + for (i=0; i<1024; i++) { + + PageDirPae->Pde[i].Valid = 1; + PageDirPae->Pde[i].Write = 1; + PageDirPae->Pde[i].Owner = 1; + PageDirPae->Pde[i].PageFrameNumber = i; + } + + /* Set up Kernel PTEs */ + PageDirPae = (PPAGE_DIRECTORY_X64)&kernel_pagetable_pae; + for (i=0; i<1536; i++) { + + PageDirPae->Pde[i].Valid = 1; + PageDirPae->Pde[i].Write = 1; + PageDirPae->Pde[i].PageFrameNumber = PaToPfn(KERNEL_BASE_PHYS) + i; + } + + /* Set up APIC PTEs */ + PageDirPae = (PPAGE_DIRECTORY_X64)&apic_pagetable_pae; + PageDirPae->Pde[0].Valid = 1; + PageDirPae->Pde[0].Write = 1; + PageDirPae->Pde[0].CacheDisable = 1; + PageDirPae->Pde[0].WriteThrough = 1; + PageDirPae->Pde[0].PageFrameNumber = PaToPfn(APIC_BASE); + PageDirPae->Pde[0x200].Valid = 1; + PageDirPae->Pde[0x200].Write = 1; + PageDirPae->Pde[0x200].CacheDisable = 1; + PageDirPae->Pde[0x200].WriteThrough = 1; + PageDirPae->Pde[0x200].PageFrameNumber = PaToPfn(APIC_BASE + KERNEL_BASE_PHYS); + + /* Set up KPCR PTEs */ + PageDirPae = (PPAGE_DIRECTORY_X64)&kpcr_pagetable_pae; + PageDirPae->Pde[0].Valid = 1; + PageDirPae->Pde[0].Write = 1; + PageDirPae->Pde[0].PageFrameNumber = 1; + + } else { + + /* Get the Kernel Table Index */ + KernelPageTableIndex = (KernelBase >> PDE_SHIFT) / sizeof(HARDWARE_PTE_X86); + + /* Get the Startup Page Directory */ + PageDir = (PPAGE_DIRECTORY_X86)&startup_pagedirectory; + + /* Set up the Low Memory PDE */ + PageDir->Pde[LowMemPageTableIndex].Valid = 1; + PageDir->Pde[LowMemPageTableIndex].Write = 1; + PageDir->Pde[LowMemPageTableIndex].PageFrameNumber = PaPtrToPfn(lowmem_pagetable); + + /* Set up the Kernel PDEs */ + PageDir->Pde[KernelPageTableIndex].Valid = 1; + PageDir->Pde[KernelPageTableIndex].Write = 1; + PageDir->Pde[KernelPageTableIndex].PageFrameNumber = PaPtrToPfn(kernel_pagetable); + PageDir->Pde[KernelPageTableIndex + 1].Valid = 1; + PageDir->Pde[KernelPageTableIndex + 1].Write = 1; + PageDir->Pde[KernelPageTableIndex + 1].PageFrameNumber = PaPtrToPfn(kernel_pagetable + 4096); + + /* Set up the Startup PDE */ + PageDir->Pde[StartupPageTableIndex].Valid = 1; + PageDir->Pde[StartupPageTableIndex].Write = 1; + PageDir->Pde[StartupPageTableIndex].PageFrameNumber = PaPtrToPfn(startup_pagedirectory); + + /* Set up the Hyperspace PDE */ + PageDir->Pde[HyperspacePageTableIndex].Valid = 1; + PageDir->Pde[HyperspacePageTableIndex].Write = 1; + PageDir->Pde[HyperspacePageTableIndex].PageFrameNumber = PaPtrToPfn(hyperspace_pagetable); + + /* Set up the Apic PDE */ + PageDir->Pde[ApicPageTableIndex].Valid = 1; + PageDir->Pde[ApicPageTableIndex].Write = 1; + PageDir->Pde[ApicPageTableIndex].PageFrameNumber = PaPtrToPfn(apic_pagetable); + + /* Set up the KPCR PDE */ + PageDir->Pde[KpcrPageTableIndex].Valid = 1; + PageDir->Pde[KpcrPageTableIndex].Write = 1; + PageDir->Pde[KpcrPageTableIndex].PageFrameNumber = PaPtrToPfn(kpcr_pagetable); + + /* Set up Low Memory PTEs */ + PageDir = (PPAGE_DIRECTORY_X86)&lowmem_pagetable; + for (i=0; i<1024; i++) { + + PageDir->Pde[i].Valid = 1; + PageDir->Pde[i].Write = 1; + PageDir->Pde[i].Owner = 1; + PageDir->Pde[i].PageFrameNumber = PaToPfn(i * PAGE_SIZE); + } + + /* Set up Kernel PTEs */ + PageDir = (PPAGE_DIRECTORY_X86)&kernel_pagetable; + for (i=0; i<1536; i++) { + + PageDir->Pde[i].Valid = 1; + PageDir->Pde[i].Write = 1; + PageDir->Pde[i].PageFrameNumber = PaToPfn(KERNEL_BASE_PHYS + i * PAGE_SIZE); + } + + /* Set up APIC PTEs */ + PageDir = (PPAGE_DIRECTORY_X86)&apic_pagetable; + PageDir->Pde[0].Valid = 1; + PageDir->Pde[0].Write = 1; + PageDir->Pde[0].CacheDisable = 1; + PageDir->Pde[0].WriteThrough = 1; + PageDir->Pde[0].PageFrameNumber = PaToPfn(APIC_BASE); + PageDir->Pde[0x200].Valid = 1; + PageDir->Pde[0x200].Write = 1; + PageDir->Pde[0x200].CacheDisable = 1; + PageDir->Pde[0x200].WriteThrough = 1; + PageDir->Pde[0x200].PageFrameNumber = PaToPfn(APIC_BASE + KERNEL_BASE_PHYS); + + /* Set up KPCR PTEs */ + PageDir = (PPAGE_DIRECTORY_X86)&kpcr_pagetable; + PageDir->Pde[0].Valid = 1; + PageDir->Pde[0].Write = 1; + PageDir->Pde[0].PageFrameNumber = 1; + } + return; +} _____
Copied: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/i386boot.h (from rev 15334, branches/xen/reactos/boot/freeldr/freeldr/include/multiboot.h) --- branches/xen/reactos/boot/freeldr/freeldr/include/multiboot.h 2005-05-16 11:06:57 UTC (rev 15334) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/i386boot.h 2005-05-17 22:15:18 UTC (rev 15391) @@ -0,0 +1,20 @@
+#ifndef I386BOOT_H_INCLUDED +#define I386BOOT_H_INCLUDED + +VOID +STDCALL +i386BootStartup(ULONG Magic); + +VOID +FASTCALL +i386BootSetupPae(BOOLEAN PaeModeEnabled, ULONG Magic); + +BOOLEAN +FASTCALL +i386BootGetPaeMode(VOID); + +VOID +FASTCALL +i386BootSetupPageDirectory(BOOLEAN PaeModeEnabled); + +#endif /* ! defined I386BOOT_H_INCLUDED */ _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machpc.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machpc.c 2005-05-17 21:18:04 UTC (rev 15390) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machpc.c 2005-05-17 22:15:18 UTC (rev 15391) @@ -46,7 +46,6 @@
MachVtbl.VideoSetPaletteColor = PcVideoSetPaletteColor; MachVtbl.VideoGetPaletteColor = PcVideoGetPaletteColor; MachVtbl.VideoSync = PcVideoSync; - MachVtbl.VideoPrepareForReactOS = PcVideoPrepareForReactOS; MachVtbl.GetMemoryMap = PcMemGetMemoryMap; MachVtbl.DiskGetBootVolume = i386DiskGetBootVolume; MachVtbl.DiskGetSystemVolume = i386DiskGetSystemVolume; @@ -59,6 +58,7 @@ MachVtbl.DiskGetCacheableBlockCount = PcDiskGetCacheableBlockCount; MachVtbl.RTCGetCurrentDateTime = PcRTCGetCurrentDateTime; MachVtbl.HwDetect = PcHwDetect; + MachVtbl.BootReactOS = PcBootReactOS; MachVtbl.Die = PcDie; }
_____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machpc.h --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machpc.h 2005-05-17 21:18:04 UTC (rev 15390) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machpc.h 2005-05-17 22:15:18 UTC (rev 15391) @@ -55,6 +55,8 @@
VOID PcRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG Minute, PULONG Second);
+VOID PcBootReactOS(VOID); + VOID PcHwDetect(VOID);
VOID PcDie(VOID); _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c 2005-05-17 21:18:04 UTC (rev 15390) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c 2005-05-17 22:15:18 UTC (rev 15391) @@ -44,7 +44,6 @@
MachVtbl.VideoSetPaletteColor = XboxVideoSetPaletteColor; MachVtbl.VideoGetPaletteColor = XboxVideoGetPaletteColor; MachVtbl.VideoSync = XboxVideoSync; - MachVtbl.VideoPrepareForReactOS = XboxVideoPrepareForReactOS; MachVtbl.GetMemoryMap = XboxMemGetMemoryMap; MachVtbl.DiskGetBootVolume = i386DiskGetBootVolume; MachVtbl.DiskGetSystemVolume = i386DiskGetSystemVolume; @@ -57,6 +56,7 @@ MachVtbl.DiskGetCacheableBlockCount = XboxDiskGetCacheableBlockCount; MachVtbl.RTCGetCurrentDateTime = XboxRTCGetCurrentDateTime; MachVtbl.HwDetect = XboxHwDetect; + MachVtbl.BootReactOS = XboxBootReactOS; MachVtbl.Die = XboxDie; }
_____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxbox.h --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxbox.h 2005-05-17 21:18:04 UTC (rev 15390) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxbox.h 2005-05-17 22:15:18 UTC (rev 15391) @@ -1,5 +1,4 @@
-/* $Id$ - * +/* * FreeLoader * * This program is free software; you can redistribute it and/or modify @@ -60,6 +59,8 @@
VOID XboxHwDetect(VOID);
+VOID XboxBootReactOS(VOID); + VOID XboxDie(VOID);
#endif /* __I386_HWXBOX_H_ */ _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c 2005-05-17 21:18:04 UTC (rev 15390) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c 2005-05-17 22:15:18 UTC (rev 15391) @@ -109,7 +109,6 @@
MachVtbl.VideoSetPaletteColor = XenVideoSetPaletteColor; MachVtbl.VideoGetPaletteColor = XenVideoGetPaletteColor; MachVtbl.VideoSync = XenVideoSync; - MachVtbl.VideoPrepareForReactOS = XenVideoPrepareForReactOS; MachVtbl.GetMemoryMap = XenMemGetMemoryMap; MachVtbl.DiskGetBootVolume = i386DiskGetBootVolume; MachVtbl.DiskGetSystemVolume = i386DiskGetSystemVolume; @@ -122,6 +121,7 @@ MachVtbl.DiskGetCacheableBlockCount = XenDiskGetCacheableBlockCount; MachVtbl.RTCGetCurrentDateTime = XenRTCGetCurrentDateTime; MachVtbl.HwDetect = XenHwDetect; + MachVtbl.BootReactOS = XenBootReactOS; MachVtbl.Die = XenDie;
XenCtrlIfInit(); @@ -193,47 +193,6 @@ XenDie(); }
-#define XEN_UNIMPLEMENTED(routine) \ - printf(routine " unimplemented. Shutting down\n"); \ - XenDie() - -VOID -XenVideoSetTextCursorPosition(ULONG X, ULONG Y) - { - XEN_UNIMPLEMENTED("XenVideoSetTextCursorPosition"); - } - -BOOL -XenVideoIsPaletteFixed(VOID) - { - XEN_UNIMPLEMENTED("XenVideoIsPaletteFixed"); - return TRUE; - } - -VOID -XenVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue) - { - XEN_UNIMPLEMENTED("XenVideoSetPaletteColor"); - } - -VOID -XenVideoGetPaletteColor(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue) - { - XEN_UNIMPLEMENTED("XenVideoGetPaletteColor"); - } - -VOID -XenVideoSync(VOID) - { - XEN_UNIMPLEMENTED("XenVideoSync"); - } - -VOID -XenVideoPrepareForReactOS(VOID) - { - XEN_UNIMPLEMENTED("XenVideoPrepareForReactOS"); - } - /* emit the elf segment Xen builder expects in kernel image */ asm(".section __xen_guest;" ".ascii "GUEST_OS=linux,GUEST_VER=2.6";" _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h 2005-05-17 21:18:04 UTC (rev 15390) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h 2005-05-17 22:15:18 UTC (rev 15391) @@ -69,7 +69,6 @@
VOID XenVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue); VOID XenVideoGetPaletteColor(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue); VOID XenVideoSync(VOID); -VOID XenVideoPrepareForReactOS(VOID);
ULONG XenMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize); VOID XenMemInit(start_info_t *StartInfo); @@ -86,7 +85,10 @@
VOID XenHwDetect(VOID);
+VOID XenBootReactOS(VOID); + VOID XenDie(VOID); + VOID XenHypervisorCallback(VOID); VOID XenFailsafeCallback(VOID);
_____
Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/pcboot.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/pcboot.c 2005-05-17 21:18:04 UTC (rev 15390) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/pcboot.c 2005-05-17 22:15:18 UTC (rev 15391) @@ -0,0 +1,33 @@
+/* + * FreeLoader + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "freeldr.h" +#include "arch.h" +#include "i386boot.h" +#include "machine.h" +#include "machpc.h" + +VOID +PcBootReactOS(VOID) + { + DiskStopFloppyMotor(); + PcVideoPrepareForReactOS(); + i386BootStartup(0x2badb002); + } + +/* EOF */ Property changes on: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/pcboot.c ___________________________________________________________________ Name: svn:keywords + author date id revision Name: svn:eol-style + native _____
Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xboxboot.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xboxboot.c 2005-05-17 21:18:04 UTC (rev 15390) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xboxboot.c 2005-05-17 22:15:18 UTC (rev 15391) @@ -0,0 +1,32 @@
+/* + * FreeLoader + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "freeldr.h" +#include "arch.h" +#include "i386boot.h" +#include "machine.h" +#include "machxbox.h" + +VOID +XboxBootReactOS(VOID) + { + XboxVideoPrepareForReactOS(); + i386BootStartup(0x2badb002); + } + +/* EOF */ Property changes on: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xboxboot.c ___________________________________________________________________ Name: svn:keywords + author date id revision Name: svn:eol-style + native _____
Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenboot.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenboot.c 2005-05-17 21:18:04 UTC (rev 15390) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenboot.c 2005-05-17 22:15:18 UTC (rev 15391) @@ -0,0 +1,50 @@
+/* + * FreeLoader + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "freeldr.h" +#include "arch.h" +#include "i386boot.h" +#include "machine.h" +#include "machxen.h" + +VOID +XenBootReactOS(VOID) + { + BOOLEAN PaeModeEnabled; + + XenVideoClearScreen(0x07); + + /* Disable events */ +#ifdef TODO + XenEvtchnDisableEvents(); +#endif + + /* Re-initalize EFLAGS */ + Ke386EraseFlags(); + + /* PAE Mode not supported yet */ + PaeModeEnabled = FALSE; + + /* Initialize the page directory */ + i386BootSetupPageDirectory(PaeModeEnabled); + + /* Initialize Paging, Write-Protection and Load NTOSKRNL */ + i386BootSetupPae(PaeModeEnabled, 0x2badb002); + } + +/* EOF */ Property changes on: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenboot.c ___________________________________________________________________ Name: svn:keywords + author date id revision Name: svn:eol-style + native _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenvideo.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenvideo.c 2005-05-17 21:18:04 UTC (rev 15390) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenvideo.c 2005-05-17 22:15:18 UTC (rev 15391) @@ -187,5 +187,34 @@
AnsiMoveToPos(COLS, ROWS); XenConsFlush(); } +VOID +XenVideoSetTextCursorPosition(ULONG X, ULONG Y) + { + AnsiMoveToPos(X, Y); + }
+BOOL +XenVideoIsPaletteFixed(VOID) + { + return TRUE; + } + +VOID +XenVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue) + { + /* Should never be called */ + } + +VOID +XenVideoGetPaletteColor(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue) + { + /* Should never be called */ + } + +VOID +XenVideoSync(VOID) + { + /* Nothing to do */ + } + /* EOF */ _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/include/machine.h --- branches/xen/reactos/boot/freeldr/freeldr/include/machine.h 2005-05-17 21:18:04 UTC (rev 15390) +++ branches/xen/reactos/boot/freeldr/freeldr/include/machine.h 2005-05-17 22:15:18 UTC (rev 15391) @@ -52,7 +52,6 @@
VOID (*VideoSetPaletteColor)(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue); VOID (*VideoGetPaletteColor)(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue); VOID (*VideoSync)(VOID); - VOID (*VideoPrepareForReactOS)(VOID);
ULONG (*GetMemoryMap)(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize);
@@ -70,6 +69,8 @@
VOID (*HwDetect)(VOID);
+ VOID (*BootReactOS)(VOID); + VOID (*Die)(VOID); } MACHVTBL, *PMACHVTBL;
@@ -92,7 +93,6 @@ #define MachVideoSetPaletteColor(Col, R, G, B) MachVtbl.VideoSetPaletteColor((Col), (R), (G), (B)) #define MachVideoGetPaletteColor(Col, R, G, B) MachVtbl.VideoGetPaletteColor((Col), (R), (G), (B)) #define MachVideoSync() MachVtbl.VideoSync() -#define MachVideoPrepareForReactOS() MachVtbl.VideoPrepareForReactOS() #define MachGetMemoryMap(MMap, Size) MachVtbl.GetMemoryMap((MMap), (Size)) #define MachDiskGetBootVolume(Drv, Start, Cnt, FsType) MachVtbl.DiskGetBootVolume((Drv), (Start), (Cnt), (FsType)) #define MachDiskGetSystemVolume(SysPath, RemPath, Dev, Drv, Start, Cnt, FsType) MachVtbl.DiskGetSystemVolume((SysPath), (RemPath), (Dev), (Drv), (Start), (Cnt), (FsType)) @@ -105,6 +105,7 @@ #define MachDiskGetCacheableBlockCount(Drive) MachVtbl.DiskGetCacheableBlockCount(Drive) #define MachRTCGetCurrentDateTime(Y, Mo, D, H, Mi, S) MachVtbl.RTCGetCurrentDateTime((Y), (Mo), (D), (H), (Mi), (S)); #define MachHwDetect() MachVtbl.HwDetect() +#define MachBootReactOS() MachVtbl.BootReactOS() #define MachDie() MachVtbl.Die()
#endif /* __MACHINE_H_ */ _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/include/multiboot.h --- branches/xen/reactos/boot/freeldr/freeldr/include/multiboot.h 2005-05-17 21:18:04 UTC (rev 15390) +++ branches/xen/reactos/boot/freeldr/freeldr/include/multiboot.h 2005-05-17 22:15:18 UTC (rev 15391) @@ -133,6 +133,9 @@
} memory_map_t;
+/* Base Addres of Kernel in Physical Memory */ +#define KERNEL_BASE_PHYS 0x200000 + LOADER_PARAMETER_BLOCK LoaderBlock; /* Multiboot info structure passed to kernel */ char multiboot_kernel_cmdline[255]; // Command line passed to kernel FRLDR_MODULE multiboot_modules[64]; // Array to hold boot module info loaded for the kernel @@ -190,36 +193,16 @@ ULONG dwModuleSize);
VOID -STDCALL -FrLdrStartup(ULONG Magic); - -VOID FASTCALL FrLdrGetKernelBase(VOID);
VOID -FASTCALL -FrLdrSetupPae(ULONG Magic); - -VOID -FASTCALL -FrLdrGetPaeMode(VOID); - -VOID -FASTCALL -FrLdrSetupPageDirectory(VOID); - -VOID LoadAndBootReactOS(PCHAR OperatingSystemName);
VOID FASTCALL AsmCode(VOID); typedef VOID (FASTCALL *ASMCODE)(ULONG Magic, PLOADER_PARAMETER_BLOCK LoaderBlock);
-int GetBootPartition(char *OperatingSystemName); - - - #endif /* ! ASM */
_____
Modified: branches/xen/reactos/boot/freeldr/freeldr/machine.c --- branches/xen/reactos/boot/freeldr/freeldr/machine.c 2005-05-17 21:18:04 UTC (rev 15390) +++ branches/xen/reactos/boot/freeldr/freeldr/machine.c 2005-05-17 22:15:18 UTC (rev 15391) @@ -35,7 +35,6 @@
#undef MachVideoSetPaletteColor #undef MachVideoGetPaletteColor #undef MachVideoSync -#undef MachVideoPrepareForReactOS #undef MachGetMemoryMap #undef MachDiskGetBootVolume #undef MachDiskGetSystemVolume @@ -47,6 +46,7 @@ #undef MachDiskGetDriveGeometry #undef MachDiskGetCacheableBlockCount #undef MachRTCGetCurrentDateTime +#undef MachBootReactOS #undef MachHwDetect #undef MachDie
@@ -142,12 +142,6 @@ MachVtbl.VideoSync(); }
-VOID -MachVideoPrepareForReactOS(VOID) -{ - MachVtbl.VideoPrepareForReactOS(); -} - ULONG [truncated at 1000 lines; 510 more skipped]