summaryrefslogtreecommitdiffhomepage
path: root/Private/NewBoot/Source
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-04-27 22:10:15 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-04-27 22:10:15 +0200
commitdd6568c64e440fe9d8c75539165377ddbbca3e2c (patch)
treea37e126238a4908100b3aaf701c27d183fe68a63 /Private/NewBoot/Source
parent86a2d7327f84519f525d66a7745554b41dddeb93 (diff)
MHR-18: A lot of patches and fixes, big improvements as well.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/NewBoot/Source')
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/BootATA.cxx2
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/BootMain.cxx21
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/BootPlatform.cxx2
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/New+Delete.cxx2
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/Support.cxx2
5 files changed, 11 insertions, 18 deletions
diff --git a/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx b/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx
index 8ab7dc20..5be1e977 100644
--- a/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx
@@ -88,7 +88,7 @@ ATAInit_Retry:
boot_ata_wait_io(IO);
for (SizeT indexData = 0ul; indexData < kATADataLen; ++indexData) {
- kATAData[indexData] = In8(IO + ATA_REG_DATA);
+ kATAData[indexData] = In16(IO + ATA_REG_DATA);
}
OutBus =
diff --git a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx
index 226d5bff..36dc47d3 100644
--- a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx
@@ -12,6 +12,7 @@
#include <NewKit/Macros.hpp>
#include <BootKit/BootKit.hxx>
#include <NewKit/Ref.hpp>
+#include <FirmwareKit/Handover.hxx>
#include <cstring>
/// make the compiler shut up.
@@ -21,13 +22,11 @@
/** Graphics related. */
-EXTERN_C Void hal_init_platform(HEL::HandoverInformationHeader* HIH);
-
STATIC EfiGraphicsOutputProtocol* kGop = nullptr;
STATIC UInt16 kStride = 0U;
STATIC EfiGUID kGopGuid;
-EXTERN_C Void rt_jump_to_address(VoidPtr blob);
+EXTERN_C Void hal_init_platform(HEL::HandoverInformationHeader* HIH);
/**
@brief Finds and stores the GOP.
@@ -66,7 +65,7 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle,
writer.Write(L"Mahrouss-Logic (R) New Boot: ")
.Write(BVersionString::Shared());
- writer.Write(L"\r\nNewBoot: Firmware Vendor: ")
+ writer.Write(L"\r\nNew Boot: Firmware Vendor: ")
.Write(SystemTable->FirmwareVendor)
.Write(L"\r\n");
@@ -76,6 +75,7 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle,
UInt32* SzDesc = new UInt32();
UInt32* RevDesc = new UInt32();
+ *MapKey = 0;
*SizePtr = sizeof(EfiMemoryDescriptor);
HEL::HandoverInformationHeader* handoverHdrPtr = new HEL::HandoverInformationHeader();
@@ -125,19 +125,12 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle,
ToolboxClearRsrc();
- EfiPhysicalAddress* whereAddress =
- reinterpret_cast<EfiPhysicalAddress*>(kBootVirtualAddress);
-
BS->GetMemoryMap(SizePtr, Descriptor, MapKey, SzDesc, RevDesc);
handoverHdrPtr->f_PhysicalStart = (VoidPtr)Descriptor->PhysicalStart;
- handoverHdrPtr->f_FirmwareSpecific[0] = Descriptor->Attribute;
- handoverHdrPtr->f_FirmwareSpecific[1] = Descriptor->Kind;
-
-
- BS->AllocatePages(EfiAllocateType::AllocateAnyPages,
- EfiMemoryType::EfiConventionalMemory, 1, whereAddress);
+ handoverHdrPtr->f_FirmwareSpecific[HEL::kHandoverSpecificAttrib] = Descriptor->Attribute;
+ handoverHdrPtr->f_FirmwareSpecific[HEL::kHandoverSpecificKind] = Descriptor->Kind;
handoverHdrPtr->f_VirtualStart = (VoidPtr)Descriptor->VirtualStart;
handoverHdrPtr->f_VirtualSize = Descriptor->NumberOfPages; /* # of pages */
@@ -231,7 +224,7 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle,
EFI::ExitBootServices(*MapKey, ImageHandle);
- hal_init_platform(kHandoverHeader);
+ hal_init_platform(handoverHdrPtr);
EFI::Stop();
diff --git a/Private/NewBoot/Source/HEL/AMD64/BootPlatform.cxx b/Private/NewBoot/Source/HEL/AMD64/BootPlatform.cxx
index 2ac90dd8..fa735142 100644
--- a/Private/NewBoot/Source/HEL/AMD64/BootPlatform.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/BootPlatform.cxx
@@ -9,7 +9,7 @@
#include <BootKit/BootKit.hxx>
#include "HALKit/AMD64/Processor.hpp"
-#if 0
+#ifdef __STANDALONE__
EXTERN_C void rt_hlt() { asm volatile("hlt"); }
diff --git a/Private/NewBoot/Source/HEL/AMD64/New+Delete.cxx b/Private/NewBoot/Source/HEL/AMD64/New+Delete.cxx
index 909ccca6..8d811bd9 100644
--- a/Private/NewBoot/Source/HEL/AMD64/New+Delete.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/New+Delete.cxx
@@ -9,7 +9,7 @@
#include <BootKit/BootKit.hxx>
#include <cstddef> /* Since we're using GCC for this EFI program. */
-#if 0
+#ifdef __STANDALONE__
/// @brief Allocates a new object.
/// @param sz the size.
diff --git a/Private/NewBoot/Source/HEL/AMD64/Support.cxx b/Private/NewBoot/Source/HEL/AMD64/Support.cxx
index a8e2c275..686f4811 100644
--- a/Private/NewBoot/Source/HEL/AMD64/Support.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/Support.cxx
@@ -8,7 +8,7 @@
#include <FirmwareKit/Handover.hxx>
#include <BootKit/Vendor/Support.hxx>
-#if 0
+#ifdef __STANDALONE__
/// @brief memset definition in C++.
/// @param dst destination pointer.