summaryrefslogtreecommitdiffhomepage
path: root/Private/NewBoot
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-30 23:15:54 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-30 23:15:54 +0100
commit7bed9287589293bd9d712d152539591dee0b28c0 (patch)
tree63977e35e13da414db1ea67d25a75a88ff1bc306 /Private/NewBoot
parent71a35e96d5597fca8882e96976e9461dc3dd85e9 (diff)
Add BFileReader class, next step will be implementing .Size(),
.Read() Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/NewBoot')
-rw-r--r--Private/NewBoot/BootKit/BootKit.hxx25
-rw-r--r--Private/NewBoot/BootKit/Platform.hxx (renamed from Private/NewBoot/BootKit/Processor.hxx)0
-rw-r--r--Private/NewBoot/BootKit/compile_flags.txt2
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/BootKit.cxx12
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx6
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/Platform.cxx2
6 files changed, 35 insertions, 12 deletions
diff --git a/Private/NewBoot/BootKit/BootKit.hxx b/Private/NewBoot/BootKit/BootKit.hxx
index 9c0ec863..e4c14d3a 100644
--- a/Private/NewBoot/BootKit/BootKit.hxx
+++ b/Private/NewBoot/BootKit/BootKit.hxx
@@ -31,16 +31,15 @@ typedef wchar_t CharacterType;
/**
* @brief BootKit Text Writer class
- * Writes to VGA.
+ * Writes to UEFI StdOut.
*/
class BTextWriter final {
public:
- void WriteString(const CharacterType *str);
-
- void WriteCharacter(CharacterType c);
+ BTextWriter &WriteString(const CharacterType *str);
+ BTextWriter &WriteCharacter(CharacterType c);
public:
- BTextWriter() = default;
+ explicit BTextWriter() = default;
~BTextWriter() = default;
public:
@@ -51,9 +50,23 @@ class BTextWriter final {
HCore::SizeT BStrLen(const char *ptr);
HCore::SizeT BSetMem(char *src, const char byte, const HCore::SizeT len);
+/**
+ * @brief BootKit File Reader class
+ * Reads using the UEFI Simple File protocol.
+ */
+class BFileReader final {
+ public:
+ explicit BFileReader() = default;
+ ~BFileReader() = default;
+
+ public:
+ BFileReader &operator=(const BFileReader &) = default;
+ BFileReader(const BFileReader &) = default;
+};
+
/***********************************************************************************/
/// Include other APIs.
/***********************************************************************************/
-#include <BootKit/Processor.hxx>
+#include <BootKit/Platform.hxx>
#include <BootKit/Protocol.hxx>
diff --git a/Private/NewBoot/BootKit/Processor.hxx b/Private/NewBoot/BootKit/Platform.hxx
index d4143094..d4143094 100644
--- a/Private/NewBoot/BootKit/Processor.hxx
+++ b/Private/NewBoot/BootKit/Platform.hxx
diff --git a/Private/NewBoot/BootKit/compile_flags.txt b/Private/NewBoot/BootKit/compile_flags.txt
new file mode 100644
index 00000000..45e268ea
--- /dev/null
+++ b/Private/NewBoot/BootKit/compile_flags.txt
@@ -0,0 +1,2 @@
+-std=c++20
+-I../
diff --git a/Private/NewBoot/Source/HEL/AMD64/BootKit.cxx b/Private/NewBoot/Source/HEL/AMD64/BootKit.cxx
index 19df55b0..b59c0140 100644
--- a/Private/NewBoot/Source/HEL/AMD64/BootKit.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/BootKit.cxx
@@ -10,7 +10,7 @@
#include <BootKit/BootKit.hxx>
#include <EFIKit/EFILib.hxx>
-#include "EFIKit/EFI.hxx"
+/// bugs 0
HCore::SizeT BStrLen(const char *ptr) {
long long int cnt = 0;
@@ -41,18 +41,22 @@ HCore::SizeT BSetMem(char *src, const char byte, const HCore::SizeT len) {
/**
@brief puts wrapper over VGA.
*/
-void BTextWriter::WriteString(const CharacterType *str) {
- if (*str == 0 || !str) return;
+BTextWriter &BTextWriter::WriteString(const CharacterType *str) {
+ if (*str == 0 || !str) return *this;
ST->ConOut->OutputString(ST->ConOut, str);
+
+ return *this;
}
/**
@brief putc wrapper over VGA.
*/
-void BTextWriter::WriteCharacter(CharacterType c) {
+BTextWriter &BTextWriter::WriteCharacter(CharacterType c) {
EfiCharType str[2];
str[0] = c;
str[1] = 0;
ST->ConOut->OutputString(ST->ConOut, str);
+
+ return *this;
}
diff --git a/Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx b/Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx
index 89b3ece2..862226c2 100644
--- a/Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/Entrypoint.cxx
@@ -19,10 +19,14 @@ EFI_EXTERN_C int EfiMain(EfiHandlePtr ImageHandle,
KeInitEFI(SystemTable);
BTextWriter writer;
- writer.WriteString(L"HCoreLdr: Booting from disk...\r\n");
+ writer.WriteString(L"HCoreLdr: Booting from disk...").WriteString(L"\r\n");
+
+ UInt64 mapKey = 0;
// TODO: Jump Code
+ EFI::ExitBootServices(SystemTable, mapKey, ImageHandle);
EFI::Stop(SystemTable);
+
return kEfiOk;
}
diff --git a/Private/NewBoot/Source/HEL/AMD64/Platform.cxx b/Private/NewBoot/Source/HEL/AMD64/Platform.cxx
index f72e0be1..729320b8 100644
--- a/Private/NewBoot/Source/HEL/AMD64/Platform.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/Platform.cxx
@@ -14,7 +14,7 @@
*
*/
-#include <BootKit/Processor.hxx>
+#include <BootKit/Platform.hxx>
extern "C" void rt_halt(void) { asm volatile("hlt"); }