summaryrefslogtreecommitdiffhomepage
path: root/Private/NewBoot/BootKit/BootKit.hxx
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-02 09:13:50 +0000
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-02 09:13:50 +0000
commitf08c864e988f6f1f01985910955755220b37ecc8 (patch)
tree174a79ebbdd869e543df9d2aa97aea0343c84725 /Private/NewBoot/BootKit/BootKit.hxx
parent5c59cd35a2fa3e620542b73e8c3f66f0dccd241c (diff)
parentdf77fd9586cb305a738d5b4dfcdbe67177e3de3f (diff)
Merge branch 'HCR-9-add-support-for-file-load-hel-amd64' into 'trunk'
Merge Fixes and WiP Bootloader. See merge request mahrouss-logic/micro-kernel!3
Diffstat (limited to 'Private/NewBoot/BootKit/BootKit.hxx')
-rw-r--r--Private/NewBoot/BootKit/BootKit.hxx45
1 files changed, 44 insertions, 1 deletions
diff --git a/Private/NewBoot/BootKit/BootKit.hxx b/Private/NewBoot/BootKit/BootKit.hxx
index cec3bdc2..70519aba 100644
--- a/Private/NewBoot/BootKit/BootKit.hxx
+++ b/Private/NewBoot/BootKit/BootKit.hxx
@@ -14,6 +14,7 @@
#pragma once
+#include <BootKit/Arch/ATA.hxx>
#include <NewKit/Defines.hpp>
using namespace HCore;
@@ -27,7 +28,7 @@ enum {
kSegmentBss = 6,
};
-typedef wchar_t CharacterType;
+typedef WideChar CharacterType;
/**
* @brief BootKit Text Writer class
@@ -80,6 +81,7 @@ class BFileReader final {
private:
Int32 mErrorCode{kOperationOkay};
CharacterType mPath[255];
+ BATADevice mDevice;
};
/***********************************************************************************/
@@ -88,3 +90,44 @@ class BFileReader final {
#include <BootKit/Platform.hxx>
#include <BootKit/Protocol.hxx>
+
+/***********************************************************************************/
+/// Provide some useful processor features.
+/***********************************************************************************/
+
+#ifdef __EFI_x86_64__
+
+inline void Out8(UInt16 port, UInt8 value) {
+ asm volatile("outb %%al, %1" : : "a"(value), "Nd"(port) : "memory");
+}
+
+inline void Out16(UInt16 port, UInt16 value) {
+ asm volatile("outw %%ax, %1" : : "a"(value), "Nd"(port) : "memory");
+}
+
+inline void Out32(UInt16 port, UInt32 value) {
+ asm volatile("outl %%eax, %1" : : "a"(value), "Nd"(port) : "memory");
+}
+
+inline UInt8 In8(UInt16 port) {
+ UInt8 value = 0UL;
+ asm volatile("inb %1, %%al" : "=a"(value) : "Nd"(port) : "memory");
+
+ return value;
+}
+
+inline UInt16 In16(UInt16 port) {
+ UInt16 value = 0UL;
+ asm volatile("inw %1, %%ax" : "=a"(value) : "Nd"(port) : "memory");
+
+ return value;
+}
+
+inline UInt32 In32(UInt16 port) {
+ UInt32 value = 0UL;
+ asm volatile("inl %1, %%eax" : "=a"(value) : "Nd"(port) : "memory");
+
+ return value;
+}
+
+#endif // __EFI_x86_64__