summaryrefslogtreecommitdiffhomepage
path: root/Private/EFIKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-30 17:59:15 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-30 17:59:15 +0100
commit1be243700efc9e36060c5fb65c951d5db6b98e94 (patch)
tree2f57d5092f4de4798e80e80b6dd29f984edb7683 /Private/EFIKit
parent1d3bed385c9666db5b1803ee8e02a2c4fdcc9f29 (diff)
Add ROADMAP details, add EFI Library for bootloader.
Add assignee to code in MailMap. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/EFIKit')
-rw-r--r--Private/EFIKit/EFI.hxx8
-rw-r--r--Private/EFIKit/EFILib.hxx53
-rw-r--r--Private/EFIKit/UEFI.hxx10
3 files changed, 67 insertions, 4 deletions
diff --git a/Private/EFIKit/EFI.hxx b/Private/EFIKit/EFI.hxx
index 969b42b2..febed042 100644
--- a/Private/EFIKit/EFI.hxx
+++ b/Private/EFIKit/EFI.hxx
@@ -11,12 +11,11 @@
#define __EFI__
/**
-@brief HCore Implementation of UEFI protocols.
+@brief HCore Implementation of EFI.
@author Amlal El Mahrouss
*/
#include <NewKit/Defines.hpp>
-#include <cstdint>
using namespace HCore;
@@ -30,11 +29,12 @@ struct EfiBootServices;
struct EfiMemoryDescriptor;
struct EfiSystemTable;
-// Types
-
+/// @brief Core Handle Type
+/// This is like NT's Win32 HANDLE type.
typedef struct {
} *EfiHandlePtr;
+/* UEFI uses wide characters by default. */
typedef WideChar EfiCharType;
/// What's BootBolicy?
diff --git a/Private/EFIKit/EFILib.hxx b/Private/EFIKit/EFILib.hxx
new file mode 100644
index 00000000..6925d89c
--- /dev/null
+++ b/Private/EFIKit/EFILib.hxx
@@ -0,0 +1,53 @@
+/*
+ * ========================================================
+ *
+ * h-core
+ * Copyright 2024, Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#ifndef __EFI_LIB__
+#define __EFI_LIB__
+
+#include <EFIKit/EFI.hxx>
+
+inline EfiSystemTable* ST = nullptr;
+inline EfiBootServices* BS = nullptr;
+
+namespace Detail {
+/**
+@brief Stop Execution of Bootloader.
+@param SystemTable EFI System Table.
+*/
+Void Stop(EfiSystemTable* SystemTable) noexcept {
+ while (true) {
+ rt_cli();
+ rt_halt();
+ }
+}
+} // namespace Detail
+
+inline void KeInitEFI(EfiSystemTable* SystemTable) noexcept {
+ ST = SystemTable;
+ BS = ST->BootServices;
+}
+
+inline void KeRuntimeStop(const EfiCharType* File,
+ const EfiCharType* Reason) noexcept {
+ ST->ConOut->OutputString(ST->ConOut, L"*** STOP ***\r\n");
+
+ ST->ConOut->OutputString(ST->ConOut, L"*** File:");
+ ST->ConOut->OutputString(ST->ConOut, File);
+ ST->ConOut->OutputString(ST->ConOut, L", Reason:");
+ ST->ConOut->OutputString(ST->ConOut, Reason);
+ ST->ConOut->OutputString(ST->ConOut, L" ***\r\n");
+
+ Detail::Stop(ST);
+}
+
+#ifdef __BOOTLOADER__
+#include <BootKit/Processor.hxx>
+#endif // IF TARGET=BOOTLOADER
+
+#endif /* ifndef __EFI_LIB__ */
diff --git a/Private/EFIKit/UEFI.hxx b/Private/EFIKit/UEFI.hxx
new file mode 100644
index 00000000..aeee81cb
--- /dev/null
+++ b/Private/EFIKit/UEFI.hxx
@@ -0,0 +1,10 @@
+/*
+ * ========================================================
+ *
+ * h-core
+ * Copyright 2024, Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#include <EFIKit/EFI.hxx>