[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.
This commit is contained in:
Hermès Bélusca-Maïto 2019-08-11 18:56:40 +02:00
parent e125297f7f
commit fba4ad4ceb
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
24 changed files with 292 additions and 445 deletions

View file

@ -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")

View file

@ -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)
{

View file

@ -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>

View file

@ -19,6 +19,9 @@
#pragma once
// FIXME: This one has nothing to do here!!
#define SECTOR_SIZE 512
typedef struct tagDEVVTBL
{
ARC_CLOSE Close;

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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,

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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);

View file

@ -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);

View file

@ -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'
VOID VideoSetAllColorsToBlack(ULONG ColorCount)
static PVOID VideoOffScreenBuffer = NULL;
PVOID VideoAllocateOffScreenBuffer(VOID)
{
UCHAR Color;
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++)
for (Color = 0; Color < ColorCount; Color++)
{
MachVideoSetPaletteColor((UCHAR)Color, Palette[Color].Red, Palette[Color].Green, Palette[Color].Blue);
}
}
VOID VideoSetAllColorsToBlack(ULONG ColorCount)
{
UCHAR Color;
MachVideoSync();
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

View file

@ -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

View file

@ -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