2017-06-02 00:52:36 +00:00
|
|
|
/*
|
|
|
|
* FreeLoader
|
|
|
|
* Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
|
|
|
|
* Copyright (C) 2006 Aleksey Bragin <aleksey@reactos.org>
|
|
|
|
*
|
|
|
|
* 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 <arc/setupblk.h>
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
// See freeldr/include/winldr.h
|
|
|
|
#define TAG_WLDR_DTE 'eDlW'
|
|
|
|
#define TAG_WLDR_BDE 'dBlW'
|
|
|
|
#define TAG_WLDR_NAME 'mNlW'
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Entry-point to kernel */
|
|
|
|
typedef VOID (NTAPI *KERNEL_ENTRY_POINT) (PLOADER_PARAMETER_BLOCK LoaderBlock);
|
|
|
|
|
|
|
|
|
|
|
|
// Some definitions
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
|
|
|
// Descriptors
|
|
|
|
#define NUM_GDT 128 // Must be 128
|
|
|
|
#define NUM_IDT 0x100 // Only 16 are used though. Must be 0x100
|
|
|
|
|
|
|
|
#include <pshpack1.h>
|
|
|
|
typedef struct /* Root System Descriptor Pointer */
|
|
|
|
{
|
|
|
|
CHAR signature [8]; /* contains "RSD PTR " */
|
|
|
|
UCHAR checksum; /* to make sum of struct == 0 */
|
|
|
|
CHAR oem_id [6]; /* OEM identification */
|
|
|
|
UCHAR revision; /* Must be 0 for 1.0, 2 for 2.0 */
|
|
|
|
ULONG rsdt_physical_address; /* 32-bit physical address of RSDT */
|
|
|
|
ULONG length; /* XSDT Length in bytes including hdr */
|
|
|
|
ULONGLONG xsdt_physical_address; /* 64-bit physical address of XSDT */
|
|
|
|
UCHAR extended_checksum; /* Checksum of entire table */
|
|
|
|
CHAR reserved [3]; /* reserved field must be 0 */
|
|
|
|
} RSDP_DESCRIPTOR, *PRSDP_DESCRIPTOR;
|
|
|
|
#include <poppack.h>
|
|
|
|
|
|
|
|
typedef struct _ARC_DISK_SIGNATURE_EX
|
|
|
|
{
|
|
|
|
ARC_DISK_SIGNATURE DiskSignature;
|
|
|
|
CHAR ArcName[MAX_PATH];
|
|
|
|
} ARC_DISK_SIGNATURE_EX, *PARC_DISK_SIGNATURE_EX;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define MAX_OPTIONS_LENGTH 255
|
|
|
|
|
|
|
|
typedef struct _LOADER_SYSTEM_BLOCK
|
|
|
|
{
|
|
|
|
LOADER_PARAMETER_BLOCK LoaderBlock;
|
|
|
|
LOADER_PARAMETER_EXTENSION Extension;
|
|
|
|
SETUP_LOADER_BLOCK SetupBlock;
|
|
|
|
#ifdef _M_IX86
|
|
|
|
HEADLESS_LOADER_BLOCK HeadlessLoaderBlock;
|
|
|
|
#endif
|
|
|
|
NLS_DATA_BLOCK NlsDataBlock;
|
|
|
|
CHAR LoadOptions[MAX_OPTIONS_LENGTH+1];
|
|
|
|
CHAR ArcBootDeviceName[MAX_PATH+1];
|
|
|
|
// CHAR ArcHalDeviceName[MAX_PATH];
|
|
|
|
CHAR NtBootPathName[MAX_PATH+1];
|
|
|
|
CHAR NtHalPathName[MAX_PATH+1];
|
|
|
|
ARC_DISK_INFORMATION ArcDiskInformation;
|
|
|
|
} LOADER_SYSTEM_BLOCK, *PLOADER_SYSTEM_BLOCK;
|
|
|
|
|
|
|
|
extern PLOADER_SYSTEM_BLOCK WinLdrSystemBlock;
|
|
|
|
|
|
|
|
|
|
|
|
// conversion.c
|
|
|
|
#if 0
|
|
|
|
PVOID VaToPa(PVOID Va);
|
|
|
|
PVOID PaToVa(PVOID Pa);
|
|
|
|
VOID List_PaToVa(_In_ LIST_ENTRY *ListEntry);
|
|
|
|
#endif
|
|
|
|
VOID ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start);
|
|
|
|
|
|
|
|
|
|
|
|
// winldr.c
|
2019-08-10 17:13:20 +00:00
|
|
|
PVOID WinLdrLoadModule(PCSTR ModuleName, PULONG Size,
|
2017-06-02 00:52:36 +00:00
|
|
|
TYPE_OF_MEMORY MemoryType);
|
|
|
|
|
|
|
|
// wlmemory.c
|
|
|
|
BOOLEAN
|
|
|
|
WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock);
|
|
|
|
|
|
|
|
// wlregistry.c
|
|
|
|
BOOLEAN
|
|
|
|
WinLdrInitSystemHive(
|
|
|
|
IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|
|
|
IN PCSTR SystemRoot,
|
|
|
|
IN BOOLEAN Setup);
|
|
|
|
|
|
|
|
BOOLEAN WinLdrScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
2019-08-10 17:13:20 +00:00
|
|
|
IN PCSTR DirectoryPath);
|
2017-06-02 00:52:36 +00:00
|
|
|
|
|
|
|
// winldr.c
|
|
|
|
VOID
|
|
|
|
WinLdrInitializePhase1(PLOADER_PARAMETER_BLOCK LoaderBlock,
|
2019-08-10 17:13:20 +00:00
|
|
|
PCSTR Options,
|
|
|
|
PCSTR SystemPath,
|
|
|
|
PCSTR BootPath,
|
2017-06-02 00:52:36 +00:00
|
|
|
USHORT VersionToBoot);
|
|
|
|
BOOLEAN
|
|
|
|
WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
|
2019-08-10 17:13:20 +00:00
|
|
|
IN PCSTR DirectoryPath,
|
|
|
|
IN PCSTR AnsiFileName,
|
|
|
|
IN PCSTR OemFileName,
|
|
|
|
IN PCSTR LanguageFileName);
|
2017-06-02 00:52:36 +00:00
|
|
|
BOOLEAN
|
|
|
|
WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead,
|
|
|
|
LPWSTR RegistryPath,
|
|
|
|
LPWSTR ImagePath,
|
|
|
|
LPWSTR ServiceName);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
WinLdrpDumpMemoryDescriptors(PLOADER_PARAMETER_BLOCK LoaderBlock);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
WinLdrpDumpBootDriver(PLOADER_PARAMETER_BLOCK LoaderBlock);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
WinLdrpDumpArcDisks(PLOADER_PARAMETER_BLOCK LoaderBlock);
|
|
|
|
|
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023
- During loading and initialization of the list of operating systems
available in freeldr.ini, convert any legacy operating system entry
encountered -- they are like those in NTLDR's boot.ini file, i.e.:
ArcOsLoadPartition="LoadIdentifier" /List /of /Options
into a new operating system INI entry, like those used by default in
FreeLoader. This allows us to avoid treating this corner-case later in
different parts of the code. Also, the "BootType" value is now
determined there, only once.
- Convert the OS loaders entry-points to ARC-compatible ones, following
the "Advanced RISC Computing Specification, Version 1.2" specification
https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf
- Introduce helpers for retrieving options values from the argument vector
in a simple way.
- Simplify LoadOperatingSystem(), since now the "BootType" value has
been determined once while loading the list of OSes (see above) and
is well-defined there. Use the BuildArgvForOsLoader() helper to build
the ARC-compatible argument vector from the corresponding INI settings
for the selected operating system entry, and use it when calling the
corresponding OS loader.
- In the OS loaders, since we can now directly read the settings from
the argument vector (instead of using INI settings), we can avoid
using a bunch of fixed-size string buffers, and avoid potentially
failing IniOpenSection() calls as well.
- Simplify code in the Linux loader (and the RemoveQuotes() function).
- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
passed through the argument vector (equivalent to
UiShowMessageBoxesInSection() ).
- Use string-safe functions where needed (copy/concatenation/printf on
fixed-size buffers).
2019-08-06 20:30:54 +00:00
|
|
|
ARC_STATUS
|
2017-06-02 00:52:36 +00:00
|
|
|
LoadAndBootWindowsCommon(
|
|
|
|
USHORT OperatingSystemVersion,
|
|
|
|
PLOADER_PARAMETER_BLOCK LoaderBlock,
|
2019-08-10 17:13:20 +00:00
|
|
|
PCSTR BootOptions,
|
|
|
|
PCSTR BootPath,
|
2017-06-02 00:52:36 +00:00
|
|
|
BOOLEAN Setup);
|