From 17d1b0cdea1636bd35256b13301629fa9a3a483d Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 28 Sep 2011 09:54:05 +0000 Subject: [PATCH] [FREELDR] Cleanup headers svn path=/trunk/; revision=53881 --- .../boot/freeldr/freeldr/arch/i386/i386rtl.c | 3 + .../boot/freeldr/freeldr/arch/i386/winldr.c | 6 +- .../boot/freeldr/freeldr/arch/powerpc/mboot.c | 18 ++-- .../freeldr/freeldr/include/arch/i386/i386.h | 26 +++++ .../boot/freeldr/freeldr/include/freeldr.h | 4 +- .../boot/freeldr/freeldr/include/reactos.h | 98 +------------------ reactos/boot/freeldr/freeldr/include/rtl.h | 29 ------ 7 files changed, 43 insertions(+), 141 deletions(-) delete mode 100644 reactos/boot/freeldr/freeldr/include/rtl.h diff --git a/reactos/boot/freeldr/freeldr/arch/i386/i386rtl.c b/reactos/boot/freeldr/freeldr/arch/i386/i386rtl.c index de19c5fb73c..a5f01b6c833 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/i386rtl.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/i386rtl.c @@ -19,6 +19,9 @@ #include +void sound(int freq); +void delay(unsigned msec); + void PcBeep(void) { sound(700); diff --git a/reactos/boot/freeldr/freeldr/arch/i386/winldr.c b/reactos/boot/freeldr/freeldr/arch/i386/winldr.c index 4d05a2f84f1..cb94d0b4ead 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/winldr.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/winldr.c @@ -338,16 +338,14 @@ void WinLdrSetupSpecialDataPointers() { *ExtendedBIOSDataArea = BiosRegs.w.es << 4; *ExtendedBIOSDataSize = 1024; - ERR(">> *ExtendedBIOSDataArea = 0x%lx\n", *ExtendedBIOSDataArea); + TRACE("*ExtendedBIOSDataArea = 0x%lx\n", *ExtendedBIOSDataArea); } else { - ERR("Couldn't get address of extended BIOS data area\n"); + WARN("Couldn't get address of extended BIOS data area\n"); *ExtendedBIOSDataArea = 0; *ExtendedBIOSDataSize = 0; } - - /* Store size of the extended bios data area in 0x740 */ } void WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock) diff --git a/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c b/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c index 13cc7f91a97..6f86e3652f0 100644 --- a/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c +++ b/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c @@ -56,6 +56,8 @@ PVOID KernelMemory = 0; #define KernelMemorySize (8 * 1024 * 1024) #define XROUNDUP(x,n) ((((ULONG)x) + ((n) - 1)) & (~((n) - 1))) +char reactos_module_strings[64][256]; // Array to hold module names + /* Load Address of Next Module */ ULONG_PTR NextModuleBase = 0; @@ -178,7 +180,7 @@ FrLdrAddPageMapping(ppc_map_set_t *set, int proc, paddr_t phys, vaddr_t virt) set->info = newinfo; set->mapsize *= 2; } - + set->info[set->usecount].flags = MMU_ALL_RW; set->info[set->usecount].proc = proc; set->info[set->usecount].addr = virt; @@ -208,7 +210,7 @@ FrLdrStartup(ULONG Magic) while(OldModCount != LoaderBlock.ModsCount) { - printf("Added %d modules last pass\n", + printf("Added %d modules last pass\n", LoaderBlock.ModsCount - OldModCount); OldModCount = LoaderBlock.ModsCount; @@ -224,7 +226,7 @@ FrLdrStartup(ULONG Magic) ((PVOID)reactos_modules[i].ModStart, (PCHAR)reactos_modules[i].String); } - } + } } printf("Starting mmu\n"); @@ -233,7 +235,7 @@ FrLdrStartup(ULONG Magic) printf("Allocating vsid 0 (kernel)\n"); MmuAllocVsid(0, 0xff00); - + /* We'll use vsid 1 for freeldr (expendable) */ printf("Allocating vsid 1 (freeldr)\n"); MmuAllocVsid(1, 0xff); @@ -247,7 +249,7 @@ FrLdrStartup(ULONG Magic) i += (1<= (ULONG)KernelMemory && + if (tmp >= (ULONG)KernelMemory && tmp < (ULONG)KernelMemory + KernelMemorySize) { FrLdrAddPageMapping(&memmap, 0, tmp, KernelBase + tmp - (ULONG)KernelMemory); } else { @@ -721,7 +723,7 @@ FrLdrLoadModule(FILE *ModuleImage, } while(TempName); NameBuffer = reactos_module_strings[LoaderBlock.ModsCount]; - + /* Get Module Size */ LocalModuleSize = FsGetFileSize(ModuleImage); @@ -773,7 +775,7 @@ FrLdrMapImage(IN FILE *Image, IN PCHAR ShortName, IN ULONG ImageType) PVOID ModuleBase = (PVOID)NextModuleBase; if(FrLdrMapModule(Image, ShortName, 0, 0)) - Result = ModuleBase; + Result = ModuleBase; } return Result; } diff --git a/reactos/boot/freeldr/freeldr/include/arch/i386/i386.h b/reactos/boot/freeldr/freeldr/include/arch/i386/i386.h index 19a90a4e736..30378563fb0 100644 --- a/reactos/boot/freeldr/freeldr/include/arch/i386/i386.h +++ b/reactos/boot/freeldr/freeldr/include/arch/i386/i386.h @@ -24,6 +24,32 @@ #undef KIP0PCRADDRESS #define KIP0PCRADDRESS 0xffdff000 +/* 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 22 +#define PDE_SHIFT_PAE 18 + +/* Converts a Physical Address Pointer into a Page Frame Number */ +#define PaPtrToPfn(p) \ + (((ULONG_PTR)&p) >> PFN_SHIFT) + +/* Converts a Physical Address into a Page Frame Number */ +#define PaToPfn(p) \ + ((p) >> PFN_SHIFT) + +#define STARTUP_BASE 0xC0000000 + +#define LowMemPageTableIndex 0 +#define StartupPageTableIndex (STARTUP_BASE >> 22) +#define HalPageTableIndex (HAL_BASE >> 22) + +typedef struct _PAGE_DIRECTORY_X86 +{ + HARDWARE_PTE Pde[1024]; +} PAGE_DIRECTORY_X86, *PPAGE_DIRECTORY_X86; + void i386DivideByZero(void); void i386DebugException(void); void i386NMIException(void); diff --git a/reactos/boot/freeldr/freeldr/include/freeldr.h b/reactos/boot/freeldr/freeldr/include/freeldr.h index 58bfca676ef..961fd29faa7 100644 --- a/reactos/boot/freeldr/freeldr/include/freeldr.h +++ b/reactos/boot/freeldr/freeldr/include/freeldr.h @@ -45,8 +45,6 @@ #include #include #include -#include -#include #include #include #include @@ -55,8 +53,8 @@ /* internal headers */ #include -#include #include +#include #include #include #include diff --git a/reactos/boot/freeldr/freeldr/include/reactos.h b/reactos/boot/freeldr/freeldr/include/reactos.h index 30657f7afbc..8b8d8c02e50 100644 --- a/reactos/boot/freeldr/freeldr/include/reactos.h +++ b/reactos/boot/freeldr/freeldr/include/reactos.h @@ -19,53 +19,6 @@ #pragma once -/* Base Addres of Kernel in Physical Memory */ -#define KERNEL_BASE_PHYS 0x800000 - -#if defined(_M_IX86) - -/* 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 22 -#define PDE_SHIFT_PAE 18 - -/* Converts a Physical Address Pointer into a Page Frame Number */ -#define PaPtrToPfn(p) \ - (((ULONG_PTR)&p) >> PFN_SHIFT) - -/* Converts a Physical Address into a Page Frame Number */ -#define PaToPfn(p) \ - ((p) >> PFN_SHIFT) - -#define STARTUP_BASE 0xC0000000 - -#define LowMemPageTableIndex 0 -#define StartupPageTableIndex (STARTUP_BASE >> 22) -#define HalPageTableIndex (HAL_BASE >> 22) - -typedef struct _PAGE_DIRECTORY_X86 -{ - HARDWARE_PTE Pde[1024]; -} PAGE_DIRECTORY_X86, *PPAGE_DIRECTORY_X86; - -#endif - -/////////////////////////////////////////////////////////////////////////////////////// -// -// ReactOS Loading Functions -// -/////////////////////////////////////////////////////////////////////////////////////// -VOID LoadAndBootReactOS(PCSTR OperatingSystemName); - -/////////////////////////////////////////////////////////////////////////////////////// -// -// ReactOS Setup Loader Functions -// -/////////////////////////////////////////////////////////////////////////////////////// -VOID ReactOSRunSetupLoader(VOID); - /////////////////////////////////////////////////////////////////////////////////////// // // ARC Path Functions @@ -83,53 +36,4 @@ BOOLEAN DissectArcPath(CHAR *ArcPath, CHAR *BootPath, UCHAR* BootDrive, ULONG* B VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, UCHAR Disk, ULONG Partition); UCHAR ConvertArcNameToBiosDriveNumber(PCHAR ArcPath); -/////////////////////////////////////////////////////////////////////////////////////// -// -// Loader Functions And Definitions -// -/////////////////////////////////////////////////////////////////////////////////////// -extern ROS_LOADER_PARAMETER_BLOCK LoaderBlock; /* Multiboot info structure passed to kernel */ -extern char reactos_kernel_cmdline[255]; // Command line passed to kernel -extern LOADER_MODULE reactos_modules[64]; // Array to hold boot module info loaded for the kernel -extern char reactos_module_strings[64][256]; // Array to hold module names -typedef struct _reactos_mem_data { - unsigned long memory_map_descriptor_size; - memory_map_t memory_map[32]; // Memory map -} reactos_mem_data_t; -extern reactos_mem_data_t reactos_mem_data; -#define reactos_memory_map_descriptor_size reactos_mem_data.memory_map_descriptor_size -#define reactos_memory_map reactos_mem_data.memory_map - -VOID FASTCALL FrLdrSetupPae(ULONG Magic); -VOID FASTCALL FrLdrSetupPageDirectory(VOID); -VOID FASTCALL FrLdrGetPaeMode(VOID); -BOOLEAN NTAPI FrLdrMapKernel(PFILE KernelImage); -ULONG_PTR NTAPI FrLdrCreateModule(LPCSTR ModuleName); -ULONG_PTR NTAPI FrLdrLoadModule(PFILE ModuleImage, LPCSTR ModuleName, PULONG ModuleSize); -BOOLEAN NTAPI FrLdrCloseModule(ULONG_PTR ModuleBase, ULONG dwModuleSize); -VOID NTAPI FrLdrStartup(ULONG Magic); -typedef VOID (NTAPI *ROS_KERNEL_ENTRY_POINT)(IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock); - -PVOID -NTAPI -FrLdrMapImage( - IN PFILE Image, - IN PCHAR ShortName, - IN ULONG ImageType -); - -PVOID -NTAPI -FrLdrReadAndMapImage( - IN PFILE Image, - IN PCHAR ShortName, - IN ULONG ImageType -); - -PVOID -NTAPI -FrLdrLoadImage( - IN PCHAR szFileName, - IN INT nPos, - IN ULONG ImageType -); +void PcBeep(void); diff --git a/reactos/boot/freeldr/freeldr/include/rtl.h b/reactos/boot/freeldr/freeldr/include/rtl.h deleted file mode 100644 index d4ef384e9d0..00000000000 --- a/reactos/boot/freeldr/freeldr/include/rtl.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * FreeLoader - * Copyright (C) 1998-2003 Brian Palmer - * - * 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. - */ - -#pragma once - -#include - -char * convert_to_ascii(char *buf, int c, int num); -char * convert_i64_to_ascii(char *buf, int c, unsigned long long num); - -void PcBeep(void); -void delay(unsigned msec); -void sound(int freq);