summaryrefslogtreecommitdiffhomepage
path: root/Boot/Sources
diff options
context:
space:
mode:
Diffstat (limited to 'Boot/Sources')
-rw-r--r--Boot/Sources/HEL/AMD64/BootFileReader.cxx9
-rw-r--r--Boot/Sources/HEL/AMD64/BootJump.S2
-rw-r--r--Boot/Sources/HEL/AMD64/BootMain.cxx84
-rw-r--r--Boot/Sources/HEL/AMD64/BootPlatform.cxx3
-rw-r--r--Boot/Sources/HEL/AMD64/New+Delete.cxx2
-rw-r--r--Boot/Sources/HEL/AMD64/Support.cxx6
-rw-r--r--Boot/Sources/Root/splash.text (renamed from Boot/Sources/Root/SplashScreen.fmt)0
7 files changed, 40 insertions, 66 deletions
diff --git a/Boot/Sources/HEL/AMD64/BootFileReader.cxx b/Boot/Sources/HEL/AMD64/BootFileReader.cxx
index b5498cf9..46d4f2ab 100644
--- a/Boot/Sources/HEL/AMD64/BootFileReader.cxx
+++ b/Boot/Sources/HEL/AMD64/BootFileReader.cxx
@@ -13,7 +13,7 @@
#include <BootKit/BootKit.hxx>
#include <FirmwareKit/Handover.hxx>
#include <FirmwareKit/EFI/API.hxx>
-#include <cstddef>
+#include <climits>
/// @file BootFileReader
/// @brief Bootloader File reader.
@@ -111,8 +111,9 @@ BFileReader::~BFileReader()
}
/**
- @brief this reads all of the buffer.
- @param until read until size is reached.
+ @brief Reads all of the file into a buffer.
+ @param **until** size of file
+ @param **chunk** chunk to read each time.
*/
Void BFileReader::ReadAll(SizeT until, SizeT chunk)
{
@@ -121,7 +122,7 @@ Void BFileReader::ReadAll(SizeT until, SizeT chunk)
if (auto err = BS->AllocatePool(EfiLoaderCode, until, (VoidPtr*)&mBlob) !=
kEfiOk)
{
- mWriter.Write(L"*** EFI-Code: ").Write(err).Write(L" ***\r");
+ mWriter.Write(L"*** error: ").Write(err).Write(L" ***\r");
EFI::ThrowError(L"OutOfMemory", L"Out of memory.");
}
}
diff --git a/Boot/Sources/HEL/AMD64/BootJump.S b/Boot/Sources/HEL/AMD64/BootJump.S
index c2f03921..e807ab52 100644
--- a/Boot/Sources/HEL/AMD64/BootJump.S
+++ b/Boot/Sources/HEL/AMD64/BootJump.S
@@ -12,7 +12,7 @@ rt_jump_to_address:
mov rdi, rcx
mov rdx, rbp
push rax
- mov r8, rcx
+ mov r8, rcx
call rdi
pop rax
ret
diff --git a/Boot/Sources/HEL/AMD64/BootMain.cxx b/Boot/Sources/HEL/AMD64/BootMain.cxx
index c786c16d..e98be361 100644
--- a/Boot/Sources/HEL/AMD64/BootMain.cxx
+++ b/Boot/Sources/HEL/AMD64/BootMain.cxx
@@ -10,7 +10,7 @@
#include <FirmwareKit/EFI.hxx>
#include <FirmwareKit/EFI/API.hxx>
#include <FirmwareKit/Handover.hxx>
-#include <KernelKit/MSDOS.hpp>
+#include <KernelKit/MSDOS.hxx>
#include <KernelKit/PE.hxx>
#include <KernelKit/PEF.hpp>
#include <NewKit/Macros.hpp>
@@ -166,36 +166,24 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle,
Descriptor = new EfiMemoryDescriptor[*SzDesc];
BS->GetMemoryMap(SizePtr, Descriptor, MapKey, SzDesc, RevDesc);
- writer.Write(L"Kernel-Desc-Count: ");
- writer.Write(*SzDesc);
- writer.Write(L"\r");
+ auto cDefaultMemoryMap = 0; // The sixth entry.
- auto cDefaultMemoryMap = 0; /// The sixth entry.
+ //-----------------------------------------------------------//
+ // A simple loop which finds a usable memory region for us.
+ //-----------------------------------------------------------//
- /// A simple loop which finds a usable memory region for us.
- SizeT i = 0UL;
- for (; Descriptor[i].Kind != EfiMemoryType::EfiConventionalMemory; ++i)
+ SizeT lookIndex = 0UL;
+
+ for (; Descriptor[lookIndex].Kind != EfiMemoryType::EfiConventionalMemory; ++lookIndex)
{
;
}
- cDefaultMemoryMap = i;
-
- writer.Write(L"Number-Of-Pages: ")
- .Write(Descriptor[cDefaultMemoryMap].NumberOfPages)
- .Write(L"\r");
- writer.Write(L"Virtual-Address: ")
- .Write(Descriptor[cDefaultMemoryMap].VirtualStart)
- .Write(L"\r");
- writer.Write(L"Phyiscal-Address: ")
- .Write(Descriptor[cDefaultMemoryMap].PhysicalStart)
- .Write(L"\r");
- writer.Write(L"Page-Kind: ")
- .Write(Descriptor[cDefaultMemoryMap].Kind)
- .Write(L"\r");
- writer.Write(L"Page-Attribute: ")
- .Write(Descriptor[cDefaultMemoryMap].Attribute)
- .Write(L"\r");
+ cDefaultMemoryMap = lookIndex;
+
+ //-----------------------------------------------------------//
+ // Update handover file specific table and phyiscal start field.
+ //-----------------------------------------------------------//
handoverHdrPtr->f_PhysicalStart =
(VoidPtr)Descriptor[cDefaultMemoryMap].PhysicalStart;
@@ -214,41 +202,18 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle,
handoverHdrPtr->f_FirmwareVendorLen = BStrLen(SystemTable->FirmwareVendor);
- BFileReader reader(L"SplashScreen.fmt", ImageHandle);
- reader.ReadAll(512, 16);
-
- if (reader.Blob())
- {
- Char* buf = (Char*)reader.Blob();
-
- for (SizeT i = 0; i < reader.Size(); ++i)
- {
- if (buf[i] != '\n' && buf[i] != '\r')
- {
- if (buf[i] == '*')
- {
- writer.WriteCharacter('\t');
- }
- else
- {
- writer.WriteCharacter(buf[i]);
- }
- }
- else
- writer.Write(L"\r");
- }
- }
-
- ///
- /// The following checks for an exisiting partition
- /// inside the disk, if it doesn't have one,
- /// format the disk.
- //
+ // ---------------------------------------------------- //
+ // The following checks for an exisiting partition
+ // inside the disk, if it doesn't have one,
+ // format the disk.
+ // ---------------------------------------------------- //
BDiskFormatFactory<BootDeviceATA> diskFormatter;
- /// if not formated yet, then format it with the following folders:
- /// /, /Boot, /Applications.
+ // ---------------------------------------------------- //
+ // if not formated yet, then format it with the following folders:
+ // /, /Boot, /Applications.
+ // ---------------------------------------------------- //
if (!diskFormatter.IsPartitionValid())
{
BDiskFormatFactory<BootDeviceATA>::BFileDescriptor rootDesc{0};
@@ -261,7 +226,10 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle,
EFI::ExitBootServices(*MapKey, ImageHandle);
- /// Fallback to builtin kernel.
+ // ---------------------------------------------------- //
+ // Fallback to builtin kernel.
+ // ---------------------------------------------------- //
+
hal_init_platform(handoverHdrPtr);
EFI::Stop();
diff --git a/Boot/Sources/HEL/AMD64/BootPlatform.cxx b/Boot/Sources/HEL/AMD64/BootPlatform.cxx
index e700a8de..3db0bb6b 100644
--- a/Boot/Sources/HEL/AMD64/BootPlatform.cxx
+++ b/Boot/Sources/HEL/AMD64/BootPlatform.cxx
@@ -7,7 +7,6 @@
#include <BootKit/Platform.hxx>
#include <BootKit/Protocol.hxx>
#include <BootKit/BootKit.hxx>
-#include "HALKit/AMD64/Processor.hpp"
#ifdef __STANDALONE__
@@ -94,6 +93,8 @@ EXTERN_C UInt32 In32(UInt16 port)
#else
+#include <HALKit/AMD64/Processor.hpp>
+
void rt_hlt()
{
Kernel::HAL::rt_halt();
diff --git a/Boot/Sources/HEL/AMD64/New+Delete.cxx b/Boot/Sources/HEL/AMD64/New+Delete.cxx
index 647cddb1..7a90285b 100644
--- a/Boot/Sources/HEL/AMD64/New+Delete.cxx
+++ b/Boot/Sources/HEL/AMD64/New+Delete.cxx
@@ -7,9 +7,9 @@
#include <BootKit/Platform.hxx>
#include <BootKit/Protocol.hxx>
#include <BootKit/BootKit.hxx>
-#include <cstddef> /* Since we're using GCC for this EFI program. */
#ifdef __STANDALONE__
+#include <cstddef> /* Since we're using GCC for this EFI program. */
/// @brief Allocates a new object.
/// @param sz the size.
diff --git a/Boot/Sources/HEL/AMD64/Support.cxx b/Boot/Sources/HEL/AMD64/Support.cxx
index 8ebfb2ff..393c18b4 100644
--- a/Boot/Sources/HEL/AMD64/Support.cxx
+++ b/Boot/Sources/HEL/AMD64/Support.cxx
@@ -4,9 +4,13 @@
------------------------------------------- */
+#include <BootKit/BootKit.hxx>
+#include <FirmwareKit/EFI/API.hxx>
#include <FirmwareKit/EFI/EFI.hxx>
#include <FirmwareKit/Handover.hxx>
#include <BootKit/Vendor/Support.hxx>
+#include <KernelKit/MSDOS.hxx>
+#include <KernelKit/PE.hxx>
#ifdef __STANDALONE__
@@ -54,7 +58,7 @@ EXTERN_C size_t strlen(const char* whatToCheck)
return len;
}
-/// @brief somthing specific to the microsoft ABI, regarding checking the stack.
+/// @brief somthing specific to the Microsoft's ABI, When the stack grows too big.
EXTERN_C void ___chkstk_ms(void)
{
}
diff --git a/Boot/Sources/Root/SplashScreen.fmt b/Boot/Sources/Root/splash.text
index 4a851dc1..4a851dc1 100644
--- a/Boot/Sources/Root/SplashScreen.fmt
+++ b/Boot/Sources/Root/splash.text