summaryrefslogtreecommitdiffhomepage
path: root/Private/NewBoot/Source
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-13 16:21:59 +0000
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-13 16:21:59 +0000
commitddc819e396d7b9626b832b092f6298c0faaccde4 (patch)
tree81527a21bdf4ae8f14fb8acd0ff04d9d127f24d3 /Private/NewBoot/Source
parenta4af4dc720a0ba8d4c3a23e05825989329a48a2f (diff)
parentb75417b44d5f63ea0ead68cbe8f62bd76df62229 (diff)
Merge branch 'HCR-15' into 'trunk'
HCR-15: Load Kernel into memory. See merge request mahrouss-logic/micro-kernel!5
Diffstat (limited to 'Private/NewBoot/Source')
-rw-r--r--Private/NewBoot/Source/RuntimeMain.cxx20
-rw-r--r--Private/NewBoot/Source/makefile2
2 files changed, 7 insertions, 15 deletions
diff --git a/Private/NewBoot/Source/RuntimeMain.cxx b/Private/NewBoot/Source/RuntimeMain.cxx
index a520b980..a6e4015c 100644
--- a/Private/NewBoot/Source/RuntimeMain.cxx
+++ b/Private/NewBoot/Source/RuntimeMain.cxx
@@ -15,15 +15,7 @@
#include <KernelKit/PE.hpp>
#include <NewKit/Ref.hpp>
-namespace Detail {
-constexpr Int32 kBufferReadSz = 2048;
-
-auto FindPEHeader(DosHeaderPtr ptrDos) -> ExecHeaderPtr {
- if (!ptrDos) return nullptr;
-
- return (ExecHeaderPtr)(&ptrDos->eLfanew + 1);
-}
-} // namespace Detail
+#define kBufferReadSz 2048
EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle,
EfiSystemTable* SystemTable) {
@@ -54,17 +46,17 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle,
BFileReader img(L"HCOREKRNL.EXE", ImageHandle);
- img.Size() = Detail::kBufferReadSz;
+ img.Size() = kBufferReadSz;
img.Read();
if (img.Error() == BFileReader::kOperationOkay) {
BlobType blob = (BlobType)img.Blob();
- DosHeaderPtr ptrDos = reinterpret_cast<DosHeaderPtr>(blob);
- ExecHeaderPtr ptrHdr = Detail::FindPEHeader(ptrDos);
+ ExecHeaderPtr ptrHdr = reinterpret_cast<ExecHeaderPtr>(
+ HCore::rt_find_exec_header(reinterpret_cast<DosHeaderPtr>(blob)));
- if (ptrDos->eMagic[0] == kMagMz0 && ptrDos->eMagic[1] == kMagMz1 &&
- ptrHdr->mMachine == EFI::Platform() && ptrHdr->mMagic == kPeMagic) {
+ if (ptrHdr && ptrHdr->mMachine == EFI::Platform() &&
+ ptrHdr->mMagic == kPeMagic) {
if (ptrHdr->mNumberOfSections > 1) {
UInt64 MapKey = 0;
diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile
index 23678e9d..fab7453d 100644
--- a/Private/NewBoot/Source/makefile
+++ b/Private/NewBoot/Source/makefile
@@ -22,7 +22,7 @@ bootloader-amd64:
$(ASM) $(FLAG_ASM) HEl/AMD64/AMD64-VirtualMemory.asm
$(LD_GNU) $(OBJ) $(LD_FLAGS) -o HCoreLdr.exe
cp HCoreLdr.exe CDROM/EFI/BOOT/BOOTX64.EFI
- cp ../../HCoreKrnl.exe CDROM/HCOREKRNL.EXE
+ cp ../../HCoreKrnl.exe CDROM/HCOREKRNL.EXE && cp ../../Root/System/LookAndFeel.css CDROM/LOOK.CSS
.PHONY: run-efi-amd64
run-efi-amd64: