https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fba4ad4cebd6ebe3776832...
commit fba4ad4cebd6ebe3776832f81a4eb8e5d113525b Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Sun Aug 11 18:56:40 2019 +0200 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Sun Aug 11 22:01:36 2019 +0200
[FREELDR] Move files where they are only used.
- Merge fade.c/palette.c/video.c into video.c and move it into UI. - Move inffile.c into NTLDR. --- boot/freeldr/freeldr/CMakeLists.txt | 12 +- boot/freeldr/freeldr/{machine.c => arch/arcemul.c} | 0 boot/freeldr/freeldr/arch/i386/machpc.c | 6 + boot/freeldr/freeldr/include/freeldr.h | 6 +- boot/freeldr/freeldr/include/fs.h | 3 + boot/freeldr/freeldr/include/ntldr/winldr.h | 62 ++++++++++ boot/freeldr/freeldr/include/peloader.h | 41 +++++++ boot/freeldr/freeldr/include/ui/video.h | 29 +++++ boot/freeldr/freeldr/include/video.h | 46 -------- boot/freeldr/freeldr/include/winldr.h | 126 --------------------- boot/freeldr/freeldr/{ => lib}/cache/blocklist.c | 0 boot/freeldr/freeldr/{ => lib}/cache/cache.c | 0 boot/freeldr/freeldr/lib/peloader.c | 30 ++--- boot/freeldr/freeldr/ntldr/arch/amd64/winldr.c | 6 +- boot/freeldr/freeldr/ntldr/arch/arm/winldr.c | 1 + boot/freeldr/freeldr/ntldr/arch/i386/winldr.c | 6 +- .../freeldr/{lib/inffile => ntldr}/inffile.c | 30 +---- boot/freeldr/freeldr/{include => ntldr}/inffile.h | 29 +---- boot/freeldr/freeldr/ntldr/setupldr.c | 27 ++--- boot/freeldr/freeldr/ntldr/winldr.c | 25 +--- boot/freeldr/freeldr/ntldr/winldr.h | 56 ++++----- boot/freeldr/freeldr/{video/fade.c => ui/video.c} | 107 +++++++++++------ boot/freeldr/freeldr/video/palette.c | 42 ------- boot/freeldr/freeldr/video/video.c | 45 -------- 24 files changed, 291 insertions(+), 444 deletions(-)
diff --git a/boot/freeldr/freeldr/CMakeLists.txt b/boot/freeldr/freeldr/CMakeLists.txt index d4263050ad4..0f6947b3b0d 100644 --- a/boot/freeldr/freeldr/CMakeLists.txt +++ b/boot/freeldr/freeldr/CMakeLists.txt @@ -40,6 +40,8 @@ list(APPEND FREELDR_BOOTLIB_SOURCE lib/arcsupp.c lib/debug.c lib/peloader.c + lib/cache/blocklist.c + lib/cache/cache.c lib/comm/rs232.c ## add KD support lib/fs/btrfs.c @@ -64,10 +66,8 @@ list(APPEND FREELDR_NTLDR_SOURCE
list(APPEND FREELDR_ARC_SOURCE arcname.c - machine.c + arch/arcemul.c arch/archwsup.c - cache/blocklist.c - cache/cache.c disk/disk.c disk/partition.c disk/ramdisk.c) @@ -89,9 +89,7 @@ list(APPEND FREELDR_BOOTMGR_SOURCE ui/tui.c ui/tuimenu.c ui/ui.c - video/fade.c - video/palette.c - video/video.c) + ui/video.c)
list(APPEND FREELDR_BASE_ASM_SOURCE)
@@ -226,7 +224,7 @@ list(APPEND FREELDR_BASE_SOURCE ## even if ${FREELDR_NTLDR_SOURCE} is not added, ## otherwise we get linking errors with Rtl**Bitmap** APIs. ## Do not happen on MSVC builds however... - lib/inffile/inffile.c + ntldr/inffile.c lib/rtl/libsupp.c)
if(ARCH STREQUAL "i386") diff --git a/boot/freeldr/freeldr/machine.c b/boot/freeldr/freeldr/arch/arcemul.c similarity index 100% rename from boot/freeldr/freeldr/machine.c rename to boot/freeldr/freeldr/arch/arcemul.c diff --git a/boot/freeldr/freeldr/arch/i386/machpc.c b/boot/freeldr/freeldr/arch/i386/machpc.c index 5ec2195638a..0d17add29c6 100644 --- a/boot/freeldr/freeldr/arch/i386/machpc.c +++ b/boot/freeldr/freeldr/arch/i386/machpc.c @@ -1215,6 +1215,12 @@ DetectPS2Mouse(PCONFIGURATION_COMPONENT_DATA BusKey) } }
+ +// Implemented in i386vid.c, returns the VESA version +USHORT BiosIsVesaSupported(VOID); +BOOLEAN BiosIsVesaDdcSupported(VOID); +BOOLEAN BiosVesaReadEdid(VOID); + static VOID DetectDisplayController(PCONFIGURATION_COMPONENT_DATA BusKey) { diff --git a/boot/freeldr/freeldr/include/freeldr.h b/boot/freeldr/freeldr/include/freeldr.h index 841fd4c64ee..67966616442 100644 --- a/boot/freeldr/freeldr/include/freeldr.h +++ b/boot/freeldr/freeldr/include/freeldr.h @@ -65,7 +65,6 @@ #include <comm.h> #include <disk.h> #include <fs.h> -#include <inffile.h> #include <inifile.h> #include <keycodes.h> #include <linux.h> @@ -79,11 +78,11 @@ #include <ramdisk.h> #include <ui.h> #include <ver.h> -#include <video.h>
/* NTOS loader */ -#include <winldr.h> +#include <include/ntldr/winldr.h> #include <conversion.h> // More-or-less related to MM also... +#include <peloader.h>
/* File system headers */ #include <fs/ext2.h> @@ -98,6 +97,7 @@ #include <ui/minitui.h> #include <ui/noui.h> #include <ui/tui.h> +#include <ui/video.h>
/* Arch specific includes */ #include <arch/archwsup.h> diff --git a/boot/freeldr/freeldr/include/fs.h b/boot/freeldr/freeldr/include/fs.h index 9c68c791e17..5c5fdd4f425 100644 --- a/boot/freeldr/freeldr/include/fs.h +++ b/boot/freeldr/freeldr/include/fs.h @@ -19,6 +19,9 @@
#pragma once
+// FIXME: This one has nothing to do here!! +#define SECTOR_SIZE 512 + typedef struct tagDEVVTBL { ARC_CLOSE Close; diff --git a/boot/freeldr/freeldr/include/ntldr/winldr.h b/boot/freeldr/freeldr/include/ntldr/winldr.h new file mode 100644 index 00000000000..42ee1ba1da1 --- /dev/null +++ b/boot/freeldr/freeldr/include/ntldr/winldr.h @@ -0,0 +1,62 @@ +/* + * PROJECT: FreeLoader + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: Windows-compatible NT OS Loader. + * COPYRIGHT: Copyright 2006-2019 Aleksey Bragin aleksey@reactos.org + */ + +#pragma once + +#include <arc/setupblk.h> + +// See freeldr/ntldr/winldr.h +#define TAG_WLDR_DTE 'eDlW' +#define TAG_WLDR_BDE 'dBlW' +#define TAG_WLDR_NAME 'mNlW' + +// Some definitions + +#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; + +//////////////////////////////////////////////////////////////////////////////// +// +// ReactOS Loading Functions +// +//////////////////////////////////////////////////////////////////////////////// + +ARC_STATUS +LoadAndBootWindows( + IN ULONG Argc, + IN PCHAR Argv[], + IN PCHAR Envp[]); + +ARC_STATUS +LoadReactOSSetup( + IN ULONG Argc, + IN PCHAR Argv[], + IN PCHAR Envp[]); + + +// conversion.c and conversion.h +PVOID VaToPa(PVOID Va); +PVOID PaToVa(PVOID Pa); +VOID List_PaToVa(_In_ LIST_ENTRY *ListEntry); diff --git a/boot/freeldr/freeldr/include/peloader.h b/boot/freeldr/freeldr/include/peloader.h new file mode 100644 index 00000000000..9d4b1178819 --- /dev/null +++ b/boot/freeldr/freeldr/include/peloader.h @@ -0,0 +1,41 @@ +/* + * PROJECT: FreeLoader + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: Provides routines for loading PE files. + * (Deprecated remark) To be merged with arch/i386/loader.c in future. + * + * COPYRIGHT: Copyright 1998-2003 Brian Palmer brianp@sginet.com + * Copyright 2006-2019 Aleksey Bragin aleksey@reactos.org + * + * NOTES: The source code in this file is based on the work of respective + * authors of PE loading code in ReactOS and Brian Palmer and + * Alex Ionescu's arch/i386/loader.c, and my research project + * (creating a native EFI loader for Windows). + * + * This article was very handy during development: + * http://msdn.microsoft.com/msdnmag/issues/02/03/PE2/ + */ + +#pragma once + +BOOLEAN +WinLdrLoadImage(IN PCHAR FileName, + TYPE_OF_MEMORY MemoryType, + OUT PVOID *ImageBasePA); + +BOOLEAN +WinLdrAllocateDataTableEntry(IN OUT PLIST_ENTRY ModuleListHead, + IN PCCH BaseDllName, + IN PCCH FullDllName, + IN PVOID BasePA, + OUT PLDR_DATA_TABLE_ENTRY *NewEntry); + +BOOLEAN +WinLdrScanImportDescriptorTable(IN OUT PLIST_ENTRY ModuleListHead, + IN PCCH DirectoryPath, + IN PLDR_DATA_TABLE_ENTRY ScanDTE); + +BOOLEAN +WinLdrCheckForLoadedDll(IN OUT PLIST_ENTRY ModuleListHead, + IN PCH DllName, + OUT PLDR_DATA_TABLE_ENTRY *LoadedEntry); diff --git a/boot/freeldr/freeldr/include/ui/video.h b/boot/freeldr/freeldr/include/ui/video.h new file mode 100644 index 00000000000..0e0f4ec3828 --- /dev/null +++ b/boot/freeldr/freeldr/include/ui/video.h @@ -0,0 +1,29 @@ +/* + * PROJECT: FreeLoader + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: UI Video helpers for special effects. + * COPYRIGHT: Copyright 1998-2003 Brian Palmer brianp@sginet.com + */ + +#pragma once + +#include <pshpack1.h> +typedef struct _PALETTE_ENTRY +{ + UCHAR Red; + UCHAR Green; + UCHAR Blue; +} PALETTE_ENTRY, *PPALETTE_ENTRY; +#include <poppack.h> + +// extern PVOID VideoOffScreenBuffer; + +PVOID VideoAllocateOffScreenBuffer(VOID); // Returns a pointer to an off-screen buffer sufficient for the current video mode +VOID VideoCopyOffScreenBufferToVRAM(VOID); + +VOID VideoSavePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount); +VOID VideoRestorePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount); + +VOID VideoSetAllColorsToBlack(ULONG ColorCount); +VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount); +VOID VideoFadeOut(ULONG ColorCount); diff --git a/boot/freeldr/freeldr/include/video.h b/boot/freeldr/freeldr/include/video.h deleted file mode 100644 index 6162a47ecf9..00000000000 --- a/boot/freeldr/freeldr/include/video.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * FreeLoader - * Copyright (C) 1998-2003 Brian Palmer brianp@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. - */ - -#pragma once - -#include <pshpack1.h> -typedef struct -{ - UCHAR Red; - UCHAR Green; - UCHAR Blue; -} PALETTE_ENTRY, *PPALETTE_ENTRY; -#include <poppack.h> - -extern PVOID VideoOffScreenBuffer; - -USHORT BiosIsVesaSupported(VOID); // Implemented in i386vid.c, returns the VESA version -BOOLEAN BiosIsVesaDdcSupported(VOID); -BOOLEAN BiosVesaReadEdid(VOID); - -PVOID VideoAllocateOffScreenBuffer(VOID); // Returns a pointer to an off-screen buffer sufficient for the current video mode - -VOID VideoCopyOffScreenBufferToVRAM(VOID); - -VOID VideoSavePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount); -VOID VideoRestorePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount); - -VOID VideoSetAllColorsToBlack(ULONG ColorCount); -VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount); -VOID VideoFadeOut(ULONG ColorCount); diff --git a/boot/freeldr/freeldr/include/winldr.h b/boot/freeldr/freeldr/include/winldr.h deleted file mode 100644 index 7bd4b581f05..00000000000 --- a/boot/freeldr/freeldr/include/winldr.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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> - -// See freeldr/ntldr/winldr.h -#define TAG_WLDR_DTE 'eDlW' -#define TAG_WLDR_BDE 'dBlW' -#define TAG_WLDR_NAME 'mNlW' - - -// Some definitions - -// FIXME: This one has nothing to do here!! -#define SECTOR_SIZE 512 - -// 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; - -//////////////////////////////////////////////////////////////////////////////// -// -// ReactOS Loading Functions -// -//////////////////////////////////////////////////////////////////////////////// - -ARC_STATUS -LoadAndBootWindows( - IN ULONG Argc, - IN PCHAR Argv[], - IN PCHAR Envp[]); - -ARC_STATUS -LoadReactOSSetup( - IN ULONG Argc, - IN PCHAR Argv[], - IN PCHAR Envp[]); - - -// conversion.c and conversion.h -PVOID VaToPa(PVOID Va); -PVOID PaToVa(PVOID Pa); -VOID List_PaToVa(_In_ LIST_ENTRY *ListEntry); - - -// peloader.c -BOOLEAN -WinLdrLoadImage(IN PCHAR FileName, - TYPE_OF_MEMORY MemoryType, - OUT PVOID *ImageBasePA); - -BOOLEAN -WinLdrAllocateDataTableEntry(IN OUT PLIST_ENTRY ModuleListHead, - IN PCCH BaseDllName, - IN PCCH FullDllName, - IN PVOID BasePA, - OUT PLDR_DATA_TABLE_ENTRY *NewEntry); - -BOOLEAN -WinLdrScanImportDescriptorTable(IN OUT PLIST_ENTRY ModuleListHead, - IN PCCH DirectoryPath, - IN PLDR_DATA_TABLE_ENTRY ScanDTE); - -BOOLEAN -WinLdrCheckForLoadedDll(IN OUT PLIST_ENTRY ModuleListHead, - IN PCH DllName, - OUT PLDR_DATA_TABLE_ENTRY *LoadedEntry); - - -// arch/xxx/winldr.c -BOOLEAN -MempSetupPaging(IN PFN_NUMBER StartPage, - IN PFN_NUMBER NumberOfPages, - IN BOOLEAN KernelMapping); - -VOID -MempUnmapPage(PFN_NUMBER Page); - -VOID -MempDump(VOID); - -VOID -WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock); - -VOID -WinLdrSetProcessorContext(VOID); diff --git a/boot/freeldr/freeldr/cache/blocklist.c b/boot/freeldr/freeldr/lib/cache/blocklist.c similarity index 100% rename from boot/freeldr/freeldr/cache/blocklist.c rename to boot/freeldr/freeldr/lib/cache/blocklist.c diff --git a/boot/freeldr/freeldr/cache/cache.c b/boot/freeldr/freeldr/lib/cache/cache.c similarity index 100% rename from boot/freeldr/freeldr/cache/cache.c rename to boot/freeldr/freeldr/lib/cache/cache.c diff --git a/boot/freeldr/freeldr/lib/peloader.c b/boot/freeldr/freeldr/lib/peloader.c index 7f913f1c8d6..cf90eb851e7 100644 --- a/boot/freeldr/freeldr/lib/peloader.c +++ b/boot/freeldr/freeldr/lib/peloader.c @@ -1,27 +1,30 @@ /* - * PROJECT: FreeLoader - * LICENSE: GPL - See COPYING in the top level directory - * FILE: boot/freeldr/freeldr/windows/peloader.c - * PURPOSE: Provides routines for loading PE files. - * (Deprecated remark) To be merged with arch/i386/loader.c in future. + * PROJECT: FreeLoader + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: Provides routines for loading PE files. + * (Deprecated remark) To be merged with arch/i386/loader.c in future. * - * PROGRAMMERS: Aleksey Bragin (aleksey@reactos.org) + * COPYRIGHT: Copyright 1998-2003 Brian Palmer brianp@sginet.com + * Copyright 2006-2019 Aleksey Bragin aleksey@reactos.org * - * The source code in this file is based on the work of respective - * authors of PE loading code in ReactOS and Brian Palmer and - * Alex Ionescu's arch/i386/loader.c, and my research project - * (creating a native EFI loader for Windows). + * NOTES: The source code in this file is based on the work of respective + * authors of PE loading code in ReactOS and Brian Palmer and + * Alex Ionescu's arch/i386/loader.c, and my research project + * (creating a native EFI loader for Windows). * - * NOTE: This article was very handy during development: - * http://msdn.microsoft.com/msdnmag/issues/02/03/PE2/ + * This article was very handy during development: + * http://msdn.microsoft.com/msdnmag/issues/02/03/PE2/ */
/* INCLUDES ***************************************************************/ + #include <freeldr.h> #include <debug.h>
DBG_DEFAULT_CHANNEL(PELOADER);
+/* FUNCTIONS **************************************************************/ + static BOOLEAN WinLdrpCompareDllName(IN PCH DllName, IN PUNICODE_STRING UnicodeName); @@ -50,9 +53,6 @@ WinLdrpScanImportAddressTable(IN OUT PLIST_ENTRY ModuleListHead, IN PCSTR DirectoryPath);
- -/* FUNCTIONS **************************************************************/ - /* Returns TRUE if DLL has already been loaded - looks in LoadOrderList in LPB */ BOOLEAN WinLdrCheckForLoadedDll(IN OUT PLIST_ENTRY ModuleListHead, diff --git a/boot/freeldr/freeldr/ntldr/arch/amd64/winldr.c b/boot/freeldr/freeldr/ntldr/arch/amd64/winldr.c index 784f0e6c5ee..9540c63370a 100644 --- a/boot/freeldr/freeldr/ntldr/arch/amd64/winldr.c +++ b/boot/freeldr/freeldr/ntldr/arch/amd64/winldr.c @@ -9,14 +9,14 @@ /* INCLUDES ***************************************************************/
#include <freeldr.h> - #include <ndk/asm.h> +#include "../../winldr.h" + #include <debug.h> +DBG_DEFAULT_CHANNEL(WINDOWS);
//extern ULONG LoaderPagesSpanned;
-DBG_DEFAULT_CHANNEL(WINDOWS); - /* GLOBALS ***************************************************************/
PHARDWARE_PTE PxeBase; diff --git a/boot/freeldr/freeldr/ntldr/arch/arm/winldr.c b/boot/freeldr/freeldr/ntldr/arch/arm/winldr.c index 5ca93f02bd5..0bb69147e37 100644 --- a/boot/freeldr/freeldr/ntldr/arch/arm/winldr.c +++ b/boot/freeldr/freeldr/ntldr/arch/arm/winldr.c @@ -12,6 +12,7 @@ #include <debug.h> #include <internal/arm/mm.h> #include <internal/arm/intrin_i.h> +#include "../../winldr.h"
#define PFN_SHIFT 12 #define LARGE_PFN_SHIFT 20 diff --git a/boot/freeldr/freeldr/ntldr/arch/i386/winldr.c b/boot/freeldr/freeldr/ntldr/arch/i386/winldr.c index 5e289d19dd7..c3917709b32 100644 --- a/boot/freeldr/freeldr/ntldr/arch/i386/winldr.c +++ b/boot/freeldr/freeldr/ntldr/arch/i386/winldr.c @@ -9,9 +9,11 @@ /* INCLUDES ***************************************************************/
#include <freeldr.h> - #include <ndk/asm.h> +#include "../../winldr.h" + #include <debug.h> +DBG_DEFAULT_CHANNEL(WINDOWS);
// This is needed because headers define wrong one for ReactOS #undef KIP0PCRADDRESS @@ -28,8 +30,6 @@ } GDTIDT; #pragma pack(4)
-DBG_DEFAULT_CHANNEL(WINDOWS); - /* GLOBALS ***************************************************************/
PHARDWARE_PTE PDE; diff --git a/boot/freeldr/freeldr/lib/inffile/inffile.c b/boot/freeldr/freeldr/ntldr/inffile.c similarity index 96% rename from boot/freeldr/freeldr/lib/inffile/inffile.c rename to boot/freeldr/freeldr/ntldr/inffile.c index 3ca695ee98a..950accbe8a8 100644 --- a/boot/freeldr/freeldr/lib/inffile/inffile.c +++ b/boot/freeldr/freeldr/ntldr/inffile.c @@ -1,33 +1,15 @@ /* - * ReactOS kernel - * Copyright (C) 2002,2003 ReactOS Team - * - * 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. - */ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS text-mode setup - * FILE: boot/freeldr/freeldr/lib/inffile/inffile.c - * PURPOSE: INF file parser that caches contents of INF file in memory - * PROGRAMMER: Royce Mitchell III - * Eric Kohl + * PROJECT: FreeLoader + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: INF file parser that caches contents of INF file in memory. + * COPYRIGHT: Copyright 2002-2006 Royce Mitchell III + * Copyright 2003-2019 Eric Kohl */
/* INCLUDES *****************************************************************/
#include <freeldr.h> +#include "inffile.h"
#define CONTROL_Z '\x1a' #define MAX_SECTION_NAME_LEN 255 diff --git a/boot/freeldr/freeldr/include/inffile.h b/boot/freeldr/freeldr/ntldr/inffile.h similarity index 64% rename from boot/freeldr/freeldr/include/inffile.h rename to boot/freeldr/freeldr/ntldr/inffile.h index 766f0125c70..be1ae482340 100644 --- a/boot/freeldr/freeldr/include/inffile.h +++ b/boot/freeldr/freeldr/ntldr/inffile.h @@ -1,28 +1,9 @@ /* - * ReactOS kernel - * Copyright (C) 2002, 2003 ReactOS Team - * - * 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. - */ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS text-mode setup - * FILE: boot/freeldr/freeldr/include/inffile.h - * PURPOSE: INF file parser that caches contents of INF file in memory - * PROGRAMMER: Royce Mitchell III - * Eric Kohl + * PROJECT: FreeLoader + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: INF file parser that caches contents of INF file in memory. + * COPYRIGHT: Copyright 2002-2006 Royce Mitchell III + * Copyright 2003-2019 Eric Kohl */
#pragma once diff --git a/boot/freeldr/freeldr/ntldr/setupldr.c b/boot/freeldr/freeldr/ntldr/setupldr.c index 95c70acb347..c1836fff223 100644 --- a/boot/freeldr/freeldr/ntldr/setupldr.c +++ b/boot/freeldr/freeldr/ntldr/setupldr.c @@ -1,32 +1,19 @@ /* - * FreeLoader - * - * Copyright (C) 2009 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. + * PROJECT: FreeLoader + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: Windows-compatible NT OS Setup Loader. + * COPYRIGHT: Copyright 2009-2019 Aleksey Bragin aleksey@reactos.org */
#include <freeldr.h> -#include "winldr.h" - #include <ndk/ldrtypes.h> #include <arc/setupblk.h> +#include "winldr.h" +#include "inffile.h"
#include <debug.h> - DBG_DEFAULT_CHANNEL(WINDOWS); + #define TAG_BOOT_OPTIONS 'pOtB'
// TODO: Move to .h diff --git a/boot/freeldr/freeldr/ntldr/winldr.c b/boot/freeldr/freeldr/ntldr/winldr.c index e68a6027e86..b114adbef27 100644 --- a/boot/freeldr/freeldr/ntldr/winldr.c +++ b/boot/freeldr/freeldr/ntldr/winldr.c @@ -1,30 +1,15 @@ /* - * 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. + * PROJECT: FreeLoader + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: Windows-compatible NT OS Loader. + * COPYRIGHT: Copyright 2006-2019 Aleksey Bragin aleksey@reactos.org */
#include <freeldr.h> +#include <ndk/ldrtypes.h> #include "winldr.h" #include "registry.h"
-#include <ndk/ldrtypes.h> - #include <debug.h> DBG_DEFAULT_CHANNEL(WINDOWS);
diff --git a/boot/freeldr/freeldr/ntldr/winldr.h b/boot/freeldr/freeldr/ntldr/winldr.h index 0471775304c..a2af29ff5a3 100644 --- a/boot/freeldr/freeldr/ntldr/winldr.h +++ b/boot/freeldr/freeldr/ntldr/winldr.h @@ -1,47 +1,23 @@ /* - * 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. + * PROJECT: FreeLoader + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: Windows-compatible NT OS Loader. + * COPYRIGHT: Copyright 2006-2019 Aleksey Bragin aleksey@reactos.org */
#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 +/* Descriptors */ #define NUM_GDT 128 // Must be 128 #define NUM_IDT 0x100 // Only 16 are used though. Must be 0x100
+#if 0 + #include <pshpack1.h> typedef struct /* Root System Descriptor Pointer */ { @@ -149,3 +125,21 @@ LoadAndBootWindowsCommon( PCSTR BootOptions, PCSTR BootPath, BOOLEAN Setup); + +VOID +WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock); + +VOID +WinLdrSetProcessorContext(VOID); + +// arch/xxx/winldr.c +BOOLEAN +MempSetupPaging(IN PFN_NUMBER StartPage, + IN PFN_NUMBER NumberOfPages, + IN BOOLEAN KernelMapping); + +VOID +MempUnmapPage(PFN_NUMBER Page); + +VOID +MempDump(VOID); diff --git a/boot/freeldr/freeldr/video/fade.c b/boot/freeldr/freeldr/ui/video.c similarity index 56% rename from boot/freeldr/freeldr/video/fade.c rename to boot/freeldr/freeldr/ui/video.c index 439718ab5d4..d44f8ee1eed 100644 --- a/boot/freeldr/freeldr/video/fade.c +++ b/boot/freeldr/freeldr/ui/video.c @@ -1,35 +1,72 @@ /* - * FreeLoader - * Copyright (C) 1998-2003 Brian Palmer brianp@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. + * PROJECT: FreeLoader + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: UI Video helpers for special effects. + * COPYRIGHT: Copyright 1998-2003 Brian Palmer brianp@sginet.com */ + #ifndef _M_ARM #include <freeldr.h>
-#define RGB_MAX 64 -#define RGB_MAX_PER_ITERATION 64 -#define TAG_PALETTE_COLORS 'claP' +#define RGB_MAX 64 +#define RGB_MAX_PER_ITERATION 64 +#define TAG_PALETTE_COLORS 'claP' + +static PVOID VideoOffScreenBuffer = NULL; + +PVOID VideoAllocateOffScreenBuffer(VOID) +{ + ULONG BufferSize; + + if (VideoOffScreenBuffer != NULL) + { + MmFreeMemory(VideoOffScreenBuffer); + VideoOffScreenBuffer = NULL; + } + + BufferSize = MachVideoGetBufferSize(); + + VideoOffScreenBuffer = MmAllocateMemoryWithType(BufferSize, LoaderFirmwareTemporary); + + return VideoOffScreenBuffer; +} + +VOID VideoCopyOffScreenBufferToVRAM(VOID) +{ + MachVideoCopyOffScreenBufferToVRAM(VideoOffScreenBuffer); +} + + +VOID VideoSavePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount) +{ + ULONG Color; + + for (Color = 0; Color < ColorCount; Color++) + { + MachVideoGetPaletteColor((UCHAR)Color, &Palette[Color].Red, &Palette[Color].Green, &Palette[Color].Blue); + } +} + +VOID VideoRestorePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount) +{ + ULONG Color; + + MachVideoSync(); + + for (Color = 0; Color < ColorCount; Color++) + { + MachVideoSetPaletteColor((UCHAR)Color, Palette[Color].Red, Palette[Color].Green, Palette[Color].Blue); + } +} +
VOID VideoSetAllColorsToBlack(ULONG ColorCount) { - UCHAR Color; + UCHAR Color;
MachVideoSync();
- for (Color=0; Color<ColorCount; Color++) + for (Color = 0; Color < ColorCount; Color++) { MachVideoSetPaletteColor(Color, 0, 0, 0); } @@ -37,17 +74,16 @@ VOID VideoSetAllColorsToBlack(ULONG ColorCount)
VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount) { - ULONG Index; - UCHAR Color; - PPALETTE_ENTRY PaletteColors; + ULONG Index; + UCHAR Color; + PPALETTE_ENTRY PaletteColors;
PaletteColors = FrLdrTempAlloc(sizeof(PALETTE_ENTRY) * ColorCount, TAG_PALETTE_COLORS); if (!PaletteColors) return;
- for (Index=0; Index<RGB_MAX; Index++) + for (Index = 0; Index < RGB_MAX; Index++) { - - for (Color=0; Color<ColorCount; Color++) + for (Color = 0; Color < ColorCount; Color++) { MachVideoGetPaletteColor(Color, &PaletteColors[Color].Red, &PaletteColors[Color].Green, &PaletteColors[Color].Blue);
@@ -81,7 +117,7 @@ VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount) }
// Set the colors - for (Color=0; Color<ColorCount; Color++) + for (Color = 0; Color < ColorCount; Color++) { if ((Color % RGB_MAX_PER_ITERATION) == 0) { @@ -97,15 +133,15 @@ VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount)
VOID VideoFadeOut(ULONG ColorCount) { - ULONG Index; - UCHAR Color; - UCHAR Red; - UCHAR Green; - UCHAR Blue; + ULONG Index; + UCHAR Color; + UCHAR Red; + UCHAR Green; + UCHAR Blue;
- for (Index=0; Index<RGB_MAX; Index++) + for (Index = 0; Index < RGB_MAX; Index++) { - for (Color=0; Color<ColorCount; Color++) + for (Color = 0; Color < ColorCount; Color++) { if ((Color % RGB_MAX_PER_ITERATION) == 0) { @@ -131,4 +167,5 @@ VOID VideoFadeOut(ULONG ColorCount) } } } + #endif diff --git a/boot/freeldr/freeldr/video/palette.c b/boot/freeldr/freeldr/video/palette.c deleted file mode 100644 index 5c9d0edf149..00000000000 --- a/boot/freeldr/freeldr/video/palette.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * FreeLoader - * Copyright (C) 1998-2003 Brian Palmer brianp@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. - */ -#ifndef _M_ARM -#include <freeldr.h> -VOID VideoSavePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount) -{ - ULONG Color; - - for (Color=0; Color<ColorCount; Color++) - { - MachVideoGetPaletteColor((UCHAR)Color, &Palette[Color].Red, &Palette[Color].Green, &Palette[Color].Blue); - } -} - -VOID VideoRestorePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount) -{ - ULONG Color; - - MachVideoSync(); - - for (Color=0; Color<ColorCount; Color++) - { - MachVideoSetPaletteColor((UCHAR)Color, Palette[Color].Red, Palette[Color].Green, Palette[Color].Blue); - } -} -#endif diff --git a/boot/freeldr/freeldr/video/video.c b/boot/freeldr/freeldr/video/video.c deleted file mode 100644 index ef1203edee2..00000000000 --- a/boot/freeldr/freeldr/video/video.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * FreeLoader - * Copyright (C) 1998-2003 Brian Palmer brianp@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. - */ -#ifndef _M_ARM -#include <freeldr.h> - -PVOID VideoOffScreenBuffer = NULL; - -PVOID VideoAllocateOffScreenBuffer(VOID) -{ - ULONG BufferSize; - - if (VideoOffScreenBuffer != NULL) - { - MmFreeMemory(VideoOffScreenBuffer); - VideoOffScreenBuffer = NULL; - } - - BufferSize = MachVideoGetBufferSize(); - - VideoOffScreenBuffer = MmAllocateMemoryWithType(BufferSize, LoaderFirmwareTemporary); - - return VideoOffScreenBuffer; -} - -VOID VideoCopyOffScreenBufferToVRAM(VOID) -{ - MachVideoCopyOffScreenBufferToVRAM(VideoOffScreenBuffer); -} -#endif