reactos/boot/freeldr/freeldr/arch/uefi/uefisetup.c
Justin Miller ff3dadf89d
[FREELDR] Enable UEFI boot for x86 and amd64 (#5267)
Co-authored-by: Stanislav Motylkov <x86corez@gmail.com>
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>

- Allow to boot NT kernel on UEFI systems with our 2 primary supported architectures
- Implement remaining code needed to pass execution to x86 and amd64 kernels

CORE-11954
2023-10-11 12:45:08 -07:00

60 lines
2.2 KiB
C

/*
* PROJECT: FreeLoader UEFI Support
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Machine Setup
* COPYRIGHT: Copyright 2022 Justin Miller <justinmiller100@gmail.com>
*/
#include <uefildr.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(WARNING);
/* GLOBALS ********************************************************************/
extern EFI_SYSTEM_TABLE* GlobalSystemTable;
extern EFI_HANDLE GlobalImageHandle;
/* FUNCTIONS ******************************************************************/
VOID
MachInit(const char *CmdLine)
{
RtlZeroMemory(&MachVtbl, sizeof(MachVtbl));
MachVtbl.ConsPutChar = UefiConsPutChar;
MachVtbl.ConsKbHit = UefiConsKbHit;
MachVtbl.ConsGetCh = UefiConsGetCh;
MachVtbl.VideoClearScreen = UefiVideoClearScreen;
MachVtbl.VideoSetDisplayMode = UefiVideoSetDisplayMode;
MachVtbl.VideoGetDisplaySize = UefiVideoGetDisplaySize;
MachVtbl.VideoGetBufferSize = UefiVideoGetBufferSize;
MachVtbl.VideoGetFontsFromFirmware = UefiVideoGetFontsFromFirmware;
MachVtbl.VideoSetTextCursorPosition = UefiVideoSetTextCursorPosition;
MachVtbl.VideoHideShowTextCursor = UefiVideoHideShowTextCursor;
MachVtbl.VideoPutChar = UefiVideoPutChar;
MachVtbl.VideoCopyOffScreenBufferToVRAM = UefiVideoCopyOffScreenBufferToVRAM;
MachVtbl.VideoIsPaletteFixed = UefiVideoIsPaletteFixed;
MachVtbl.VideoSetPaletteColor = UefiVideoSetPaletteColor;
MachVtbl.VideoGetPaletteColor = UefiVideoGetPaletteColor;
MachVtbl.VideoSync = UefiVideoSync;
MachVtbl.Beep = UefiPcBeep;
MachVtbl.PrepareForReactOS = UefiPrepareForReactOS;
MachVtbl.GetMemoryMap = UefiMemGetMemoryMap;
MachVtbl.GetExtendedBIOSData = UefiGetExtendedBIOSData;
MachVtbl.GetFloppyCount = UefiGetFloppyCount;
MachVtbl.DiskReadLogicalSectors = UefiDiskReadLogicalSectors;
MachVtbl.DiskGetDriveGeometry = UefiDiskGetDriveGeometry;
MachVtbl.DiskGetCacheableBlockCount = UefiDiskGetCacheableBlockCount;
MachVtbl.GetTime = UefiGetTime;
MachVtbl.InitializeBootDevices = UefiInitializeBootDevices;
MachVtbl.HwDetect = UefiHwDetect;
MachVtbl.HwIdle = UefiHwIdle;
/* Setup GOP */
if (UefiInitalizeVideo() != EFI_SUCCESS)
{
ERR("Failed to setup GOP\n");
}
}