mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
- Move ReactOS specific code to ReactOS specific files/directories.
- Use NDK instead of redefining the loader structures. svn path=/trunk/; revision=16454
This commit is contained in:
parent
3b440449dd
commit
db15209f07
16 changed files with 154 additions and 230 deletions
|
@ -52,10 +52,10 @@
|
|||
// Boot information structure
|
||||
//
|
||||
|
||||
EXTERN(_multiboot_memory_map_descriptor_size)
|
||||
EXTERN(_reactos_memory_map_descriptor_size)
|
||||
.long 0
|
||||
|
||||
EXTERN(_multiboot_memory_map)
|
||||
EXTERN(_reactos_memory_map)
|
||||
.rept (32 * /*sizeof(memory_map_t)*/24)
|
||||
.byte 0
|
||||
.endr
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
<directory name="reactos">
|
||||
<file>arcname.c</file>
|
||||
<file>binhive.c</file>
|
||||
<file>loader.c</file>
|
||||
<file>reactos.c</file>
|
||||
<file>registry.c</file>
|
||||
</directory>
|
||||
|
@ -102,7 +103,6 @@
|
|||
</directory>
|
||||
<file>freeldr.c</file>
|
||||
<file>debug.c</file>
|
||||
<file>multiboot.c</file>
|
||||
<file>version.c</file>
|
||||
<file>cmdline.c</file>
|
||||
<file>machine.c</file>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeLoader NTFS support
|
||||
* Copyright (C) 2004 Filip Navara <xnavara@volny.cz>
|
||||
* Copyright (C) 2004 Filip Navara <xnavara@volny.cz>
|
||||
*
|
||||
* 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeLoader NTFS support
|
||||
* Copyright (C) 2004 Filip Navara <xnavara@volny.cz>
|
||||
* Copyright (C) 2004 Filip Navara <xnavara@volny.cz>
|
||||
*
|
||||
* 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
|
||||
|
|
|
@ -28,10 +28,6 @@
|
|||
#define RMODE_CS 0x18 /* RMode code selector, base 0 limit 64k */
|
||||
#define RMODE_DS 0x20 /* RMode data selector, base 0 limit 64k */
|
||||
|
||||
#define KERNEL_BASE 0xC0000000
|
||||
#define KERNEL_CS 0x08
|
||||
#define KERNEL_DS 0x10
|
||||
|
||||
#define CR0_PE_SET 0x00000001 /* OR this value with CR0 to enable pmode */
|
||||
#define CR0_PE_CLR 0xFFFFFFFE /* AND this value with CR0 to disable pmode */
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
#define __FREELDR_H
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ndk/ntndk.h>
|
||||
#include <arch.h>
|
||||
#include <reactos.h>
|
||||
#include <rtl.h>
|
||||
#include <disk.h>
|
||||
#include <fs.h>
|
||||
|
@ -33,6 +33,7 @@
|
|||
#include <inifile.h>
|
||||
#include <video.h>
|
||||
#include <portio.h>
|
||||
#include <reactos.h>
|
||||
|
||||
#define ROUND_UP(N, S) (((N) + (S) - 1) & ~((S) - 1))
|
||||
#define ROUND_DOWN(N, S) ((N) & ~((S) - 1))
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
#define MB_INFO_FLAG_BOOT_LOADER_NAME 0x00000200
|
||||
#define MB_INFO_FLAG_APM_TABLE 0x00000400
|
||||
#define MB_INFO_FLAG_GRAPHICS_TABLE 0x00000800
|
||||
#define MB_INFO_FLAG_ACPI_TABLE 0x00001000
|
||||
|
||||
#ifndef ASM
|
||||
/* Do not include here in boot.S. */
|
||||
|
@ -90,35 +89,6 @@ typedef struct elf_section_header_table
|
|||
unsigned long shndx;
|
||||
} elf_section_header_table_t;
|
||||
|
||||
typedef struct _LOADER_PARAMETER_BLOCK
|
||||
{
|
||||
ULONG Flags;
|
||||
ULONG MemLower;
|
||||
ULONG MemHigher;
|
||||
ULONG BootDevice;
|
||||
ULONG CommandLine;
|
||||
ULONG ModsCount;
|
||||
ULONG ModsAddr;
|
||||
UCHAR Syms[12];
|
||||
ULONG MmapLength;
|
||||
ULONG MmapAddr;
|
||||
ULONG DrivesCount;
|
||||
ULONG DrivesAddr;
|
||||
ULONG ConfigTable;
|
||||
ULONG BootLoaderName;
|
||||
ULONG PageDirectoryStart;
|
||||
ULONG PageDirectoryEnd;
|
||||
ULONG KernelBase;
|
||||
} LOADER_PARAMETER_BLOCK, *PLOADER_PARAMETER_BLOCK;
|
||||
|
||||
/* The module structure. */
|
||||
typedef struct _FRLDR_MODULE {
|
||||
ULONG_PTR ModuleStart;
|
||||
ULONG_PTR ModuleEnd;
|
||||
LPSTR ModuleName;
|
||||
ULONG Reserved;
|
||||
} FRLDR_MODULE, *PFRLDR_MODULE;
|
||||
|
||||
/* The memory map. Be careful that the offset 0 is base_addr_low
|
||||
but no size. */
|
||||
typedef struct memory_map
|
||||
|
@ -132,94 +102,6 @@ typedef struct memory_map
|
|||
unsigned long reserved;
|
||||
} memory_map_t;
|
||||
|
||||
|
||||
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
|
||||
char multiboot_module_strings[64][256]; // Array to hold module names
|
||||
unsigned long multiboot_memory_map_descriptor_size;
|
||||
memory_map_t multiboot_memory_map[32]; // Memory map
|
||||
|
||||
|
||||
void boot_reactos(void);
|
||||
|
||||
#include "fs.h" // Included FILE structure definition
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
FrLdrBootReactOs(VOID);
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
FrLdrMapKernel(FILE *KernelImage);
|
||||
|
||||
ULONG_PTR
|
||||
STDCALL
|
||||
FrLdrCreateModule(LPSTR ModuleName);
|
||||
|
||||
ULONG_PTR
|
||||
STDCALL
|
||||
FrLdrLoadModule(FILE *ModuleImage,
|
||||
LPSTR ModuleName,
|
||||
PULONG ModuleSize);
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
FrLdrLoadKernel(PCHAR szFileName,
|
||||
INT nPos);
|
||||
|
||||
BOOL
|
||||
FrLdrLoadNlsFile(PCHAR szSystemRoot,
|
||||
PCHAR szErrorOut);
|
||||
|
||||
BOOL
|
||||
FrLdrLoadDriver(PCHAR szFileName,
|
||||
INT nPos);
|
||||
BOOL
|
||||
LoadSymbolFile(PCHAR szSystemRoot,
|
||||
PCHAR ModuleName,
|
||||
INT nPos);
|
||||
|
||||
VOID
|
||||
FrLdrLoadBootDrivers(PCHAR szSystemRoot,
|
||||
INT nPos);
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
FrLdrCloseModule(ULONG_PTR ModuleBase,
|
||||
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 */
|
||||
|
||||
|
||||
|
|
|
@ -44,5 +44,27 @@ BOOL DissectArcPath(CHAR *ArcPath, CHAR *BootPath, ULONG* BootDrive, ULONG* Boot
|
|||
VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, ULONG Disk, ULONG Partition);
|
||||
ULONG ConvertArcNameToBiosDriveNumber(PCHAR ArcPath);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Loader Functions And Definitions
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern 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
|
||||
extern unsigned long reactos_memory_map_descriptor_size;
|
||||
extern memory_map_t reactos_memory_map[32]; // Memory map
|
||||
|
||||
VOID FASTCALL FrLdrSetupPae(ULONG Magic);
|
||||
VOID FASTCALL FrLdrSetupPageDirectory(VOID);
|
||||
VOID FASTCALL FrLdrGetPaeMode(VOID);
|
||||
BOOL STDCALL FrLdrMapKernel(FILE *KernelImage);
|
||||
ULONG_PTR STDCALL FrLdrCreateModule(LPSTR ModuleName);
|
||||
ULONG_PTR STDCALL FrLdrLoadModule(FILE *ModuleImage, LPSTR ModuleName, PULONG ModuleSize);
|
||||
BOOL STDCALL FrLdrCloseModule(ULONG_PTR ModuleBase, ULONG dwModuleSize);
|
||||
VOID STDCALL FrLdrStartup(ULONG Magic);
|
||||
typedef VOID (FASTCALL *ASMCODE)(ULONG Magic, PLOADER_PARAMETER_BLOCK LoaderBlock);
|
||||
|
||||
#endif // defined __REACTOS_H
|
||||
|
|
|
@ -42,7 +42,7 @@ void * memset(void *src, int val, size_t count);
|
|||
// Standard Library Functions
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
int atoi(char *string);
|
||||
int atoi(const char *string);
|
||||
char * itoa(int value, char *string, int radix);
|
||||
int toupper(int c);
|
||||
int tolower(int c);
|
||||
|
@ -75,8 +75,8 @@ void sound(int freq);
|
|||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
void print(char *str);
|
||||
void printf(char *fmt, ...);
|
||||
void sprintf(char *buffer, char *format, ...);
|
||||
int printf(const char *fmt, ...);
|
||||
int sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
|
|
@ -1,10 +1,22 @@
|
|||
/*
|
||||
* 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
|
||||
* FreeLoader
|
||||
* Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
|
||||
* Copyright (C) 2005 Alex Ionescu <alex@relsoft.net>
|
||||
* Copyright (C) 2005 Hartmut Birr <hartmut.birr@gmx.de>
|
||||
*
|
||||
* 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>
|
||||
|
@ -20,7 +32,7 @@
|
|||
#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 22
|
||||
#define PDE_SHIFT_PAE 18
|
||||
|
||||
|
||||
|
@ -61,7 +73,7 @@
|
|||
ULONG_PTR NextModuleBase = 0;
|
||||
|
||||
/* Currently Opened Module */
|
||||
PFRLDR_MODULE CurrentModule = NULL;
|
||||
PLOADER_MODULE CurrentModule = NULL;
|
||||
|
||||
/* Unrelocated Kernel Base in Virtual Memory */
|
||||
ULONG_PTR KernelBase;
|
||||
|
@ -72,22 +84,6 @@ BOOLEAN PaeModeEnabled;
|
|||
/* Kernel Entrypoint in Physical Memory */
|
||||
ULONG_PTR KernelEntry;
|
||||
|
||||
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;
|
||||
|
@ -422,7 +418,7 @@ FrLdrSetupPageDirectory(VOID)
|
|||
} else {
|
||||
|
||||
/* Get the Kernel Table Index */
|
||||
KernelPageTableIndex = (KernelBase >> PDE_SHIFT) / sizeof(HARDWARE_PTE_X86);
|
||||
KernelPageTableIndex = KernelBase >> PDE_SHIFT;
|
||||
|
||||
/* Get the Startup Page Directory */
|
||||
PageDir = (PPAGE_DIRECTORY_X86)&startup_pagedirectory;
|
||||
|
@ -685,12 +681,12 @@ FrLdrLoadModule(FILE *ModuleImage,
|
|||
PULONG ModuleSize)
|
||||
{
|
||||
ULONG LocalModuleSize;
|
||||
PFRLDR_MODULE ModuleData;
|
||||
PLOADER_MODULE ModuleData;
|
||||
LPSTR NameBuffer;
|
||||
LPSTR TempName;
|
||||
|
||||
/* Get current module data structure and module name string array */
|
||||
ModuleData = &multiboot_modules[LoaderBlock.ModsCount];
|
||||
ModuleData = &reactos_modules[LoaderBlock.ModsCount];
|
||||
|
||||
/* Get only the Module Name */
|
||||
do {
|
||||
|
@ -702,24 +698,24 @@ FrLdrLoadModule(FILE *ModuleImage,
|
|||
}
|
||||
|
||||
} while(TempName);
|
||||
NameBuffer = multiboot_module_strings[LoaderBlock.ModsCount];
|
||||
NameBuffer = reactos_module_strings[LoaderBlock.ModsCount];
|
||||
|
||||
/* Get Module Size */
|
||||
LocalModuleSize = FsGetFileSize(ModuleImage);
|
||||
|
||||
/* Fill out Module Data Structure */
|
||||
ModuleData->ModuleStart = NextModuleBase;
|
||||
ModuleData->ModuleEnd = NextModuleBase + LocalModuleSize;
|
||||
ModuleData->ModStart = NextModuleBase;
|
||||
ModuleData->ModEnd = NextModuleBase + LocalModuleSize;
|
||||
|
||||
/* Save name */
|
||||
strcpy(NameBuffer, ModuleName);
|
||||
ModuleData->ModuleName = NameBuffer;
|
||||
ModuleData->String = (ULONG_PTR)NameBuffer;
|
||||
|
||||
/* Load the file image */
|
||||
FsReadFile(ModuleImage, LocalModuleSize, NULL, (PVOID)NextModuleBase);
|
||||
|
||||
/* Move to next memory block and increase Module Count */
|
||||
NextModuleBase = ROUND_UP(ModuleData->ModuleEnd, PAGE_SIZE);
|
||||
NextModuleBase = ROUND_UP(ModuleData->ModEnd, PAGE_SIZE);
|
||||
LoaderBlock.ModsCount++;
|
||||
|
||||
/* Return Module Size if required */
|
||||
|
@ -727,33 +723,33 @@ FrLdrLoadModule(FILE *ModuleImage,
|
|||
*ModuleSize = LocalModuleSize;
|
||||
}
|
||||
|
||||
return(ModuleData->ModuleStart);
|
||||
return(ModuleData->ModStart);
|
||||
}
|
||||
|
||||
ULONG_PTR
|
||||
STDCALL
|
||||
FrLdrCreateModule(LPSTR ModuleName)
|
||||
{
|
||||
PFRLDR_MODULE ModuleData;
|
||||
PLOADER_MODULE ModuleData;
|
||||
LPSTR NameBuffer;
|
||||
|
||||
/* Get current module data structure and module name string array */
|
||||
ModuleData = &multiboot_modules[LoaderBlock.ModsCount];
|
||||
NameBuffer = multiboot_module_strings[LoaderBlock.ModsCount];
|
||||
ModuleData = &reactos_modules[LoaderBlock.ModsCount];
|
||||
NameBuffer = reactos_module_strings[LoaderBlock.ModsCount];
|
||||
|
||||
/* Set up the structure */
|
||||
ModuleData->ModuleStart = NextModuleBase;
|
||||
ModuleData->ModuleEnd = -1;
|
||||
ModuleData->ModStart = NextModuleBase;
|
||||
ModuleData->ModEnd = -1;
|
||||
|
||||
/* Copy the name */
|
||||
strcpy(NameBuffer, ModuleName);
|
||||
ModuleData->ModuleName = NameBuffer;
|
||||
ModuleData->String = (ULONG_PTR)NameBuffer;
|
||||
|
||||
/* Set the current Module */
|
||||
CurrentModule = ModuleData;
|
||||
|
||||
/* Return Module Base Address */
|
||||
return(ModuleData->ModuleStart);
|
||||
return(ModuleData->ModStart);
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
@ -761,19 +757,19 @@ STDCALL
|
|||
FrLdrCloseModule(ULONG_PTR ModuleBase,
|
||||
ULONG ModuleSize)
|
||||
{
|
||||
PFRLDR_MODULE ModuleData = CurrentModule;
|
||||
PLOADER_MODULE ModuleData = CurrentModule;
|
||||
|
||||
/* Make sure a module is opened */
|
||||
if (ModuleData) {
|
||||
|
||||
/* Make sure this is the right module and that it hasn't been closed */
|
||||
if ((ModuleBase == ModuleData->ModuleStart) && (ModuleData->ModuleEnd == (ULONG_PTR)-1)) {
|
||||
if ((ModuleBase == ModuleData->ModStart) && (ModuleData->ModEnd == (ULONG_PTR)-1)) {
|
||||
|
||||
/* Close the Module */
|
||||
ModuleData->ModuleEnd = ModuleData->ModuleStart + ModuleSize;
|
||||
ModuleData->ModEnd = ModuleData->ModStart + ModuleSize;
|
||||
|
||||
/* Set the next Module Base and increase the number of modules */
|
||||
NextModuleBase = ROUND_UP(ModuleData->ModuleEnd, PAGE_SIZE);
|
||||
NextModuleBase = ROUND_UP(ModuleData->ModEnd, PAGE_SIZE);
|
||||
LoaderBlock.ModsCount++;
|
||||
|
||||
/* Close the currently opened module */
|
|
@ -1,9 +1,22 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: Freeloader
|
||||
* FILE: boot/freeldr/freeldr/reactos/rosboot.c
|
||||
* PURPOSE: ReactOS Loader
|
||||
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
|
||||
* FreeLoader
|
||||
*
|
||||
* Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
|
||||
* Copyright (C) 2005 Alex Ionescu <alex@relsoft.net>
|
||||
*
|
||||
* 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>
|
||||
|
@ -14,6 +27,13 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
LOADER_PARAMETER_BLOCK LoaderBlock;
|
||||
char reactos_kernel_cmdline[255]; // Command line passed to kernel
|
||||
LOADER_MODULE reactos_modules[64]; // Array to hold boot module info loaded for the kernel
|
||||
char reactos_module_strings[64][256]; // Array to hold module names
|
||||
unsigned long reactos_memory_map_descriptor_size;
|
||||
memory_map_t reactos_memory_map[32]; // Memory map
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
FrLdrLoadKernel(PCHAR szFileName,
|
||||
|
@ -583,42 +603,42 @@ LoadAndBootReactOS(PCHAR OperatingSystemName)
|
|||
/*
|
||||
* Setup multiboot information structure
|
||||
*/
|
||||
LoaderBlock.Flags = MB_INFO_FLAG_MEM_SIZE | MB_INFO_FLAG_BOOT_DEVICE | MB_INFO_FLAG_COMMAND_LINE | MB_INFO_FLAG_MODULES;
|
||||
LoaderBlock.Flags = MB_FLAGS_BOOT_DEVICE | MB_FLAGS_COMMAND_LINE | MB_FLAGS_MODULE_INFO;
|
||||
LoaderBlock.PageDirectoryStart = (ULONG)&PageDirectoryStart;
|
||||
LoaderBlock.PageDirectoryEnd = (ULONG)&PageDirectoryEnd;
|
||||
LoaderBlock.BootDevice = 0xffffffff;
|
||||
LoaderBlock.CommandLine = (unsigned long)multiboot_kernel_cmdline;
|
||||
LoaderBlock.CommandLine = (unsigned long)reactos_kernel_cmdline;
|
||||
LoaderBlock.ModsCount = 0;
|
||||
LoaderBlock.ModsAddr = (unsigned long)multiboot_modules;
|
||||
LoaderBlock.MmapLength = (unsigned long)MachGetMemoryMap((PBIOS_MEMORY_MAP)(PVOID)&multiboot_memory_map, 32) * sizeof(memory_map_t);
|
||||
LoaderBlock.ModsAddr = (unsigned long)reactos_modules;
|
||||
LoaderBlock.MmapLength = (unsigned long)MachGetMemoryMap((PBIOS_MEMORY_MAP)(PVOID)&reactos_memory_map, 32) * sizeof(memory_map_t);
|
||||
if (LoaderBlock.MmapLength)
|
||||
{
|
||||
LoaderBlock.MmapAddr = (unsigned long)&multiboot_memory_map;
|
||||
LoaderBlock.Flags |= MB_INFO_FLAG_MEM_SIZE | MB_INFO_FLAG_MEMORY_MAP;
|
||||
multiboot_memory_map_descriptor_size = sizeof(memory_map_t); // GetBiosMemoryMap uses a fixed value of 24
|
||||
LoaderBlock.MmapAddr = (unsigned long)&reactos_memory_map;
|
||||
LoaderBlock.Flags |= MB_FLAGS_MEM_INFO | MB_FLAGS_MMAP_INFO;
|
||||
reactos_memory_map_descriptor_size = sizeof(memory_map_t); // GetBiosMemoryMap uses a fixed value of 24
|
||||
DbgPrint((DPRINT_REACTOS, "memory map length: %d\n", LoaderBlock.MmapLength));
|
||||
DbgPrint((DPRINT_REACTOS, "dumping memory map:\n"));
|
||||
for (i=0; i<(LoaderBlock.MmapLength/sizeof(memory_map_t)); i++)
|
||||
{
|
||||
if (MEMTYPE_USABLE == multiboot_memory_map[i].type &&
|
||||
0 == multiboot_memory_map[i].base_addr_low)
|
||||
if (MEMTYPE_USABLE == reactos_memory_map[i].type &&
|
||||
0 == reactos_memory_map[i].base_addr_low)
|
||||
{
|
||||
LoaderBlock.MemLower = (multiboot_memory_map[i].base_addr_low + multiboot_memory_map[i].length_low) / 1024;
|
||||
LoaderBlock.MemLower = (reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) / 1024;
|
||||
if (640 < LoaderBlock.MemLower)
|
||||
{
|
||||
LoaderBlock.MemLower = 640;
|
||||
}
|
||||
}
|
||||
if (MEMTYPE_USABLE == multiboot_memory_map[i].type &&
|
||||
multiboot_memory_map[i].base_addr_low <= 1024 * 1024 &&
|
||||
1024 * 1024 <= multiboot_memory_map[i].base_addr_low + multiboot_memory_map[i].length_low)
|
||||
if (MEMTYPE_USABLE == reactos_memory_map[i].type &&
|
||||
reactos_memory_map[i].base_addr_low <= 1024 * 1024 &&
|
||||
1024 * 1024 <= reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low)
|
||||
{
|
||||
LoaderBlock.MemHigher = (multiboot_memory_map[i].base_addr_low + multiboot_memory_map[i].length_low) / 1024 - 1024;
|
||||
LoaderBlock.MemHigher = (reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) / 1024 - 1024;
|
||||
}
|
||||
DbgPrint((DPRINT_REACTOS, "start: %x\t size: %x\t type %d\n",
|
||||
multiboot_memory_map[i].base_addr_low,
|
||||
multiboot_memory_map[i].length_low,
|
||||
multiboot_memory_map[i].type));
|
||||
reactos_memory_map[i].base_addr_low,
|
||||
reactos_memory_map[i].length_low,
|
||||
reactos_memory_map[i].type));
|
||||
}
|
||||
}
|
||||
DbgPrint((DPRINT_REACTOS, "low_mem = %d\n", LoaderBlock.MemLower));
|
||||
|
@ -646,13 +666,13 @@ LoadAndBootReactOS(PCHAR OperatingSystemName)
|
|||
/* Normalize */
|
||||
MachDiskGetBootPath(SystemPath, sizeof(SystemPath));
|
||||
strcat(SystemPath, "\\reactos");
|
||||
strcat(strcpy(multiboot_kernel_cmdline, SystemPath),
|
||||
strcat(strcpy(reactos_kernel_cmdline, SystemPath),
|
||||
" /MININT");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* copy system path into kernel command line */
|
||||
strcpy(multiboot_kernel_cmdline, SystemPath);
|
||||
strcpy(reactos_kernel_cmdline, SystemPath);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -660,8 +680,8 @@ LoadAndBootReactOS(PCHAR OperatingSystemName)
|
|||
*/
|
||||
if (IniReadSettingByName(SectionId, "Options", value, 1024))
|
||||
{
|
||||
strcat(multiboot_kernel_cmdline, " ");
|
||||
strcat(multiboot_kernel_cmdline, value);
|
||||
strcat(reactos_kernel_cmdline, " ");
|
||||
strcat(reactos_kernel_cmdline, value);
|
||||
}
|
||||
|
||||
|
||||
|
@ -673,7 +693,7 @@ LoadAndBootReactOS(PCHAR OperatingSystemName)
|
|||
*/
|
||||
MachHwDetect();
|
||||
|
||||
if (AcpiPresent) LoaderBlock.Flags |= MB_INFO_FLAG_ACPI_TABLE;
|
||||
if (AcpiPresent) LoaderBlock.Flags |= MB_FLAGS_ACPI_TABLE;
|
||||
|
||||
UiDrawStatusText("Loading...");
|
||||
UiDrawProgressBarCenter(0, 100, "Loading ReactOS...");
|
||||
|
|
|
@ -210,7 +210,7 @@ RegCreateKey(FRLDRHKEY ParentKey,
|
|||
PFRLDRHKEY Key)
|
||||
{
|
||||
PLIST_ENTRY Ptr;
|
||||
FRLDRHKEY SearchKey = INVALID_HANDLE_VALUE;
|
||||
FRLDRHKEY SearchKey = NULL;
|
||||
FRLDRHKEY CurrentKey;
|
||||
FRLDRHKEY NewKey;
|
||||
PCHAR p;
|
||||
|
@ -388,7 +388,7 @@ RegOpenKey(FRLDRHKEY ParentKey,
|
|||
PFRLDRHKEY Key)
|
||||
{
|
||||
PLIST_ENTRY Ptr;
|
||||
FRLDRHKEY SearchKey = INVALID_HANDLE_VALUE;
|
||||
FRLDRHKEY SearchKey = NULL;
|
||||
FRLDRHKEY CurrentKey;
|
||||
PCHAR p;
|
||||
PCHAR name;
|
||||
|
|
|
@ -21,9 +21,6 @@
|
|||
#ifndef __REGISTRY_H
|
||||
#define __REGISTRY_H
|
||||
|
||||
|
||||
#define INVALID_HANDLE_VALUE NULL
|
||||
|
||||
typedef struct _REG_KEY
|
||||
{
|
||||
LIST_ENTRY KeyList;
|
||||
|
|
|
@ -33,6 +33,12 @@
|
|||
|
||||
#include "registry.h"
|
||||
|
||||
LOADER_PARAMETER_BLOCK LoaderBlock;
|
||||
char reactos_kernel_cmdline[255]; // Command line passed to kernel
|
||||
LOADER_MODULE reactos_modules[64]; // Array to hold boot module info loaded for the kernel
|
||||
char reactos_module_strings[64][256]; // Array to hold module names
|
||||
unsigned long reactos_memory_map_descriptor_size;
|
||||
memory_map_t reactos_memory_map[32]; // Memory map
|
||||
|
||||
#define USE_UI
|
||||
|
||||
|
@ -250,41 +256,41 @@ VOID RunLoader(VOID)
|
|||
extern ULONG PageDirectoryEnd;
|
||||
|
||||
/* Setup multiboot information structure */
|
||||
LoaderBlock.Flags = MB_INFO_FLAG_BOOT_DEVICE | MB_INFO_FLAG_COMMAND_LINE | MB_INFO_FLAG_MODULES;
|
||||
LoaderBlock.Flags = MB_FLAGS_BOOT_DEVICE | MB_FLAGS_COMMAND_LINE | MB_FLAGS_MODULE_INFO;
|
||||
LoaderBlock.PageDirectoryStart = (ULONG)&PageDirectoryStart;
|
||||
LoaderBlock.PageDirectoryEnd = (ULONG)&PageDirectoryEnd;
|
||||
LoaderBlock.BootDevice = 0xffffffff;
|
||||
LoaderBlock.CommandLine = (unsigned long)multiboot_kernel_cmdline;
|
||||
LoaderBlock.CommandLine = (unsigned long)reactos_kernel_cmdline;
|
||||
LoaderBlock.ModsCount = 0;
|
||||
LoaderBlock.ModsAddr = (unsigned long)multiboot_modules;
|
||||
LoaderBlock.MmapLength = (unsigned long)MachGetMemoryMap((PBIOS_MEMORY_MAP)(PVOID)&multiboot_memory_map, 32) * sizeof(memory_map_t);
|
||||
LoaderBlock.ModsAddr = (unsigned long)reactos_modules;
|
||||
LoaderBlock.MmapLength = (unsigned long)MachGetMemoryMap((PBIOS_MEMORY_MAP)(PVOID)&reactos_memory_map, 32) * sizeof(memory_map_t);
|
||||
if (LoaderBlock.MmapLength)
|
||||
{
|
||||
LoaderBlock.MmapAddr = (unsigned long)&multiboot_memory_map;
|
||||
LoaderBlock.Flags |= MB_INFO_FLAG_MEM_SIZE | MB_INFO_FLAG_MEMORY_MAP;
|
||||
multiboot_memory_map_descriptor_size = sizeof(memory_map_t); // GetBiosMemoryMap uses a fixed value of 24
|
||||
LoaderBlock.MmapAddr = (unsigned long)&reactos_memory_map;
|
||||
LoaderBlock.Flags |= MB_FLAGS_MEM_INFO | MB_FLAGS_MMAP_INFO;
|
||||
reactos_memory_map_descriptor_size = sizeof(memory_map_t); // GetBiosMemoryMap uses a fixed value of 24
|
||||
for (i = 0; i < (LoaderBlock.MmapLength / sizeof(memory_map_t)); i++)
|
||||
{
|
||||
if (MEMTYPE_USABLE == multiboot_memory_map[i].type &&
|
||||
0 == multiboot_memory_map[i].base_addr_low)
|
||||
if (MEMTYPE_USABLE == reactos_memory_map[i].type &&
|
||||
0 == reactos_memory_map[i].base_addr_low)
|
||||
{
|
||||
LoaderBlock.MemLower = (multiboot_memory_map[i].base_addr_low + multiboot_memory_map[i].length_low) / 1024;
|
||||
LoaderBlock.MemLower = (reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) / 1024;
|
||||
if (640 < LoaderBlock.MemLower)
|
||||
{
|
||||
LoaderBlock.MemLower = 640;
|
||||
}
|
||||
}
|
||||
if (MEMTYPE_USABLE == multiboot_memory_map[i].type &&
|
||||
multiboot_memory_map[i].base_addr_low <= 1024 * 1024 &&
|
||||
1024 * 1024 <= multiboot_memory_map[i].base_addr_low + multiboot_memory_map[i].length_low)
|
||||
if (MEMTYPE_USABLE == reactos_memory_map[i].type &&
|
||||
reactos_memory_map[i].base_addr_low <= 1024 * 1024 &&
|
||||
1024 * 1024 <= reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low)
|
||||
{
|
||||
LoaderBlock.MemHigher = (multiboot_memory_map[i].base_addr_low + multiboot_memory_map[i].length_low) / 1024 - 1024;
|
||||
LoaderBlock.MemHigher = (reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) / 1024 - 1024;
|
||||
}
|
||||
#if 0
|
||||
printf("start: %x\t size: %x\t type %d\n",
|
||||
multiboot_memory_map[i].base_addr_low,
|
||||
multiboot_memory_map[i].length_low,
|
||||
multiboot_memory_map[i].type);
|
||||
reactos_memory_map[i].base_addr_low,
|
||||
reactos_memory_map[i].length_low,
|
||||
reactos_memory_map[i].type);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -369,8 +375,8 @@ VOID RunLoader(VOID)
|
|||
}
|
||||
|
||||
/* Set kernel command line */
|
||||
MachDiskGetBootPath(multiboot_kernel_cmdline, sizeof(multiboot_kernel_cmdline));
|
||||
strcat(strcat(strcat(multiboot_kernel_cmdline, SourcePath), " "),
|
||||
MachDiskGetBootPath(reactos_kernel_cmdline, sizeof(reactos_kernel_cmdline));
|
||||
strcat(strcat(strcat(reactos_kernel_cmdline, SourcePath), " "),
|
||||
LoadOptions);
|
||||
|
||||
/* Load ntoskrnl.exe */
|
||||
|
|
|
@ -37,7 +37,7 @@ void print(char *str)
|
|||
* printf() - prints formatted text to stdout
|
||||
* originally from GRUB
|
||||
*/
|
||||
void printf(char *format, ... )
|
||||
int printf(const char *format, ... )
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap,format);
|
||||
|
@ -102,9 +102,11 @@ void printf(char *format, ... )
|
|||
}
|
||||
|
||||
va_end(ap);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sprintf(char *buffer, char *format, ... )
|
||||
int sprintf(char *buffer, const char *format, ... )
|
||||
{
|
||||
va_list ap;
|
||||
char c, *ptr, str[16];
|
||||
|
@ -178,4 +180,6 @@ void sprintf(char *buffer, char *format, ... )
|
|||
}
|
||||
va_end(ap);
|
||||
*p=0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -127,11 +127,11 @@ int tolower(int c)
|
|||
return c;
|
||||
}
|
||||
|
||||
int atoi(char *string)
|
||||
int atoi(const char *string)
|
||||
{
|
||||
int base;
|
||||
int result = 0;
|
||||
char *str;
|
||||
const char *str;
|
||||
|
||||
if((string[0] == '0') && (string[1] == 'x'))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue