summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-03 10:07:06 +0100
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-03 10:07:06 +0100
commitbb83659cf509f659cf1dd2e4ad239a32ad9ce119 (patch)
tree9ed0cd541fd4ad7738ea3b3a5c108f9f6e32cadc
parent275c162c7c270499408ee4cbdd8f24b6d0240117 (diff)
WiP: See below.
- GetDevicePathSize - IsDevicePathValid - DuplicateDevicePath - Fix kernel build on MinGW-gcc. - Will also work on kernel disk bootstrap drivers (ATA, NVME). - Add compile_flags.txt for drivers to lint correctly. Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
-rw-r--r--Drivers/AHCI/compile_flags.txt4
-rw-r--r--Drivers/Ethernet/compile_flags.txt4
-rw-r--r--Drivers/NVME/.gitkeep0
-rw-r--r--Drivers/NVME/compile_flags.txt4
-rw-r--r--Drivers/WiFi/compile_flags.txt4
-rw-r--r--Drivers/XHCI/Defines.hxx (renamed from Drivers/XHCI/USBRegs.hxx)9
-rw-r--r--Drivers/XHCI/compile_flags.txt4
-rw-r--r--Private/EFIKit/Api.hxx11
-rw-r--r--Private/EFIKit/EFI.hxx12
-rw-r--r--Private/EFIKit/EPM.hxx3
-rw-r--r--Private/KernelKit/CodeManager.hpp2
-rw-r--r--Private/KernelKit/PEF.hpp22
-rw-r--r--Private/NewBoot/BootKit/BootKit.hxx14
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/AMD64-BootKit.cxx102
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/AMD64-Main.cxx9
-rw-r--r--Private/NewBoot/Source/Utils.cxx174
-rw-r--r--Private/NewBoot/Source/makefile2
-rw-r--r--Private/Source/RuntimeMain.cxx2
-rw-r--r--Private/Source/Storage/ATA.cxx2
19 files changed, 255 insertions, 129 deletions
diff --git a/Drivers/AHCI/compile_flags.txt b/Drivers/AHCI/compile_flags.txt
new file mode 100644
index 00000000..545816fc
--- /dev/null
+++ b/Drivers/AHCI/compile_flags.txt
@@ -0,0 +1,4 @@
+-I./
+-I../
+-I../../Private
+-std=c++20
diff --git a/Drivers/Ethernet/compile_flags.txt b/Drivers/Ethernet/compile_flags.txt
new file mode 100644
index 00000000..545816fc
--- /dev/null
+++ b/Drivers/Ethernet/compile_flags.txt
@@ -0,0 +1,4 @@
+-I./
+-I../
+-I../../Private
+-std=c++20
diff --git a/Drivers/NVME/.gitkeep b/Drivers/NVME/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/Drivers/NVME/.gitkeep
diff --git a/Drivers/NVME/compile_flags.txt b/Drivers/NVME/compile_flags.txt
new file mode 100644
index 00000000..545816fc
--- /dev/null
+++ b/Drivers/NVME/compile_flags.txt
@@ -0,0 +1,4 @@
+-I./
+-I../
+-I../../Private
+-std=c++20
diff --git a/Drivers/WiFi/compile_flags.txt b/Drivers/WiFi/compile_flags.txt
new file mode 100644
index 00000000..6e721e73
--- /dev/null
+++ b/Drivers/WiFi/compile_flags.txt
@@ -0,0 +1,4 @@
+-I./
+-I../
+-I../../../Private
+-std=c++20
diff --git a/Drivers/XHCI/USBRegs.hxx b/Drivers/XHCI/Defines.hxx
index 5ef2ee2e..38ca7853 100644
--- a/Drivers/XHCI/USBRegs.hxx
+++ b/Drivers/XHCI/Defines.hxx
@@ -2,20 +2,19 @@
Copyright Mahrouss Logic
- File: USBRegs.hxx
- Purpose: USB registers
+ File: Defines.hxx
+ Purpose: XHCI (and backwards) defines.
Revision History:
01/02/24: Added file (amlel)
+ 03/02/24: Update filename to Defines.hxx (amlel)
------------------------------------------- */
#pragma once
-typedef __UINT16_TYPE__ UInt16;
-typedef __UINT32_TYPE__ UInt32;
-typedef __UINT8_TYPE__ UInt8;
+#include <NewKit/Defines.hpp>
#define kUSBCommand (UInt16)0x0
#define kUSBStatus (UInt16)0x2
diff --git a/Drivers/XHCI/compile_flags.txt b/Drivers/XHCI/compile_flags.txt
new file mode 100644
index 00000000..545816fc
--- /dev/null
+++ b/Drivers/XHCI/compile_flags.txt
@@ -0,0 +1,4 @@
+-I./
+-I../
+-I../../Private
+-std=c++20
diff --git a/Private/EFIKit/Api.hxx b/Private/EFIKit/Api.hxx
index 031c38e7..927d2f6f 100644
--- a/Private/EFIKit/Api.hxx
+++ b/Private/EFIKit/Api.hxx
@@ -30,15 +30,14 @@ inline Void Stop() noexcept {
@brief Exit EFI API to let the OS load correctly.
Bascially frees everything we have in the EFI side.
*/
-inline void ExitBootServices(EfiSystemTable *SystemTable, UInt64 MapKey,
- EfiHandlePtr ImageHandle) noexcept {
- if (!SystemTable) return;
+inline void ExitBootServices(UInt64 MapKey, EfiHandlePtr ImageHandle) noexcept {
+ if (!ST) return;
- SystemTable->BootServices->ExitBootServices(ImageHandle, MapKey);
+ ST->BootServices->ExitBootServices(ImageHandle, MapKey);
}
} // namespace EFI
-inline void KeInitEFI(EfiSystemTable *SystemTable) noexcept {
+inline void InitEFI(EfiSystemTable *SystemTable) noexcept {
if (!SystemTable) return;
ST = SystemTable;
@@ -52,7 +51,7 @@ inline void KeRuntimeStop(const EfiCharType *ErrorCode,
const EfiCharType *Reason) noexcept {
ST->ConOut->OutputString(ST->ConOut, L"*** STOP ***\r\n");
- ST->ConOut->OutputString(ST->ConOut, L"*** ErrorCode: ");
+ ST->ConOut->OutputString(ST->ConOut, L"*** Error: ");
ST->ConOut->OutputString(ST->ConOut, ErrorCode);
ST->ConOut->OutputString(ST->ConOut, L", Reason: ");
ST->ConOut->OutputString(ST->ConOut, Reason);
diff --git a/Private/EFIKit/EFI.hxx b/Private/EFIKit/EFI.hxx
index f59917f2..cc4f5581 100644
--- a/Private/EFIKit/EFI.hxx
+++ b/Private/EFIKit/EFI.hxx
@@ -66,6 +66,9 @@ typedef UInt64(EFI_API *EfiCopyMem)(VoidPtr DstBuf, VoidPtr SrcBuf,
SizeT Length);
typedef UInt64(EFI_API *EfiSetMem)(VoidPtr DstBuf, Char Byte, SizeT Length);
+typedef UInt64(EFI_API *EfiHandleProtocol)(EfiHandlePtr Handle, EfiGUID *Guid,
+ VoidPtr *Device);
+
typedef UInt64(EFI_API *EfiLocateDevicePath)(EfiGUID *Protocol,
EfiDevicePathProtocol **DevicePath,
EfiHandlePtr Device);
@@ -260,6 +263,13 @@ typedef struct EfiTableHeader {
} \
}
+#define EFI_DEVICE_PATH_PROTOCOL_GUID \
+ { \
+ 0x9576e91, 0x6d3f, 0x11d2, { \
+ 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b \
+ } \
+ }
+
typedef UInt64(EfiImageUnload)(EfiHandlePtr ImageHandle);
typedef struct EfiLoadImageProtocol {
@@ -370,7 +380,7 @@ typedef struct EfiBootServices {
UIntPtr InstallProtocolInterface;
UIntPtr ReinstallProtocolInterface;
UIntPtr UninstallProtocolInterface;
- UIntPtr HandleProtocol;
+ EfiHandleProtocol HandleProtocol;
VoidPtr Reserved;
UIntPtr RegisterProtocolNotify;
UIntPtr LocateHandle;
diff --git a/Private/EFIKit/EPM.hxx b/Private/EFIKit/EPM.hxx
index 8c74d533..dba8a9b7 100644
--- a/Private/EFIKit/EPM.hxx
+++ b/Private/EFIKit/EPM.hxx
@@ -9,8 +9,7 @@
/**
@brief The Explicit Partition Map use is to tell how many NewFS and other
- EPM compatible fs. We have in this computer.
-
+ EPM compatible Filesystems. We have in this computer.
*/
#ifndef __PARTITION_MAP__
diff --git a/Private/KernelKit/CodeManager.hpp b/Private/KernelKit/CodeManager.hpp
index fcb0d46b..0274b92e 100644
--- a/Private/KernelKit/CodeManager.hpp
+++ b/Private/KernelKit/CodeManager.hpp
@@ -14,5 +14,5 @@
#pragma once
#include <KernelKit/PEFCodeManager.hxx>
-// #include <KernelKit/PECodeManager.hpp>
+// #include <KernelKit/PECodeManager.hxx>
#include <KernelKit/PEFSharedObject.hxx>
diff --git a/Private/KernelKit/PEF.hpp b/Private/KernelKit/PEF.hpp
index 0cee2e90..1add45f8 100644
--- a/Private/KernelKit/PEF.hpp
+++ b/Private/KernelKit/PEF.hpp
@@ -1,11 +1,15 @@
-/*
- * ========================================================
- *
- * HCore
- * Copyright Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+ File: PEF.hpp
+ Purpose: Preferred Executable Format for HCore.
+
+ Revision History:
+
+ ?/?/23: Added file (amlel)
+
+------------------------------------------- */
#ifndef __PEF__
#define __PEF__
@@ -22,7 +26,7 @@
#define kPefVersion 1
#define kPefNameLen 64
-/// @brief Preferred Executable Format, a format designed
+/// @brief Preferred Executable Format, a format designed
/// for RISC/CISC Von-neumann processor types.
/// The PEF also uses the x64 PE calling convention and ABI.
diff --git a/Private/NewBoot/BootKit/BootKit.hxx b/Private/NewBoot/BootKit/BootKit.hxx
index 50b14928..0cbddfab 100644
--- a/Private/NewBoot/BootKit/BootKit.hxx
+++ b/Private/NewBoot/BootKit/BootKit.hxx
@@ -56,15 +56,15 @@ HCore::SizeT BSetMem(CharacterType *src, const CharacterType byte,
const HCore::SizeT len);
/**
- * @brief BootKit File Reader class
+ * @brief BootKit Image Reader class
* Reads using the UEFI Simple File protocol.
*/
-class BFileReader final {
+class BImageReader final {
public:
- explicit BFileReader(const CharacterType *path);
- ~BFileReader() = default;
+ explicit BImageReader(const CharacterType *path);
+ ~BImageReader() = default;
- HCore::VoidPtr ReadAll(SizeT &size);
+ HCore::VoidPtr Fetch(SizeT &size);
enum {
kOperationOkay,
@@ -78,8 +78,8 @@ class BFileReader final {
Int32 &Error() { return mErrorCode; }
public:
- BFileReader &operator=(const BFileReader &) = default;
- BFileReader(const BFileReader &) = default;
+ BImageReader &operator=(const BImageReader &) = default;
+ BImageReader(const BImageReader &) = default;
private:
Int32 mErrorCode{kOperationOkay};
diff --git a/Private/NewBoot/Source/HEL/AMD64/AMD64-BootKit.cxx b/Private/NewBoot/Source/HEL/AMD64/AMD64-BootKit.cxx
index 328e7bc9..8db6ae16 100644
--- a/Private/NewBoot/Source/HEL/AMD64/AMD64-BootKit.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/AMD64-BootKit.cxx
@@ -60,6 +60,9 @@ HCore::SizeT BSetMem(CharacterType *src, const CharacterType byte,
/////////////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+@brief puts wrapper over EFI.
+*/
BTextWriter &BTextWriter::WriteString(const CharacterType *str) {
if (*str == 0 || !str) return *this;
@@ -69,7 +72,7 @@ BTextWriter &BTextWriter::WriteString(const CharacterType *str) {
}
/**
-@brief putc wrapper over VGA.
+@brief putc wrapper over EFI.
*/
BTextWriter &BTextWriter::WriteCharacter(CharacterType c) {
EfiCharType str[2];
@@ -80,13 +83,13 @@ BTextWriter &BTextWriter::WriteCharacter(CharacterType c) {
return *this;
}
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
/***
@brief File Reader constructor.
*/
-BFileReader::BFileReader(const CharacterType *path) {
+BImageReader::BImageReader(const CharacterType *path) {
if (path != nullptr) {
SizeT index = 0UL;
for (; path[index] != L'\0'; ++index) {
@@ -101,97 +104,16 @@ BFileReader::BFileReader(const CharacterType *path) {
@brief this reads all of the buffer.
@param size, new buffer size.
*/
-HCore::VoidPtr BFileReader::ReadAll(SizeT &size) {
+HCore::VoidPtr BImageReader::Fetch(SizeT &size) {
BTextWriter writer;
- writer.WriteString(L"*** BFileReader::ReadAll: Reading ")
+ writer.WriteString(L"*** BImageReader::Fetch: Fetching... ")
.WriteString(mPath)
.WriteString(L" *** \r\n");
- EfiHandlePtr handleFile = nullptr;
- EfiLoadFileProtocol *loadFile = nullptr;
-
- EfiGUID loadFileGUID = EfiGUID(EFI_LOAD_FILE_PROTOCOL_GUID);
-
- BS->LocateProtocol(&loadFileGUID, nullptr, (VoidPtr *)&loadFile);
-
- if (loadFile) {
- writer.WriteString(L"HCoreLdr: Loading: ")
- .WriteString(mPath)
- .WriteString(L"\r\n");
-
- UInt32 *bufSz = nullptr;
- VoidPtr buf = nullptr;
-
- BS->AllocatePool(EfiLoaderCode, sizeof(UInt32), (VoidPtr *)&bufSz);
- *bufSz = KIB(324);
-
- if (!bufSz) {
- return nullptr;
- }
-
- BS->AllocatePool(EfiLoaderCode, *bufSz, &buf);
-
- if (!buf) {
- BS->FreePool(bufSz);
- bufSz = nullptr;
-
- return nullptr;
- }
-
- EfiFileDevicePathProtocol filePath{0};
-
- filePath.Proto.Length[0] = sizeof(EfiDevicePathProtocol) + BStrLen(mPath);
- filePath.Proto.Length[1] = 0;
-
- filePath.Proto.Type = kEFIMediaDevicePath;
- filePath.Proto.SubType = kEFIMediaDevicePath; // from all drives.
-
- BCopyMem(filePath.Path, mPath, BStrLen(mPath));
-
- auto err = loadFile->LoadFile(loadFile, &filePath, true, bufSz, buf);
-
- size = *bufSz;
-
- if (err == kEfiOk) {
- writer.WriteString(L"HCoreLdr: Loaded: ")
- .WriteString(mPath)
- .WriteString(L"\r\n");
- } else {
- BS->FreePool(buf);
- buf = nullptr;
-
- switch (err) {
- case 2: {
- writer.WriteString(L"HCoreLdr: Error: ")
- .WriteString(mPath)
- .WriteString(L", EFI-Code: Invalid-Parameter")
- .WriteString(L"\r\n");
-
- break;
- }
- case 14: {
- writer.WriteString(L"HCoreLdr: Error: ")
- .WriteString(mPath)
- .WriteString(L", EFI-Code: Not-Found")
- .WriteString(L"\r\n");
-
- break;
- }
- default: {
- writer.WriteString(L"HCoreLdr: Error: ")
- .WriteString(mPath)
- .WriteString(L", EFI-Code: Unknown-Error")
- .WriteString(L"\r\n");
-
- break;
- }
- }
- }
-
- BS->FreePool(bufSz);
- bufSz = nullptr;
+ EfiLoadImageProtocol *proto = nullptr;
+ EfiGUID guidImg = EfiGUID(EFI_LOADED_IMAGE_PROTOCOL_GUID);
- return buf;
+ if (BS->LocateProtocol(&guidImg, nullptr, (VoidPtr *)&proto) == kEfiOk) {
}
return nullptr;
diff --git a/Private/NewBoot/Source/HEL/AMD64/AMD64-Main.cxx b/Private/NewBoot/Source/HEL/AMD64/AMD64-Main.cxx
index d7583873..c2631a6f 100644
--- a/Private/NewBoot/Source/HEL/AMD64/AMD64-Main.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/AMD64-Main.cxx
@@ -17,7 +17,7 @@
EFI_EXTERN_C int EfiMain(EfiHandlePtr ImageHandle,
EfiSystemTable* SystemTable) {
- KeInitEFI(SystemTable);
+ InitEFI(SystemTable);
BTextWriter writer;
@@ -27,11 +27,10 @@ EFI_EXTERN_C int EfiMain(EfiHandlePtr ImageHandle,
UInt64 mapKey = 0;
- BFileReader reader(L"HCoreKrnl.exe");
+ BImageReader img(L"HCoreKrnl.exe");
SizeT sz = 0UL;
-
- PEImagePtr blob = (PEImagePtr)reader.ReadAll(sz);
+ PEImagePtr blob = (PEImagePtr)img.Fetch(sz);
if (!blob || sz < 1)
KeRuntimeStop(L"HCoreLdr_NoSuchKernel", L"Couldn't find HCoreKrnl.exe!");
@@ -40,11 +39,11 @@ EFI_EXTERN_C int EfiMain(EfiHandlePtr ImageHandle,
if (blob[0] == kMagMz0 && blob[1] == kMagMz1) {
writer.WriteString(L"HCoreLdr: Running HCoreKrnl.exe...\r\n");
+ /// Load Image here
} else {
KeRuntimeStop(L"HCoreLdr_NotPE", L"Not a PE file! Aborting...");
}
- EFI::ExitBootServices(SystemTable, mapKey, ImageHandle);
EFI::Stop();
return kEfiOk;
diff --git a/Private/NewBoot/Source/Utils.cxx b/Private/NewBoot/Source/Utils.cxx
new file mode 100644
index 00000000..c51a87d6
--- /dev/null
+++ b/Private/NewBoot/Source/Utils.cxx
@@ -0,0 +1,174 @@
+/*
+ * ========================================================
+ *
+ * NewBoot
+ * Copyright Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#include <BootKit/BootKit.hxx>
+#include <EFIKit/Api.hxx>
+#include <EFIKit/EFI.hxx>
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// @brief External EFI code for completeness.
+//
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace Detail {
+const EfiDevicePathProtocol mUefiDevicePathLibEndDevicePath = {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ {sizeof(EfiDevicePathProtocol), 0}};
+
+EfiDevicePathProtocol *UefiDevicePathLibAppendDevicePath(
+ const EfiDevicePathProtocol *FirstDevicePath,
+ const EfiDevicePathProtocol *SecondDevicePath) {
+ SizeT Size;
+ SizeT Size1;
+ SizeT Size2;
+ EfiDevicePathProtocol *NewDevicePath;
+ EfiDevicePathProtocol *DevicePath2;
+
+ //
+ // If there's only 1 path, just duplicate it.
+ //
+ if (FirstDevicePath == nullptr) {
+ return DuplicateDevicePath((SecondDevicePath != nullptr)
+ ? SecondDevicePath
+ : &mUefiDevicePathLibEndDevicePath);
+ }
+
+ if (SecondDevicePath == nullptr) {
+ return DuplicateDevicePath(FirstDevicePath);
+ }
+
+ if (!IsDevicePathValid(FirstDevicePath, 0) ||
+ !IsDevicePathValid(SecondDevicePath, 0)) {
+ return nullptr;
+ }
+
+ //
+ // Allocate space for the combined device path. It only has one end node of
+ // length EFI_DEVICE_PATH_PROTOCOL.
+ //
+ Size1 = GetDevicePathSize(FirstDevicePath);
+ Size2 = GetDevicePathSize(SecondDevicePath);
+ Size = Size1 + Size2 - sizeof(EfiDevicePathProtocol);
+
+ BS->AllocatePool(EfiLoaderData, Size, (VoidPtr *)&NewDevicePath);
+
+ if (NewDevicePath != NULL) {
+ BCopyMem((CharacterType *)NewDevicePath, (CharacterType *)FirstDevicePath,
+ Size1);
+ //
+ // Over write FirstDevicePath EndNode and do the copy
+ //
+ DevicePath2 =
+ (EfiDevicePathProtocol *)((Char *)NewDevicePath +
+ (Size1 - sizeof(EfiDevicePathProtocol)));
+ BCopyMem((CharacterType *)DevicePath2, (CharacterType *)SecondDevicePath,
+ Size2);
+ }
+
+ return NewDevicePath;
+}
+
+EfiDevicePathProtocol *AppendDevicePath(
+ EfiDevicePathProtocol *FirstDevicePath,
+ EfiDevicePathProtocol *SecondDevicePath) {
+ return UefiDevicePathLibAppendDevicePath(FirstDevicePath, SecondDevicePath);
+}
+
+EfiDevicePathProtocol *EFI_API DevicePathFromHandle(EfiHandlePtr Handle) {
+ EfiDevicePathProtocol *DevicePath;
+ UInt64 Status;
+
+ EfiGUID guid = EfiGUID(EFI_DEVICE_PATH_PROTOCOL_GUID);
+
+ Status = BS->HandleProtocol(Handle, &guid, (VoidPtr *)&DevicePath);
+ if (Status != kEfiOk) {
+ DevicePath = nullptr;
+ }
+
+ return DevicePath;
+}
+
+UInt16 ReadUnaligned16(UInt16 *Buffer) {
+ // ASSERT (Buffer != NULL);
+ return *Buffer;
+}
+
+UInt16 WriteUnaligned16(UInt16 *Buffer, UInt16 Value) {
+ // ASSERT (Buffer != NULL);
+
+ return *Buffer = Value;
+}
+
+UInt16 EFI_API SetDevicePathNodeLength(Void *Node, UInt32 Length) {
+ // ASSERT(Node != nullptr);
+ // ASSERT((Length >= sizeof(EfiDevicePathProtocol)) && (Length < KIB(64)));
+ return WriteUnaligned16(
+ (UInt16 *)&((EfiDevicePathProtocol *)(Node))->Length[0],
+ (UInt16)(Length));
+}
+
+Void EFI_API SetDevicePathEndNode(Void *Node) {
+ // ASSERT(Node != NULL);
+ BCopyMem((CharacterType *)Node,
+ (CharacterType *)&mUefiDevicePathLibEndDevicePath,
+ sizeof(mUefiDevicePathLibEndDevicePath));
+}
+
+UInt32 EFI_API DevicePathNodeLength(const Void *Node) {
+ // ASSERT(Node != NULL);
+ return ReadUnaligned16(
+ (UInt16 *)&((EfiDevicePathProtocol *)(Node))->Length[0]);
+}
+
+EfiDevicePathProtocol *EFI_API NextDevicePathNode(Void *Node) {
+ // ASSERT (Node != NULL);
+ return (EfiDevicePathProtocol *)((UInt8 *)(Node) +
+ DevicePathNodeLength(Node));
+}
+
+EfiDevicePathProtocol *EFI_API FileDevicePath(EfiHandlePtr Device,
+ CharacterType *FileName) {
+ SizeT Size;
+ EfiFileDevicePathProtocol *FilePath;
+ EfiDevicePathProtocol *DevicePath;
+ EfiDevicePathProtocol *FileDevicePath;
+
+ DevicePath = nullptr;
+
+ Size = BStrLen(FileName);
+ BS->AllocatePool(
+ EfiLoaderData,
+ Size + sizeof(EfiFileDevicePathProtocol) + sizeof(EfiDevicePathProtocol),
+ (VoidPtr *)&FileDevicePath);
+
+ if (FileDevicePath != nullptr) {
+ FilePath = (EfiFileDevicePathProtocol *)FileDevicePath;
+ FilePath->Proto.Type = kEFIMediaDevicePath;
+ FilePath->Proto.SubType = kEFIMediaDevicePath;
+
+ BCopyMem(FilePath->Path, FileName, Size);
+
+ SetDevicePathNodeLength(&FilePath->Proto,
+ Size + sizeof(EfiFileDevicePathProtocol));
+
+ SetDevicePathEndNode(NextDevicePathNode(&FilePath->Proto));
+
+ if (Device != nullptr) {
+ DevicePath = DevicePathFromHandle(Device);
+ }
+
+ DevicePath = AppendDevicePath(DevicePath, FileDevicePath);
+ BS->FreePool(FileDevicePath);
+ }
+
+ return DevicePath;
+}
+} // namespace Detail
diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile
index 0f679772..04b39516 100644
--- a/Private/NewBoot/Source/makefile
+++ b/Private/NewBoot/Source/makefile
@@ -14,7 +14,7 @@ invalid-recipe:
.PHONY: bootloader-amd64
bootloader-amd64:
- $(CC_GNU) $(FLAG_GNU) HEL/AMD64/*.cxx
+ $(CC_GNU) $(FLAG_GNU) HEL/AMD64/*.cxx *.cxx
$(LD_GNU) *.o -e efi_main -filealign:16 -shared --subsystem=10 -ffreestanding -o HCoreLdr.exe
cp HCoreLdr.exe CDROM/EFI/BOOT/BOOTX64.EFI
cp ../../HCoreKrnl.exe CDROM/EFI/BOOT/HCoreKrnl.exe
diff --git a/Private/Source/RuntimeMain.cxx b/Private/Source/RuntimeMain.cxx
index 0cbdac1c..e042fb82 100644
--- a/Private/Source/RuntimeMain.cxx
+++ b/Private/Source/RuntimeMain.cxx
@@ -8,7 +8,7 @@
*/
#include <ArchKit/ArchKit.hpp>
-#include <EFIKit/BootProtocol.hxx>
+#include <EFIKit/Handover.hxx>
#include <KernelKit/FileManager.hpp>
#include <KernelKit/PEFCodeManager.hxx>
#include <NewKit/Json.hpp>
diff --git a/Private/Source/Storage/ATA.cxx b/Private/Source/Storage/ATA.cxx
index 9d7a204e..7d8ce32f 100644
--- a/Private/Source/Storage/ATA.cxx
+++ b/Private/Source/Storage/ATA.cxx
@@ -11,7 +11,7 @@
#include <StorageKit/ATA.hpp>
//! @brief ATA DMA Driver
-//! mapped by UEFI.
+//! @todo: Rework into a proper ATA DMA.
/// bugs 0