summaryrefslogtreecommitdiffhomepage
path: root/dev/boot/src
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-03-23 19:13:48 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-03-23 19:15:17 +0100
commita13e1c0911c0627184bc38f18c7fdda64447b3ad (patch)
tree073a62c09bf216e85a3f310376640fa1805147f9 /dev/boot/src
parent149fa096eb306d03686b3b67e813cf1a78e08cd0 (diff)
meta(kernel): Reworked repository's filesystem structure.
Removing useless parts of the project too. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/boot/src')
-rw-r--r--dev/boot/src/.gitkeep0
-rw-r--r--dev/boot/src/BootFileReader.cc206
-rw-r--r--dev/boot/src/BootString.cc92
-rw-r--r--dev/boot/src/BootSupport.cc82
-rw-r--r--dev/boot/src/BootTextWriter.cc169
-rw-r--r--dev/boot/src/BootThread.cc211
-rw-r--r--dev/boot/src/BootloaderRsrc.rsrc25
-rw-r--r--dev/boot/src/HEL/64X000/.gitkeep0
-rw-r--r--dev/boot/src/HEL/64X000/BootCB.S35
-rw-r--r--dev/boot/src/HEL/AMD64/BootAPI.S60
-rw-r--r--dev/boot/src/HEL/AMD64/BootATA.cc283
-rw-r--r--dev/boot/src/HEL/AMD64/BootEFI.cc316
-rw-r--r--dev/boot/src/HEL/AMD64/BootPlatform.cc106
-rw-r--r--dev/boot/src/HEL/AMD64/BootSATA.cc20
-rw-r--r--dev/boot/src/HEL/ARM64/.gitkeep0
-rw-r--r--dev/boot/src/HEL/ARM64/BootAPI.S12
-rw-r--r--dev/boot/src/HEL/ARM64/BootCB.S40
-rw-r--r--dev/boot/src/HEL/ARM64/BootEFI.cc220
-rw-r--r--dev/boot/src/HEL/ARM64/BootPlatform.cc37
-rw-r--r--dev/boot/src/HEL/POWER/.gitkeep0
-rw-r--r--dev/boot/src/HEL/POWER/BootCB.S34
-rw-r--r--dev/boot/src/New+Delete.cc60
-rw-r--r--dev/boot/src/Root/EFI/STARTUP.NSH2
23 files changed, 2010 insertions, 0 deletions
diff --git a/dev/boot/src/.gitkeep b/dev/boot/src/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/dev/boot/src/.gitkeep
diff --git a/dev/boot/src/BootFileReader.cc b/dev/boot/src/BootFileReader.cc
new file mode 100644
index 00000000..a2afbce5
--- /dev/null
+++ b/dev/boot/src/BootFileReader.cc
@@ -0,0 +1,206 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+ File: FileReader.cc
+ Purpose: New Boot FileReader,
+ Read complete file and store it in a buffer.
+
+------------------------------------------- */
+
+#include <BootKit/Platform.h>
+#include <BootKit/Protocol.h>
+#include <BootKit/BootKit.h>
+#include <FirmwareKit/Handover.h>
+#include <FirmwareKit/EFI/API.h>
+#include <modules/CoreGfx/TextMgr.h>
+
+/// @file BootFileReader
+/// @brief Bootloader File reader.
+/// BUGS: 0
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+///
+///
+/// @name BootFileReader class
+/// @brief Reads the file as a blob.
+///
+///
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/***
+ @brief File Reader constructor.
+*/
+Boot::BootFileReader::BootFileReader(const CharacterTypeUTF16* path,
+ EfiHandlePtr ImageHandle)
+{
+ if (path != nullptr)
+ {
+ SizeT index = 0UL;
+ for (; path[index] != L'\0'; ++index)
+ {
+ mPath[index] = path[index];
+ }
+
+ mPath[index] = 0;
+ }
+
+ /// Load protocols with their GUIDs.
+
+ EfiGUID guidEfp = EfiGUID(EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID);
+
+ EfiSimpleFilesystemProtocol* efp = nullptr;
+
+ EfiLoadImageProtocol* img = nullptr;
+ EfiGUID guidImg = EfiGUID(EFI_LOADED_IMAGE_PROTOCOL_GUID);
+
+ if (BS->HandleProtocol(ImageHandle, &guidImg, (void**)&img) != kEfiOk)
+ {
+ mWriter.Write(L"BootZ: Handle-Protocol: No-Such-Protocol").Write(L"\r");
+ this->mErrorCode = kNotSupported;
+ }
+
+ if (BS->HandleProtocol(img->DeviceHandle, &guidEfp, (void**)&efp) != kEfiOk)
+ {
+ mWriter.Write(L"BootZ: Handle-Protocol: No-Such-Protocol").Write(L"\r");
+ this->mErrorCode = kNotSupported;
+ return;
+ }
+
+ /// Start doing disk I/O
+
+ if (efp->OpenVolume(efp, &mRootFs) != kEfiOk)
+ {
+ mWriter.Write(L"BootZ: Fetch-Protocol: No-Such-Volume").Write(L"\r");
+ this->mErrorCode = kNotSupported;
+ return;
+ }
+
+ EfiFileProtocol* fileFs = nullptr;
+
+ if (mRootFs->Open(mRootFs, &fileFs, mPath, kEFIFileRead, kEFIReadOnly) !=
+ kEfiOk)
+ {
+ mWriter.Write(L"BootZ: Fetch-Protocol: No-Such-Path: ")
+ .Write(mPath)
+ .Write(L"\r");
+ this->mErrorCode = kNotSupported;
+
+ fb_render_string("BootZ: PLEASE RECOVER YOUR MINKRNL INSTALL.", 40, 10, RGB(0xFF, 0xFF, 0xFF));
+
+ mRootFs->Close(mRootFs);
+
+ return;
+ }
+
+ mSizeFile = 0;
+ mFile = fileFs;
+ mErrorCode = kOperationOkay;
+}
+
+Boot::BootFileReader::~BootFileReader()
+{
+ if (this->mFile)
+ {
+ this->mFile->Close(this->mFile);
+ this->mFile = nullptr;
+ }
+
+ if (this->mRootFs)
+ {
+ this->mRootFs->Close(this->mRootFs);
+ this->mRootFs = nullptr;
+ }
+
+ if (this->mBlob)
+ {
+ BS->FreePool(this->mBlob);
+ this->mBlob = nullptr;
+ }
+
+ BSetMem(this->mPath, 0, kPathLen);
+}
+
+/**
+ @brief Reads all of the file into a buffer.
+ @param **readUntil** size of file
+ @param **chunkToRead** chunk to read each time.
+*/
+Void Boot::BootFileReader::ReadAll(SizeT readUntil, SizeT chunkToRead, UIntPtr out_address)
+{
+ UInt32 szInfo = sizeof(EfiFileInfo);
+
+ EfiFileInfo newPtrInfo{};
+
+ EfiGUID kFileInfoGUID = EFI_FILE_INFO_GUID;
+
+ if (mFile->GetInfo(mFile, &kFileInfoGUID, &szInfo, &newPtrInfo) == kEfiOk)
+ {
+ readUntil = newPtrInfo.FileSize;
+ mWriter.Write(L"BootZ: File size: ").Write(readUntil).Write("\r");
+ }
+
+ if (readUntil == 0)
+ {
+ mErrorCode = kNotSupported;
+ return;
+ }
+
+ if (mBlob == nullptr)
+ {
+ if (!out_address)
+ {
+ if (auto err = BS->AllocatePool(EfiLoaderCode, readUntil, (VoidPtr*)&mBlob) !=
+ kEfiOk)
+ {
+ mWriter.Write(L"*** error: ").Write(err).Write(L" ***\r");
+ EFI::ThrowError(L"OutOfMemory", L"Out of memory.");
+ }
+ }
+ else
+ {
+ mBlob = (VoidPtr)out_address;
+ }
+ }
+
+ mWriter.Write(L"*** Bytes to read: ").Write(readUntil).Write(L" ***\r");
+
+ UInt64 bufSize = chunkToRead;
+ UInt64 szCnt = 0UL;
+
+ while (szCnt < readUntil)
+ {
+ auto res = mFile->Read(mFile, &bufSize, (VoidPtr)(&((Char*)mBlob)[szCnt]));
+
+ szCnt += bufSize;
+
+ if (res == kBufferTooSmall)
+ {
+ bufSize = chunkToRead;
+ }
+ }
+
+ mSizeFile = szCnt;
+ mErrorCode = kOperationOkay;
+}
+
+/// @brief error code getter.
+/// @return the error code.
+Int32& Boot::BootFileReader::Error()
+{
+ return mErrorCode;
+}
+
+/// @brief blob getter.
+/// @return the blob.
+VoidPtr Boot::BootFileReader::Blob()
+{
+ return mBlob;
+}
+
+/// @breif Size getter.
+/// @return the size of the file.
+UInt64& Boot::BootFileReader::Size()
+{
+ return mSizeFile;
+}
diff --git a/dev/boot/src/BootString.cc b/dev/boot/src/BootString.cc
new file mode 100644
index 00000000..194261d0
--- /dev/null
+++ b/dev/boot/src/BootString.cc
@@ -0,0 +1,92 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+ File: BootString.cc
+ Purpose: BootZ string library
+
+ Revision History:
+
+
+
+------------------------------------------- */
+
+#include <BootKit/Platform.h>
+#include <BootKit/Protocol.h>
+#include <BootKit/BootKit.h>
+
+/// BUGS: 0
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+NeOS::SizeT Boot::BCopyMem(CharacterTypeUTF16* dest, CharacterTypeUTF16* src, const NeOS::SizeT len)
+{
+ if (!dest || !src)
+ return 0;
+
+ SizeT index = 0UL;
+ for (; index < len; ++index)
+ {
+ dest[index] = src[index];
+ }
+
+ return index;
+}
+
+NeOS::SizeT Boot::BStrLen(const CharacterTypeUTF16* ptr)
+{
+ if (!ptr)
+ return 0;
+
+ NeOS::SizeT cnt = 0;
+
+ while (*ptr != (CharacterTypeUTF16)0)
+ {
+ ++ptr;
+ ++cnt;
+ }
+
+ return cnt;
+}
+
+NeOS::SizeT Boot::BSetMem(CharacterTypeUTF16* src, const CharacterTypeUTF16 byte, const NeOS::SizeT len)
+{
+ if (!src)
+ return 0;
+
+ NeOS::SizeT cnt = 0UL;
+
+ while (*src != 0)
+ {
+ if (cnt > len)
+ break;
+
+ *src = byte;
+ ++src;
+
+ ++cnt;
+ }
+
+ return cnt;
+}
+
+NeOS::SizeT Boot::BSetMem(CharacterTypeUTF8* src, const CharacterTypeUTF8 byte, const NeOS::SizeT len)
+{
+ if (!src)
+ return 0;
+
+ NeOS::SizeT cnt = 0UL;
+
+ while (*src != 0)
+ {
+ if (cnt > len)
+ break;
+
+ *src = byte;
+ ++src;
+
+ ++cnt;
+ }
+
+ return cnt;
+}
diff --git a/dev/boot/src/BootSupport.cc b/dev/boot/src/BootSupport.cc
new file mode 100644
index 00000000..4d808ddc
--- /dev/null
+++ b/dev/boot/src/BootSupport.cc
@@ -0,0 +1,82 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#include <BootKit/BootKit.h>
+#include <FirmwareKit/EFI/API.h>
+#include <FirmwareKit/EFI/EFI.h>
+#include <FirmwareKit/Handover.h>
+#include <BootKit/Support.h>
+#include <KernelKit/MSDOS.h>
+#include <KernelKit/PE.h>
+
+#ifdef __BOOTLDR_STANDALONE__
+
+/// @brief memset definition in C++.
+/// @param dst destination pointer.
+/// @param byte value to fill in.
+/// @param len length of of src.
+EXTERN_C VoidPtr memset(void* dst, int byte, long long unsigned int len)
+{
+ for (size_t i = 0UL; i < len; ++i)
+ {
+ ((int*)dst)[i] = byte;
+ }
+
+ return dst;
+}
+
+/// @brief memcpy definition in C++.
+/// @param dst destination pointer.
+/// @param src source pointer.
+/// @param len length of of src.
+EXTERN_C VoidPtr memcpy(void* dst, const void* src, long long unsigned int len)
+{
+ for (size_t i = 0UL; i < len; ++i)
+ {
+ ((int*)dst)[i] = ((int*)src)[i];
+ }
+
+ return dst;
+}
+
+/// @brief strlen definition in C++.
+EXTERN_C size_t strlen(const char* whatToCheck)
+{
+ SizeT len = 0;
+
+ while (whatToCheck[len] != 0)
+ {
+ ++len;
+ }
+
+ return len;
+}
+
+/// @brief strcmp definition in C++.
+EXTERN_C int strcmp(const char* whatToCheck, const char* whatToCheckRight)
+{
+ if (!whatToCheck || *whatToCheck == 0)
+ return 0;
+
+ SizeT len = 0;
+
+ while (whatToCheck[len] == whatToCheckRight[len])
+ {
+ if (whatToCheck[len] == 0)
+ return 0;
+
+ ++len;
+ }
+
+ return len;
+}
+
+/// @brief something specific to the Microsoft's ABI, When the stack grows too big.
+EXTERN_C void ___chkstk_ms(void)
+{
+}
+
+#endif
diff --git a/dev/boot/src/BootTextWriter.cc b/dev/boot/src/BootTextWriter.cc
new file mode 100644
index 00000000..b58d3429
--- /dev/null
+++ b/dev/boot/src/BootTextWriter.cc
@@ -0,0 +1,169 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+ File: BootTextWriter.cc
+ Purpose: BootZ string library
+
+ Revision History:
+
+
+
+------------------------------------------- */
+
+#include <FirmwareKit/EFI/API.h>
+#include <BootKit/Platform.h>
+#include <BootKit/Protocol.h>
+#include <BootKit/BootKit.h>
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+/// BUGS: 0 ///
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+@brief puts wrapper over EFI ConOut.
+*/
+Boot::BootTextWriter& Boot::BootTextWriter::Write(const CharacterTypeUTF16* str)
+{
+#ifdef __DEBUG__
+ if (!str || *str == 0)
+ return *this;
+
+ CharacterTypeUTF16 strTmp[2];
+ strTmp[1] = 0;
+
+ for (size_t i = 0; str[i] != 0; i++)
+ {
+ if (str[i] == '\r')
+ {
+ strTmp[0] = str[i];
+ ST->ConOut->OutputString(ST->ConOut, strTmp);
+
+ strTmp[0] = '\n';
+ ST->ConOut->OutputString(ST->ConOut, strTmp);
+ }
+ else
+ {
+ strTmp[0] = str[i];
+ ST->ConOut->OutputString(ST->ConOut, strTmp);
+ }
+ }
+#endif // ifdef __DEBUG__
+
+ return *this;
+}
+
+/// @brief UTF-8 equivalent of Write (UTF-16).
+/// @param str the input string.
+Boot::BootTextWriter& Boot::BootTextWriter::Write(const Char* str)
+{
+#ifdef __DEBUG__
+ if (!str || *str == 0)
+ return *this;
+
+ CharacterTypeUTF16 strTmp[2];
+ strTmp[1] = 0;
+
+ for (size_t i = 0; str[i] != 0; i++)
+ {
+ if (str[i] == '\r')
+ {
+ strTmp[0] = str[i];
+ ST->ConOut->OutputString(ST->ConOut, strTmp);
+
+ strTmp[0] = '\n';
+ ST->ConOut->OutputString(ST->ConOut, strTmp);
+ }
+ else
+ {
+ strTmp[0] = str[i];
+ ST->ConOut->OutputString(ST->ConOut, strTmp);
+ }
+ }
+#endif // ifdef __DEBUG__
+
+ return *this;
+}
+
+Boot::BootTextWriter& Boot::BootTextWriter::Write(const UChar* str)
+{
+#ifdef __DEBUG__
+ if (!str || *str == 0)
+ return *this;
+
+ CharacterTypeUTF16 strTmp[2];
+ strTmp[1] = 0;
+
+ for (size_t i = 0; str[i] != 0; i++)
+ {
+ if (str[i] == '\r')
+ {
+ strTmp[0] = str[i];
+ ST->ConOut->OutputString(ST->ConOut, strTmp);
+
+ strTmp[0] = '\n';
+ ST->ConOut->OutputString(ST->ConOut, strTmp);
+ }
+ else
+ {
+ strTmp[0] = str[i];
+ ST->ConOut->OutputString(ST->ConOut, strTmp);
+ }
+ }
+#endif // ifdef __DEBUG__
+
+ return *this;
+}
+
+/**
+@brief putc wrapper over EFI ConOut.
+*/
+Boot::BootTextWriter& Boot::BootTextWriter::WriteCharacter(CharacterTypeUTF16 c)
+{
+#ifdef __DEBUG__
+ EfiCharType str[2];
+
+ str[0] = c;
+ str[1] = 0;
+ ST->ConOut->OutputString(ST->ConOut, str);
+#endif // ifdef __DEBUG__
+
+ return *this;
+}
+
+Boot::BootTextWriter& Boot::BootTextWriter::Write(const Long& x)
+{
+#ifdef __DEBUG__
+ this->_Write(x);
+ this->Write("h");
+#endif // ifdef __DEBUG__
+
+ return *this;
+}
+
+Boot::BootTextWriter& Boot::BootTextWriter::_Write(const Long& x)
+{
+#ifdef __DEBUG__
+ UInt64 y = (x > 0 ? x : -x) / 16;
+ UInt64 h = (x > 0 ? x : -x) % 16;
+
+ if (y)
+ this->_Write(y);
+
+ /* fail if the hex number is not base-16 */
+ if (h > 16)
+ {
+ this->WriteCharacter('?');
+ return *this;
+ }
+
+ if (y < 0)
+ y = -y;
+
+ const char cNumbers[] = "0123456789ABCDEF";
+
+ this->WriteCharacter(cNumbers[h]);
+#endif // ifdef __DEBUG__
+
+ return *this;
+}
diff --git a/dev/boot/src/BootThread.cc b/dev/boot/src/BootThread.cc
new file mode 100644
index 00000000..e087d386
--- /dev/null
+++ b/dev/boot/src/BootThread.cc
@@ -0,0 +1,211 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#include <BootKit/BootThread.h>
+#include <BootKit/Support.h>
+#include <BootKit/BootKit.h>
+#include <FirmwareKit/EFI/API.h>
+
+#include <KernelKit/PEF.h>
+#include <KernelKit/PE.h>
+#include <KernelKit/MSDOS.h>
+#include <CFKit/Utils.h>
+#include <modules/CoreGfx/TextMgr.h>
+
+/// @brief External boot services symbol.
+EXTERN EfiBootServices* BS;
+
+/// @note BootThread doesn't parse the symbols so doesn't nullify them, .bss is though.
+
+namespace Boot
+{
+ EXTERN_C Int32 rt_jump_to_address(VoidPtr code, HEL::BootInfoHeader* handover, UInt8* stack);
+
+ BootThread::BootThread(VoidPtr blob)
+ : fBlob(blob), fStartAddress(nullptr)
+ {
+ // detect the format.
+ const Char* blob_bytes = reinterpret_cast<char*>(fBlob);
+
+ BootTextWriter writer;
+
+ if (!blob_bytes)
+ {
+ // failed to provide a valid pointer.
+ return;
+ }
+
+ if (blob_bytes[0] == kMagMz0 &&
+ blob_bytes[1] == kMagMz1)
+ {
+ LDR_EXEC_HEADER_PTR header_ptr = CFKit::ldr_find_exec_header(blob_bytes);
+ LDR_OPTIONAL_HEADER_PTR opt_header_ptr = CFKit::ldr_find_opt_exec_header(blob_bytes);
+
+ if (!header_ptr || !opt_header_ptr)
+ return;
+
+#ifdef __NE_AMD64__
+ if (header_ptr->Machine != kPeMachineAMD64 ||
+ header_ptr->Signature != kPeSignature)
+ {
+ writer.Write("BootZ: Not a PE32+ executable.\r");
+ return;
+ }
+#elif defined(__NE_ARM64__)
+ if (header_ptr->Machine != kPeMachineARM64 ||
+ header_ptr->Signature != kPeSignature)
+ {
+ writer.Write("BootZ: Not a PE32+ executable.\r");
+ return;
+ }
+#endif // __NE_AMD64__ || __NE_ARM64__
+
+ writer.Write("BootZ: PE32+ executable detected (NeKernel Subsystem).\r");
+
+ auto numSecs = header_ptr->NumberOfSections;
+
+ writer.Write("BootZ: Major Linker Ver: ").Write(opt_header_ptr->MajorLinkerVersion).Write("\r");
+ writer.Write("BootZ: Minor Linker Ver: ").Write(opt_header_ptr->MinorLinkerVersion).Write("\r");
+ writer.Write("BootZ: Major Subsystem Ver: ").Write(opt_header_ptr->MajorSubsystemVersion).Write("\r");
+ writer.Write("BootZ: Minor Subsystem Ver: ").Write(opt_header_ptr->MinorSubsystemVersion).Write("\r");
+ writer.Write("BootZ: Magic: ").Write(header_ptr->Signature).Write("\r");
+
+ constexpr auto cPageSize = 512;
+
+ EfiPhysicalAddress loadStartAddress = opt_header_ptr->ImageBase;
+ loadStartAddress += opt_header_ptr->BaseOfData;
+
+ writer.Write("BootZ: Image base: ").Write(loadStartAddress).Write("\r");
+
+ auto numPages = opt_header_ptr->SizeOfImage / cPageSize;
+ BS->AllocatePages(AllocateAddress, EfiLoaderData, numPages, &loadStartAddress);
+
+ LDR_SECTION_HEADER_PTR sectPtr = (LDR_SECTION_HEADER_PTR)(((Char*)opt_header_ptr) + header_ptr->SizeOfOptionalHeader);
+
+ constexpr auto sectionForCode = ".text";
+ constexpr auto sectionForNewLdr = ".ldr";
+ constexpr auto sectionForBSS = ".bss";
+
+ for (SizeT sectIndex = 0; sectIndex < numSecs; ++sectIndex)
+ {
+ LDR_SECTION_HEADER_PTR sect = &sectPtr[sectIndex];
+
+ SetMem((VoidPtr)(loadStartAddress + sect->VirtualAddress), 0, sect->SizeOfRawData);
+
+ if (StrCmp(sectionForCode, sect->Name) == 0)
+ {
+ fStartAddress = (VoidPtr)((UIntPtr)loadStartAddress + opt_header_ptr->AddressOfEntryPoint);
+ writer.Write("BootZ: Executable entry address: ").Write((UIntPtr)fStartAddress).Write("\r");
+ }
+ else if (StrCmp(sectionForNewLdr, sect->Name) == 0)
+ {
+ struct HANDOVER_INFORMATION_STUB
+ {
+ UInt64 HandoverMagic;
+ UInt32 HandoverType;
+ UInt32 HandoverPad;
+ UInt32 HandoverArch;
+ }* handover_struc = (struct HANDOVER_INFORMATION_STUB*)((UIntPtr)fBlob + sect->PointerToRawData);
+
+ if (handover_struc->HandoverMagic != kHandoverMagic &&
+ handover_struc->HandoverType != HEL::kTypeKernel)
+ {
+#ifdef __NE_AMD64__
+ if (handover_struc->HandoverArch != HEL::kArchAMD64)
+ {
+ fb_render_string("BootZ: Not an handover header, bad CPU...", 40, 10, RGB(0xFF, 0xFF, 0xFF));
+ ::EFI::Stop();
+ }
+#endif
+
+#ifdef __NE_ARM64__
+ if (handover_struc->HandoverArch != HEL::kArchARM64)
+ {
+ fb_render_string("BootZ: Not an handover header, bad CPU...", 40, 10, RGB(0xFF, 0xFF, 0xFF));
+ ::EFI::Stop();
+ }
+#endif
+ fb_render_string("BootZ: Not an handover header...", 40, 10, RGB(0xFF, 0xFF, 0xFF));
+
+ ::EFI::Stop();
+ }
+ }
+
+ writer.Write("BootZ: Raw offset: ").Write(sect->PointerToRawData).Write(" of ").Write(sect->Name).Write("\r");
+
+ CopyMem((VoidPtr)(loadStartAddress + sect->VirtualAddress), (VoidPtr)((UIntPtr)fBlob + sect->PointerToRawData), sect->SizeOfRawData);
+ }
+ }
+ else if (blob_bytes[0] == kPefMagic[0] &&
+ blob_bytes[1] == kPefMagic[1] &&
+ blob_bytes[2] == kPefMagic[2] &&
+ blob_bytes[3] == kPefMagic[3])
+ {
+ // ========================================= //
+ // PEF executable detected.
+ // ========================================= //
+
+ fStartAddress = nullptr;
+ writer.Write("BootZ: PEF executable detected, won't load it.\r");
+ writer.Write("BootZ: note: PEF executables aren't loadable by default.\r");
+ }
+ else
+ {
+ writer.Write("BootZ: Invalid Executable.\r");
+ }
+
+ fStack = new UInt8[mib_cast(16)];
+ }
+
+ /// @note handover header has to be valid!
+ Int32 BootThread::Start(HEL::BootInfoHeader* handover, Bool own_stack)
+ {
+ HEL::HandoverProc err_fn = [](HEL::BootInfoHeader* rcx) -> Int32 {
+ fb_render_string("BootZ: Invalid Boot Image...", 50, 10, RGB(0xFF, 0xFF, 0xFF));
+ ::EFI::Stop();
+
+ return NO;
+ };
+
+ if (!fStartAddress)
+ {
+ err_fn(handover);
+ }
+
+ fHandover = handover;
+
+ if (own_stack)
+ {
+ rt_jump_to_address(fStartAddress, fHandover, &fStack[mib_cast(16) - 1]);
+ }
+ else
+ {
+ if (fStack)
+ delete[] fStack;
+
+ fStack = nullptr;
+
+ return reinterpret_cast<HEL::HandoverProc>(fStartAddress)(fHandover);
+ }
+
+ return kEfiOk;
+ }
+
+ const Char* BootThread::GetName()
+ {
+ return fBlobName;
+ }
+
+ Void BootThread::SetName(const Char* name)
+ {
+ CopyMem(fBlobName, name, StrLen(name));
+ }
+
+ bool BootThread::IsValid()
+ {
+ return fStartAddress != nullptr;
+ }
+} // namespace Boot
diff --git a/dev/boot/src/BootloaderRsrc.rsrc b/dev/boot/src/BootloaderRsrc.rsrc
new file mode 100644
index 00000000..2f8177a7
--- /dev/null
+++ b/dev/boot/src/BootloaderRsrc.rsrc
@@ -0,0 +1,25 @@
+#include "../../kernel/CompilerKit/Version.h"
+
+1 VERSIONINFO
+FILEVERSION 1,0,0,0
+PRODUCTVERSION 1,0,0,0
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "080904E4"
+ BEGIN
+ VALUE "CompanyName", "Amlal EL Mahrouss"
+ VALUE "FileDescription", "NeKernel OS Loader."
+ VALUE "FileVersion", BOOTLOADER_VERSION
+ VALUE "InternalName", "bootz"
+ VALUE "LegalCopyright", "Copyright (C) 2024, Amlal EL Mahrouss all rights reserved."
+ VALUE "OriginalFilename", "bootz.exe"
+ VALUE "ProductName", "bootz"
+ VALUE "ProductVersion", BOOTLOADER_VERSION
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x809, 1252
+ END
+END
diff --git a/dev/boot/src/HEL/64X000/.gitkeep b/dev/boot/src/HEL/64X000/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/dev/boot/src/HEL/64X000/.gitkeep
diff --git a/dev/boot/src/HEL/64X000/BootCB.S b/dev/boot/src/HEL/64X000/BootCB.S
new file mode 100644
index 00000000..f286f449
--- /dev/null
+++ b/dev/boot/src/HEL/64X000/BootCB.S
@@ -0,0 +1,35 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+.section .boot_hdr
+.align 4
+
+/* BootZ boot header begin for a 64x000 Kernel. */
+
+boot_hdr_mag:
+ .ascii "CB"
+boot_hdr_name:
+ // it has to match ten bytes.
+ .asciz "bootz\0\0\0"
+boot_hdr_ver:
+ .word 0x104
+boot_hdr_proc:
+ .long bootloader_start
+
+/* BootZ boot header end */
+
+.extern bootloader_main
+.extern bootloader_stack
+
+.globl bootloader_start
+bootloader_start:
+ psh 4 /* real address of .Laddr */
+ ldi 0,(bootloader_stack-bootloader_start)(4) /* stack address location */
+ mv 19,0 /* use user defined stack */
+ jrl
+
+ bl bootloader_main
+ blr
diff --git a/dev/boot/src/HEL/AMD64/BootAPI.S b/dev/boot/src/HEL/AMD64/BootAPI.S
new file mode 100644
index 00000000..963ef46a
--- /dev/null
+++ b/dev/boot/src/HEL/AMD64/BootAPI.S
@@ -0,0 +1,60 @@
+.global rt_jump_to_address
+.global rt_reset_hardware
+
+.text
+
+.intel_syntax noprefix
+
+/**
+ @brief this function setups a stack and then jumps to
+ a function */
+rt_jump_to_address:
+ mov rbx, rcx
+ mov rcx, rdx
+ push rbx
+ push rdx
+ mov rsp, r8
+ push rax
+ jmp rbx
+
+ pop rdx
+ pop rbx
+ pop rax
+
+ ret
+
+rt_reset_hardware:
+ /* dont raise any interrupts. (except ofc NMIs.) */
+ cli
+ /* remap PIC */
+wait_gate1:
+ in al,0x64
+ and al,2
+ jnz wait_gate1
+ mov al,0x0D1
+ out 0x64,al
+wait_gate2:
+ in al,0x64
+ and al,2
+ jnz wait_gate2
+ mov al,0x0FE
+ out 0x60,al
+
+ /* trigger triple fault, by writing to cr4 */
+
+ mov rax, 0
+ lidt [rax]
+
+reset_wait:
+ jmp reset_wait
+
+.global boot_write_cr3
+.global boot_read_cr3
+
+boot_read_cr3:
+ mov rax, rax
+ ret
+
+boot_write_cr3:
+ mov cr3, rcx
+ ret
diff --git a/dev/boot/src/HEL/AMD64/BootATA.cc b/dev/boot/src/HEL/AMD64/BootATA.cc
new file mode 100644
index 00000000..0ec6ab18
--- /dev/null
+++ b/dev/boot/src/HEL/AMD64/BootATA.cc
@@ -0,0 +1,283 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+/**
+ * @file BootATA.cc
+ * @author Amlal EL Mahrouss (amlalelmahrouss@icloud.com)
+ * @brief ATA driver.
+ * @version 0.1
+ * @date 2024-02-02
+ *
+ * @copyright Copyright (c) Amlal EL Mahrouss
+ *
+ */
+
+#include <FirmwareKit/EFI.h>
+#include <BootKit/BootKit.h>
+#include <BootKit/HW/ATA.h>
+
+/// bugs: 0
+
+using namespace Boot;
+
+#define kATADataLen 256
+
+static Boolean kATADetected = false;
+static Int32 kATADeviceType = kATADeviceCount;
+static UInt16 kATAData[kATADataLen] = {0};
+
+Boolean boot_ata_detected(Void);
+
+STATIC Boolean boot_ata_wait_io(UInt16 IO)
+{
+ for (int i = 0; i < 400; i++)
+ rt_in8(IO + ATA_REG_STATUS);
+
+ATAWaitForIO_Retry:
+ auto status_rdy = rt_in8(IO + ATA_REG_STATUS);
+
+ if ((status_rdy & ATA_SR_BSY))
+ goto ATAWaitForIO_Retry;
+
+ATAWaitForIO_Retry2:
+ status_rdy = rt_in8(IO + ATA_REG_STATUS);
+
+ if (status_rdy & ATA_SR_ERR)
+ return false;
+
+ if (!(status_rdy & ATA_SR_DRDY))
+ goto ATAWaitForIO_Retry2;
+
+ return true;
+}
+
+Void boot_ata_select(UInt16 Bus)
+{
+ if (Bus == ATA_PRIMARY_IO)
+ rt_out8(Bus + ATA_REG_HDDEVSEL, ATA_PRIMARY_SEL);
+ else
+ rt_out8(Bus + ATA_REG_HDDEVSEL, ATA_SECONDARY_SEL);
+}
+
+Boolean boot_ata_init(UInt16 Bus, UInt8 Drive, UInt16& OutBus, UInt8& OutMaster)
+{
+ if (boot_ata_detected())
+ return true;
+
+ BootTextWriter writer;
+
+ UInt16 IO = Bus;
+
+ boot_ata_select(IO);
+
+ // Bus init, NEIN bit.
+ rt_out8(IO + ATA_REG_NEIN, 1);
+
+ // identify until it's good.
+ATAInit_Retry:
+ auto status_rdy = rt_in8(IO + ATA_REG_STATUS);
+
+ if (status_rdy & ATA_SR_ERR)
+ {
+ writer.Write(
+ L"BootZ: ATA: Not an IDE based drive.\r");
+
+ return false;
+ }
+
+ if ((status_rdy & ATA_SR_BSY))
+ goto ATAInit_Retry;
+
+ rt_out8(IO + ATA_REG_COMMAND, ATA_CMD_IDENTIFY);
+
+ /// fetch serial info
+ /// model, speed, number of sectors...
+
+ boot_ata_wait_io(IO);
+
+ for (SizeT indexData = 0ul; indexData < kATADataLen; ++indexData)
+ {
+ kATAData[indexData] = NeOS::HAL::rt_in16(IO + ATA_REG_DATA);
+ }
+
+ OutBus =
+ (Bus == ATA_PRIMARY_IO) ? BootDeviceATA::kPrimary : BootDeviceATA::kSecondary;
+
+ OutMaster = (Bus == ATA_PRIMARY_IO) ? ATA_MASTER : ATA_SLAVE;
+
+ return true;
+}
+
+Void boot_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf, SizeT SectorSz, SizeT Size)
+{
+ Lba /= SectorSz;
+
+ UInt8 Command = ((!Master) ? 0xE0 : 0xF0);
+
+ boot_ata_wait_io(IO);
+ boot_ata_select(IO);
+
+ rt_out8(IO + ATA_REG_HDDEVSEL, (Command) | (((Lba) >> 24) & 0x0F));
+
+ rt_out8(IO + ATA_REG_SEC_COUNT0, ((Size + SectorSz) / SectorSz));
+
+ rt_out8(IO + ATA_REG_LBA0, (Lba)&0xFF);
+ rt_out8(IO + ATA_REG_LBA1, (Lba) >> 8);
+ rt_out8(IO + ATA_REG_LBA2, (Lba) >> 16);
+ rt_out8(IO + ATA_REG_LBA3, (Lba) >> 24);
+
+ rt_out8(IO + ATA_REG_COMMAND, ATA_CMD_READ_PIO);
+
+ boot_ata_wait_io(IO);
+
+ for (SizeT IndexOff = 0; IndexOff < Size; ++IndexOff)
+ {
+ boot_ata_wait_io(IO);
+ Buf[IndexOff] = NeOS::HAL::rt_in16(IO + ATA_REG_DATA);
+ boot_ata_wait_io(IO);
+ }
+}
+
+Void boot_ata_write(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf, SizeT SectorSz, SizeT Size)
+{
+ Lba /= SectorSz;
+
+ UInt8 Command = ((!Master) ? 0xE0 : 0xF0);
+
+ boot_ata_wait_io(IO);
+ boot_ata_select(IO);
+
+ rt_out8(IO + ATA_REG_HDDEVSEL, (Command) | (((Lba) >> 24) & 0x0F));
+
+ rt_out8(IO + ATA_REG_SEC_COUNT0, ((Size + (SectorSz)) / SectorSz));
+
+ rt_out8(IO + ATA_REG_LBA0, (Lba)&0xFF);
+ rt_out8(IO + ATA_REG_LBA1, (Lba) >> 8);
+ rt_out8(IO + ATA_REG_LBA2, (Lba) >> 16);
+ rt_out8(IO + ATA_REG_LBA3, (Lba) >> 24);
+
+ rt_out8(IO + ATA_REG_COMMAND, ATA_CMD_WRITE_PIO);
+
+ boot_ata_wait_io(IO);
+
+ for (SizeT IndexOff = 0; IndexOff < Size; ++IndexOff)
+ {
+ boot_ata_wait_io(IO);
+ rt_out16(IO + ATA_REG_DATA, Buf[IndexOff]);
+ boot_ata_wait_io(IO);
+ }
+
+ boot_ata_wait_io(IO);
+}
+
+/// @check is ATA detected?
+Boolean boot_ata_detected(Void)
+{
+ return kATADetected;
+}
+
+/***
+ *
+ *
+ * @brief ATA Device class.
+ *
+ *
+ */
+
+/**
+ * @brief ATA Device constructor.
+ * @param void none.
+ */
+BootDeviceATA::BootDeviceATA() noexcept
+{
+ if (boot_ata_init(ATA_PRIMARY_IO, true, this->Leak().mBus,
+ this->Leak().mMaster) ||
+ boot_ata_init(ATA_SECONDARY_IO, true, this->Leak().mBus,
+ this->Leak().mMaster))
+ {
+ kATADetected = true;
+ }
+}
+/**
+ * @brief Is ATA detected?
+ */
+BootDeviceATA::operator bool()
+{
+ return boot_ata_detected();
+}
+
+/**
+ @brief Read Buf from disk
+ @param Sz Sector size
+ @param Buf buffer
+*/
+BootDeviceATA& BootDeviceATA::Read(CharacterTypeUTF8* Buf, const SizeT& SectorSz)
+{
+ if (!boot_ata_detected())
+ {
+ Leak().mErr = true;
+ return *this;
+ }
+
+ this->Leak().mErr = false;
+
+ if (!Buf || SectorSz < 1)
+ return *this;
+
+ boot_ata_read(this->Leak().mBase, this->Leak().mBus, this->Leak().mMaster,
+ Buf, SectorSz, this->Leak().mSize);
+
+ return *this;
+}
+
+/**
+ @brief Write Buf into disk
+ @param Sz Sector size
+ @param Buf buffer
+*/
+BootDeviceATA& BootDeviceATA::Write(CharacterTypeUTF8* Buf, const SizeT& SectorSz)
+{
+ if (!boot_ata_detected())
+ {
+ Leak().mErr = true;
+ return *this;
+ }
+
+ Leak().mErr = false;
+
+ if (!Buf || SectorSz < 1 || this->Leak().mSize < 1)
+ {
+ Leak().mErr = true;
+ return *this;
+ }
+
+ boot_ata_write(this->Leak().mBase, this->Leak().mBus, this->Leak().mMaster,
+ Buf, SectorSz, this->Leak().mSize);
+
+ return *this;
+}
+
+/**
+ * @brief ATA trait getter.
+ * @return BootDeviceATA::ATATrait& the drive config.
+ */
+BootDeviceATA::ATATrait& BootDeviceATA::Leak()
+{
+ return mTrait;
+}
+
+/***
+ @brief Getter, gets the number of sectors inside the drive.
+*/
+SizeT BootDeviceATA::GetSectorsCount() noexcept
+{
+ return (kATAData[61] << 16) | kATAData[60];
+}
+
+SizeT BootDeviceATA::GetDiskSize() noexcept
+{
+ return this->GetSectorsCount() * BootDeviceATA::kSectorSize;
+}
diff --git a/dev/boot/src/HEL/AMD64/BootEFI.cc b/dev/boot/src/HEL/AMD64/BootEFI.cc
new file mode 100644
index 00000000..5e2b3855
--- /dev/null
+++ b/dev/boot/src/HEL/AMD64/BootEFI.cc
@@ -0,0 +1,316 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#include <BootKit/BootKit.h>
+#include <modules/CoreGfx/FBMgr.h>
+#include <modules/CoreGfx/TextMgr.h>
+#include <FirmwareKit/EFI.h>
+#include <FirmwareKit/EFI/API.h>
+#include <FirmwareKit/Handover.h>
+#include <KernelKit/MSDOS.h>
+#include <KernelKit/PE.h>
+#include <KernelKit/PEF.h>
+#include <NewKit/Macros.h>
+#include <NewKit/Ref.h>
+#include <BootKit/BootThread.h>
+#include <modules/CoreGfx/FBMgr.h>
+
+// Makes the compiler shut up.
+#ifndef kMachineModel
+#define kMachineModel "ZkaOS"
+#endif // !kMachineModel
+
+#ifndef kExpectedWidth
+#define kExpectedWidth (1280)
+#endif
+
+#ifndef kExpectedHeight
+#define kExpectedHeight (720)
+#endif
+
+/** Graphics related. */
+
+STATIC EfiGraphicsOutputProtocol* kGop = nullptr;
+STATIC UInt16 kGopStride = 0U;
+STATIC EfiGUID kGopGuid;
+
+/** Related to jumping to the reset vector. */
+
+EXTERN_C Void rt_reset_hardware();
+
+/** Boot Services symbol. */
+EXTERN EfiBootServices* BS;
+
+/**
+ @brief Finds and stores the GOP object.
+*/
+STATIC Bool boot_init_fb() noexcept
+{
+ kGopGuid = EfiGUID(EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID);
+ kGop = nullptr;
+
+ if (BS->LocateProtocol(&kGopGuid, nullptr, (VoidPtr*)&kGop) != kEfiOk)
+ return No;
+
+ kGopStride = 4;
+
+ for (SizeT i = 0; i < kGop->Mode->MaxMode; ++i)
+ {
+ EfiGraphicsOutputProtocolModeInformation* infoPtr = nullptr;
+ UInt32 sz = 0U;
+
+ kGop->QueryMode(kGop, i, &sz, &infoPtr);
+
+ if (infoPtr->HorizontalResolution == kExpectedWidth &&
+ infoPtr->VerticalResolution == kExpectedHeight)
+ {
+ kGop->SetMode(kGop, i);
+ return Yes;
+ }
+ }
+
+ return No;
+}
+
+EfiGUID kEfiGlobalNamespaceVarGUID = {
+ 0x8BE4DF61, 0x93CA, 0x11D2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C}};
+
+/// @brief Main EFI entrypoint.
+/// @param image_handle Handle of this image.
+/// @param sys_table The system table of it.
+/// @return nothing, never returns.
+EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr image_handle,
+ EfiSystemTable* sys_table)
+{
+ InitEFI(sys_table); ///! Init the EFI library.
+
+ HEL::BootInfoHeader* handover_hdr =
+ new HEL::BootInfoHeader();
+
+ UInt32 map_key = 0;
+ UInt32 size_struct_ptr = sizeof(EfiMemoryDescriptor);
+ EfiMemoryDescriptor* struct_ptr = nullptr;
+ UInt32 sz_desc = sizeof(EfiMemoryDescriptor);
+ UInt32 rev_desc = 0;
+
+#ifdef ZBA_USE_FB
+ if (!boot_init_fb())
+ return 1; ///! Init the GOP.
+
+ for (SizeT index_vt = 0; index_vt < sys_table->NumberOfTableEntries;
+ ++index_vt)
+ {
+ Char* vendor_table = reinterpret_cast<Char*>(
+ sys_table->ConfigurationTable[index_vt].VendorTable);
+
+ // ACPI's 'RSD PTR', which contains the ACPI SDT (MADT, FACP...)
+ if (vendor_table[0] == 'R' && vendor_table[1] == 'S' &&
+ vendor_table[2] == 'D' && vendor_table[3] == ' ' &&
+ vendor_table[4] == 'P' && vendor_table[5] == 'T' &&
+ vendor_table[6] == 'R' && vendor_table[7] == ' ')
+ {
+ handover_hdr->f_HardwareTables.f_VendorPtr = (VoidPtr)vendor_table;
+ break;
+ }
+ }
+
+ // ------------------------------------------ //
+ // draw background color.
+ // ------------------------------------------ //
+
+ handover_hdr->f_GOP.f_The = kGop->Mode->FrameBufferBase;
+ handover_hdr->f_GOP.f_Width = kGop->Mode->Info->VerticalResolution;
+ handover_hdr->f_GOP.f_Height = kGop->Mode->Info->HorizontalResolution;
+ handover_hdr->f_GOP.f_PixelPerLine = kGop->Mode->Info->PixelsPerScanLine;
+ handover_hdr->f_GOP.f_PixelFormat = kGop->Mode->Info->PixelFormat;
+ handover_hdr->f_GOP.f_Size = kGop->Mode->FrameBufferSize;
+#endif // ZBA_USE_FB
+
+ // ------------------------------------------- //
+ // Grab MP services, extended to runtime. //
+ // ------------------------------------------- //
+
+ EfiGUID guid_mp = EfiGUID(EFI_MP_SERVICES_PROTOCOL_GUID);
+ EfiMpServicesProtocol* mp = nullptr;
+
+ BS->LocateProtocol(&guid_mp, nullptr, reinterpret_cast<VoidPtr*>(&mp));
+
+ handover_hdr->f_HardwareTables.f_MpPtr = reinterpret_cast<VoidPtr>(mp);
+
+ kHandoverHeader = handover_hdr;
+
+ fb_init();
+
+ FB::fb_clear_video();
+
+ FBDrawBitMapInRegion(zka_disk, NE_DISK_WIDTH, NE_DISK_HEIGHT, (kHandoverHeader->f_GOP.f_Width - NE_DISK_WIDTH) / 2, (kHandoverHeader->f_GOP.f_Height - NE_DISK_HEIGHT) / 2);
+
+ fb_clear();
+
+ UInt32 cnt_enabled = 0;
+ UInt32 cnt_disabled = 0;
+
+ if (mp)
+ {
+ mp->GetNumberOfProcessors(mp, &cnt_disabled, &cnt_enabled);
+ handover_hdr->f_HardwareTables.f_MultiProcessingEnabled = cnt_enabled > 1;
+ }
+ else
+ {
+ handover_hdr->f_HardwareTables.f_MultiProcessingEnabled = NO;
+ }
+
+ // Fill handover header now.
+
+ // ---------------------------------------------------- //
+ // The following checks for an exisiting partition
+ // inside the disk, if it doesn't have one,
+ // format the disk.
+ // ---------------------------------------------------- //
+
+ BS->GetMemoryMap(&size_struct_ptr, struct_ptr, &map_key, &sz_desc, &rev_desc);
+
+ struct_ptr = new EfiMemoryDescriptor[sz_desc];
+
+ BS->GetMemoryMap(&size_struct_ptr, struct_ptr, &map_key, &sz_desc, &rev_desc);
+
+ auto kDefaultMemoryMap = 0; // Grab any usable entries.
+
+ //-----------------------------------------------------------//
+ // A simple loop which finds a usable memory region for us.
+ //-----------------------------------------------------------//
+
+ SizeT lookup_index = 0UL;
+
+ for (; struct_ptr[lookup_index].Kind != EfiMemoryType::EfiConventionalMemory; ++lookup_index)
+ {
+ NE_UNUSED(0);
+ }
+
+ kDefaultMemoryMap = lookup_index;
+
+ //-------------------------------------------------------------//
+ // Update handover file specific table and phyiscal start field.
+ //-------------------------------------------------------------//
+
+ handover_hdr->f_BitMapStart = (VoidPtr)struct_ptr[kDefaultMemoryMap].VirtualStart; /* Start of bitmap. */
+ handover_hdr->f_BitMapSize = struct_ptr[kDefaultMemoryMap].NumberOfPages * sizeof(UIntPtr); /* Size of bitmap. */
+
+ handover_hdr->f_FirmwareCustomTables[0] = (VoidPtr)BS;
+ handover_hdr->f_FirmwareCustomTables[1] = (VoidPtr)ST;
+
+ Boot::BootFileReader reader_syschk(L"syschk.sys", image_handle);
+ reader_syschk.ReadAll(0);
+
+ Boot::BootThread* syschk_thread = nullptr;
+
+ // ------------------------------------------ //
+ // If we succeed in reading the blob, then execute it.
+ // ------------------------------------------ //
+
+ if (reader_syschk.Blob())
+ {
+ syschk_thread = new Boot::BootThread(reader_syschk.Blob());
+ syschk_thread->SetName("BootZ: System Recovery Check");
+ syschk_thread->Start(handover_hdr, NO);
+ }
+
+#if defined(__ATA_PIO__)
+ Boot::BDiskFormatFactory<BootDeviceATA> partition_factory;
+
+ if (syschk_thread->Start(handover_hdr, NO) != kEfiOk)
+ {
+ if (partition_factory.IsPartitionValid() == NO)
+ {
+ Boot::BDiskFormatFactory<BootDeviceATA>::BFileDescriptor root{};
+
+ root.fFileName[0] = kNeFSRoot[0];
+ root.fFileName[1] = 0;
+
+ root.fKind = kNeFSCatalogKindDir;
+
+ const auto kFSName = "SSD";
+
+ partition_factory.Format(kFSName, &root, 1);
+
+ fb_init();
+
+ FB::fb_clear_video();
+
+ FBDrawBitMapInRegion(zka_has_disk, NE_HAS_DISK_WIDTH, NE_HAS_DISK_HEIGHT, (kHandoverHeader->f_GOP.f_Width - NE_HAS_DISK_WIDTH) / 2, (kHandoverHeader->f_GOP.f_Height - NE_HAS_DISK_HEIGHT) / 2);
+
+ fb_clear();
+ }
+ }
+#endif
+
+ // ------------------------------------------ //
+ // null these fields, to avoid being reused later.
+ // ------------------------------------------ //
+
+ handover_hdr->f_FirmwareCustomTables[0] = nullptr;
+ handover_hdr->f_FirmwareCustomTables[1] = nullptr;
+
+ handover_hdr->f_FirmwareVendorLen = Boot::BStrLen(sys_table->FirmwareVendor);
+
+ handover_hdr->f_Magic = kHandoverMagic;
+ handover_hdr->f_Version = kHandoverVersion;
+
+ // Provide fimware vendor name.
+
+ Boot::BCopyMem(handover_hdr->f_FirmwareVendorName, sys_table->FirmwareVendor,
+ handover_hdr->f_FirmwareVendorLen);
+
+ handover_hdr->f_FirmwareVendorLen = Boot::BStrLen(sys_table->FirmwareVendor);
+
+ // Assign to global 'kHandoverHeader'.
+
+ WideChar kernel_path[256U] = L"neoskrnl.exe";
+ UInt32 kernel_path_sz = 256U;
+
+ if (ST->RuntimeServices->GetVariable(L"/props/boot_path", kEfiGlobalNamespaceVarGUID, nullptr, &kernel_path_sz, kernel_path) != kEfiOk)
+ {
+ /// access attributes (in order)
+ /// EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS
+ UInt32 attr = 0x00000001 | 0x00000002 | 0x00000004;
+ ST->RuntimeServices->SetVariable(L"/props/boot_path", kEfiGlobalNamespaceVarGUID, &attr, &kernel_path_sz, kernel_path);
+ }
+
+ Boot::BootFileReader reader_kernel(kernel_path, image_handle);
+
+ reader_kernel.ReadAll(0);
+
+ Boot::BootThread* kernel_thread = nullptr;
+
+ // ------------------------------------------ //
+ // If we succeed in reading the blob, then execute it.
+ // ------------------------------------------ //
+
+ if (reader_kernel.Blob())
+ {
+ kernel_thread = new Boot::BootThread(reader_kernel.Blob());
+ kernel_thread->SetName("BootZ: MicroKernel.");
+
+ handover_hdr->f_KernelImage = reader_kernel.Blob();
+ }
+ else
+ {
+ fb_init();
+ FBDrawBitMapInRegion(zka_no_disk, NE_NO_DISK_WIDTH, NE_NO_DISK_HEIGHT, (kHandoverHeader->f_GOP.f_Width - NE_NO_DISK_WIDTH) / 2, (kHandoverHeader->f_GOP.f_Height - NE_NO_DISK_HEIGHT) / 2);
+
+ EFI::Stop();
+ }
+
+ EFI::ExitBootServices(map_key, image_handle);
+
+ // ---------------------------------------------------- //
+ // Finally load the OS kernel.
+ // ---------------------------------------------------- //
+
+ kernel_thread->Start(handover_hdr, YES);
+
+ CANT_REACH();
+}
diff --git a/dev/boot/src/HEL/AMD64/BootPlatform.cc b/dev/boot/src/HEL/AMD64/BootPlatform.cc
new file mode 100644
index 00000000..c7ae4085
--- /dev/null
+++ b/dev/boot/src/HEL/AMD64/BootPlatform.cc
@@ -0,0 +1,106 @@
+
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#include <BootKit/Platform.h>
+#include <BootKit/Protocol.h>
+#include <BootKit/BootKit.h>
+
+#ifdef __BOOTLDR_STANDALONE__
+
+using namespace Boot;
+
+EXTERN_C void rt_hlt()
+{
+ asm volatile("hlt");
+}
+
+EXTERN_C void rt_cli()
+{
+ asm volatile("cli");
+}
+
+EXTERN_C void rt_sti()
+{
+ asm volatile("sti");
+}
+
+EXTERN_C void rt_cld()
+{
+ asm volatile("cld");
+}
+
+EXTERN_C void rt_std()
+{
+ asm volatile("std");
+}
+
+EXTERN_C void rt_out8(UInt16 port, UInt8 value)
+{
+ asm volatile("outb %%al, %1"
+ :
+ : "a"(value), "Nd"(port)
+ : "memory");
+}
+
+EXTERN_C void rt_out16(UInt16 port, UInt16 value)
+{
+ asm volatile("outw %%ax, %1"
+ :
+ : "a"(value), "Nd"(port)
+ : "memory");
+}
+
+EXTERN_C void rt_out32(UInt16 port, UInt32 value)
+{
+ asm volatile("outl %%eax, %1"
+ :
+ : "a"(value), "Nd"(port)
+ : "memory");
+}
+
+EXTERN_C UInt8 rt_in8(UInt16 port)
+{
+ UInt8 value;
+ asm volatile("inb %1, %%al"
+ : "=a"(value)
+ : "Nd"(port)
+ : "memory");
+
+ return value;
+}
+
+EXTERN_C UInt16 rt_in16(UInt16 port)
+{
+ UInt16 value;
+ asm volatile("inw %%dx, %%ax"
+ : "=a"(value)
+ : "d"(port));
+
+ return value;
+}
+
+EXTERN_C UInt32 rt_in32(UInt16 port)
+{
+ UInt32 value;
+ asm volatile("inl %1, %%eax"
+ : "=a"(value)
+ : "Nd"(port)
+ : "memory");
+
+ return value;
+}
+
+#else
+
+#include <HALKit/AMD64/Processor.h>
+
+void rt_hlt()
+{
+ NeOS::HAL::rt_halt();
+}
+
+#endif // __BOOTLDR_STANDALONE__
diff --git a/dev/boot/src/HEL/AMD64/BootSATA.cc b/dev/boot/src/HEL/AMD64/BootSATA.cc
new file mode 100644
index 00000000..b485023d
--- /dev/null
+++ b/dev/boot/src/HEL/AMD64/BootSATA.cc
@@ -0,0 +1,20 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+/**
+ * @file BootAHCI.cc
+ * @author Amlal EL Mahrouss (amlalelmahrouss@icloud.com)
+ * @brief SATA support for BootZ.
+ * @version 0.1
+ * @date 2024-02-02
+ *
+ * @copyright Copyright (c) Amlal EL Mahrouss
+ *
+ */
+
+#include <BootKit/Platform.h>
+#include <BootKit/Protocol.h>
+#include <BootKit/HW/SATA.h>
diff --git a/dev/boot/src/HEL/ARM64/.gitkeep b/dev/boot/src/HEL/ARM64/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/dev/boot/src/HEL/ARM64/.gitkeep
diff --git a/dev/boot/src/HEL/ARM64/BootAPI.S b/dev/boot/src/HEL/ARM64/BootAPI.S
new file mode 100644
index 00000000..a60ad218
--- /dev/null
+++ b/dev/boot/src/HEL/ARM64/BootAPI.S
@@ -0,0 +1,12 @@
+.global rt_jump_to_address
+
+.text
+
+/**
+ @brief this function setups a stack and then jumps to
+ a function */
+rt_jump_to_address:
+ mov x19, x0
+ mov sp, x2
+ blr x19
+
diff --git a/dev/boot/src/HEL/ARM64/BootCB.S b/dev/boot/src/HEL/ARM64/BootCB.S
new file mode 100644
index 00000000..2d1ff60c
--- /dev/null
+++ b/dev/boot/src/HEL/ARM64/BootCB.S
@@ -0,0 +1,40 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#ifdef __NE_COREBOOT__
+
+.section .boot_hdr
+.align 4
+
+/* BootZ boot header begin */
+
+boot_hdr_mag:
+ .ascii "CB"
+boot_hdr_name:
+ // it has to match ten bytes.
+ .asciz "bootz\0\0"
+boot_hdr_ver:
+ .word 0x104
+boot_hdr_proc:
+ .long bootloader_start
+
+/* BootZ boot header end */
+
+.extern bootloader_main
+.extern bootloader_stack
+
+.globl bootloader_start
+bootloader_start:
+ adr x0, bootloader_stack
+ ldr x1, =bootloader_start
+ sub x0, x0, x1
+ ldr x0, [x0]
+ mov sp, x0
+
+ bl bootloader_main
+ ret
+
+#endif // __NE_COREBOOT__ \ No newline at end of file
diff --git a/dev/boot/src/HEL/ARM64/BootEFI.cc b/dev/boot/src/HEL/ARM64/BootEFI.cc
new file mode 100644
index 00000000..d60f305b
--- /dev/null
+++ b/dev/boot/src/HEL/ARM64/BootEFI.cc
@@ -0,0 +1,220 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#include <BootKit/BootKit.h>
+#include <modules/CoreGfx/FBMgr.h>
+#include <modules/CoreGfx/TextMgr.h>
+#include <FirmwareKit/EFI.h>
+#include <FirmwareKit/EFI/API.h>
+#include <FirmwareKit/Handover.h>
+#include <KernelKit/MSDOS.h>
+#include <KernelKit/PE.h>
+#include <KernelKit/PEF.h>
+#include <NewKit/Macros.h>
+#include <NewKit/Ref.h>
+#include <BootKit/BootThread.h>
+#include <modules/CoreGfx/FBMgr.h>
+
+// Makes the compiler shut up.
+#ifndef kMachineModel
+#define kMachineModel "ZkaOS"
+#endif // !kMachineModel
+
+#ifndef kExpectedWidth
+#define kExpectedWidth (1920)
+#endif
+
+#ifndef kExpectedHeight
+#define kExpectedHeight (1080)
+#endif
+
+/** Graphics related. */
+
+STATIC EfiGraphicsOutputProtocol* kGop = nullptr;
+STATIC UInt16 kGopStride = 0U;
+STATIC EfiGUID kGopGuid;
+
+EXTERN_C Void rt_reset_hardware();
+
+EXTERN EfiBootServices* BS;
+
+/**
+ @brief Finds and stores the GOP object.
+*/
+STATIC Bool boot_init_fb() noexcept
+{
+ kGopGuid = EfiGUID(EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID);
+ kGop = nullptr;
+
+ if (BS->LocateProtocol(&kGopGuid, nullptr, (VoidPtr*)&kGop) != kEfiOk)
+ return No;
+
+ kGopStride = 4;
+
+ for (SizeT i = 0; i < kGop->Mode->MaxMode; ++i)
+ {
+ EfiGraphicsOutputProtocolModeInformation* infoPtr = nullptr;
+ UInt32 sz = 0U;
+
+ kGop->QueryMode(kGop, i, &sz, &infoPtr);
+
+ if (infoPtr->HorizontalResolution == kExpectedWidth &&
+ infoPtr->VerticalResolution == kExpectedHeight)
+ {
+ kGop->SetMode(kGop, i);
+ return Yes;
+ }
+ }
+
+ return No;
+}
+
+EXTERN EfiBootServices* BS;
+
+/// @brief Main EFI entrypoint.
+/// @param image_handle Handle of this image.
+/// @param sys_table The system table of it.
+/// @return nothing, never returns.
+EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr image_handle,
+ EfiSystemTable* sys_table)
+{
+ InitEFI(sys_table); ///! Init the EFI library.
+
+ HEL::BootInfoHeader* handover_hdr =
+ new HEL::BootInfoHeader();
+
+ UInt32 map_key = 0;
+ UInt32 size_struct_ptr = sizeof(EfiMemoryDescriptor);
+ EfiMemoryDescriptor* struct_ptr = nullptr;
+ UInt32 sz_desc = sizeof(EfiMemoryDescriptor);
+ UInt32 rev_desc = 0;
+
+#ifdef ZBA_USE_FB
+ if (!boot_init_fb())
+ return 1; ///! Init the GOP.
+
+ for (SizeT index_vt = 0; index_vt < sys_table->NumberOfTableEntries;
+ ++index_vt)
+ {
+ Char* vendor_table = reinterpret_cast<Char*>(
+ sys_table->ConfigurationTable[index_vt].VendorTable);
+
+ // ACPI's 'RSD PTR', which contains the ACPI SDT (MADT, FACP...)
+ if (vendor_table[0] == 'R' && vendor_table[1] == 'S' &&
+ vendor_table[2] == 'D' && vendor_table[3] == ' ' &&
+ vendor_table[4] == 'P' && vendor_table[5] == 'T' &&
+ vendor_table[6] == 'R' && vendor_table[7] == ' ')
+ {
+ handover_hdr->f_HardwareTables.f_VendorPtr = (VoidPtr)vendor_table;
+ break;
+ }
+ }
+
+ // ------------------------------------------ //
+ // draw background color.
+ // ------------------------------------------ //
+
+ handover_hdr->f_GOP.f_The = kGop->Mode->FrameBufferBase;
+ handover_hdr->f_GOP.f_Width = kGop->Mode->Info->VerticalResolution;
+ handover_hdr->f_GOP.f_Height = kGop->Mode->Info->HorizontalResolution;
+ handover_hdr->f_GOP.f_PixelPerLine = kGop->Mode->Info->PixelsPerScanLine;
+ handover_hdr->f_GOP.f_PixelFormat = kGop->Mode->Info->PixelFormat;
+ handover_hdr->f_GOP.f_Size = kGop->Mode->FrameBufferSize;
+#endif // ZBA_USE_FB
+
+ // ------------------------------------------- //
+ // Grab MP services, extended to runtime. //
+ // ------------------------------------------- //
+
+ EfiGUID guid_mp = EfiGUID(EFI_MP_SERVICES_PROTOCOL_GUID);
+ EfiMpServicesProtocol* mp = nullptr;
+
+ BS->LocateProtocol(&guid_mp, nullptr, reinterpret_cast<VoidPtr*>(&mp));
+
+ handover_hdr->f_HardwareTables.f_MpPtr = reinterpret_cast<VoidPtr>(mp);
+
+ kHandoverHeader = handover_hdr;
+
+ fb_init();
+
+ FB::fb_clear_video();
+
+ FBDrawBitMapInRegion(zka_disk, NE_DISK_WIDTH, NE_DISK_HEIGHT, (kHandoverHeader->f_GOP.f_Width - NE_DISK_WIDTH) / 2, (kHandoverHeader->f_GOP.f_Height - NE_DISK_HEIGHT) / 2);
+
+ fb_clear();
+
+ UInt32 cnt_enabled = 0;
+ UInt32 cnt_disabled = 0;
+
+ if (mp)
+ {
+ mp->GetNumberOfProcessors(mp, &cnt_disabled, &cnt_enabled);
+ handover_hdr->f_HardwareTables.f_MultiProcessingEnabled = cnt_enabled > 1;
+ }
+ else
+ {
+ handover_hdr->f_HardwareTables.f_MultiProcessingEnabled = NO;
+ }
+
+ //-------------------------------------------------------------//
+ // Update handover file specific table and phyiscal start field.
+ //-------------------------------------------------------------//
+
+ handover_hdr->f_BitMapStart = nullptr; /* Start of bitmap. */
+ handover_hdr->f_BitMapSize = kHandoverBitMapSz; /* Size of bitmap. */
+
+ while (BS->AllocatePool(EfiLoaderData, handover_hdr->f_BitMapSize, &handover_hdr->f_BitMapStart) != kEfiOk)
+ {
+ if (handover_hdr->f_BitMapStart)
+ {
+ BS->FreePool(handover_hdr->f_BitMapStart);
+ handover_hdr->f_BitMapStart = nullptr;
+ }
+ }
+
+ // ------------------------------------------ //
+ // null these fields, to avoid being reused later.
+ // ------------------------------------------ //
+
+ handover_hdr->f_FirmwareCustomTables[0] = nullptr;
+ handover_hdr->f_FirmwareCustomTables[1] = nullptr;
+
+ handover_hdr->f_FirmwareVendorLen = Boot::BStrLen(sys_table->FirmwareVendor);
+
+ handover_hdr->f_Magic = kHandoverMagic;
+ handover_hdr->f_Version = kHandoverVersion;
+
+ // Provide fimware vendor name.
+
+ Boot::BCopyMem(handover_hdr->f_FirmwareVendorName, sys_table->FirmwareVendor,
+ handover_hdr->f_FirmwareVendorLen);
+
+ handover_hdr->f_FirmwareVendorLen = Boot::BStrLen(sys_table->FirmwareVendor);
+
+ // Assign to global 'kHandoverHeader'.
+
+ Boot::BootFileReader reader_kernel(L"neoskrnl.exe", image_handle);
+
+ reader_kernel.ReadAll(0);
+
+ // ------------------------------------------ //
+ // If we succeed in reading the blob, then execute it.
+ // ------------------------------------------ //
+
+ if (reader_kernel.Blob())
+ {
+ auto kernel_thread = Boot::BootThread(reader_kernel.Blob());
+ kernel_thread.SetName("BootZ: MicroKernel.");
+
+ handover_hdr->f_KernelImage = reader_kernel.Blob();
+
+ EFI::ExitBootServices(map_key, image_handle);
+
+ kernel_thread.Start(handover_hdr, YES);
+ }
+
+ CANT_REACH();
+}
diff --git a/dev/boot/src/HEL/ARM64/BootPlatform.cc b/dev/boot/src/HEL/ARM64/BootPlatform.cc
new file mode 100644
index 00000000..9713b80d
--- /dev/null
+++ b/dev/boot/src/HEL/ARM64/BootPlatform.cc
@@ -0,0 +1,37 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#include <BootKit/Platform.h>
+#include <BootKit/Protocol.h>
+#include <BootKit/BootKit.h>
+
+#ifdef __BOOTLDR_STANDALONE__
+
+using namespace Boot;
+
+EXTERN_C void rt_hlt()
+{
+ while (Yes)
+ ;
+}
+
+EXTERN_C void rt_cli()
+{
+}
+
+EXTERN_C void rt_sti()
+{
+}
+
+EXTERN_C void rt_cld()
+{
+}
+
+EXTERN_C void rt_std()
+{
+}
+
+#endif // __BOOTLDR_STANDALONE__
diff --git a/dev/boot/src/HEL/POWER/.gitkeep b/dev/boot/src/HEL/POWER/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/dev/boot/src/HEL/POWER/.gitkeep
diff --git a/dev/boot/src/HEL/POWER/BootCB.S b/dev/boot/src/HEL/POWER/BootCB.S
new file mode 100644
index 00000000..2b64f8c1
--- /dev/null
+++ b/dev/boot/src/HEL/POWER/BootCB.S
@@ -0,0 +1,34 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+.section .boot_hdr
+.align 4
+
+/* BootZ boot header begin */
+
+boot_hdr_mag:
+ .ascii "CB"
+boot_hdr_name:
+ // it has to match ten bytes.
+ .asciz "bootz\0\0\0"
+boot_hdr_ver:
+ .word 0x104
+boot_hdr_proc:
+ .long bootloader_start
+
+/* BootZ boot header end */
+
+.extern bootloader_main
+.extern bootloader_stack
+
+.globl bootloader_start
+bootloader_start:
+ mflr 4 /* real address of .Laddr */
+ lwz 0,(bootloader_stack-bootloader_start)(4) /* stack address location */
+ mr 1,0 /* use user defined stack */
+
+ bl bootloader_main
+ blr
diff --git a/dev/boot/src/New+Delete.cc b/dev/boot/src/New+Delete.cc
new file mode 100644
index 00000000..03a1bb68
--- /dev/null
+++ b/dev/boot/src/New+Delete.cc
@@ -0,0 +1,60 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#include <BootKit/Platform.h>
+#include <BootKit/Protocol.h>
+#include <BootKit/BootKit.h>
+
+#ifdef __BOOTLDR_STANDALONE__
+EXTERN EfiBootServices* BS;
+
+/// @brief Allocates a new object.
+/// @param sz the size.
+/// @return
+void* operator new(size_t sz)
+{
+ void* buf = nullptr;
+
+ while (BS->AllocatePool(EfiMemoryType::EfiLoaderData, sz, &buf) != kEfiOk)
+ BS->FreePool(buf);
+
+ return buf;
+}
+
+/// @brief Allocates a new object.
+/// @param sz the size.
+/// @return
+void* operator new[](size_t sz)
+{
+ void* buf = nullptr;
+ BS->AllocatePool(EfiMemoryType::EfiLoaderData, sz, &buf);
+
+ return buf;
+}
+
+/// @brief Deletes the object.
+/// @param buf the object.
+void operator delete(void* buf)
+{
+ BS->FreePool(buf);
+}
+
+/// @brief Deletes the object.
+/// @param buf the object.
+void operator delete[](void* buf)
+{
+ BS->FreePool(buf);
+}
+
+/// @brief Deletes the object (array specific).
+/// @param buf the object.
+/// @param size it's size.
+void operator delete(void* buf, size_t size)
+{
+ BS->FreePool(buf);
+}
+
+#endif // __BOOTLDR_STANDALONE__
diff --git a/dev/boot/src/Root/EFI/STARTUP.NSH b/dev/boot/src/Root/EFI/STARTUP.NSH
new file mode 100644
index 00000000..2cf25f23
--- /dev/null
+++ b/dev/boot/src/Root/EFI/STARTUP.NSH
@@ -0,0 +1,2 @@
+fs0:
+BOOT\BOOTAA64.EFI