summaryrefslogtreecommitdiffhomepage
path: root/dev/boot
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-04-04 08:04:54 +0200
committerGitHub <noreply@github.com>2025-04-04 08:04:54 +0200
commitc1a67bfb86ce452383eddfdbe14135935f3ddcb3 (patch)
treecc8d6f2b41a081e20ad2a4a30b4430722ff9edde /dev/boot
parentf7e742096821e7d0f53f3c3cd1912b5a4987ee92 (diff)
parent84f641139c7f28133a0ea44bccb02e9d2ac524d8 (diff)
Merge pull request #9 from amlel-el-mahrouss/dev
kernel, storage/pr: merging important patches.
Diffstat (limited to 'dev/boot')
-rw-r--r--dev/boot/amd64-desktop.make2
-rw-r--r--dev/boot/src/BootThread.cc18
2 files changed, 8 insertions, 12 deletions
diff --git a/dev/boot/amd64-desktop.make b/dev/boot/amd64-desktop.make
index b0f81a39..6e796752 100644
--- a/dev/boot/amd64-desktop.make
+++ b/dev/boot/amd64-desktop.make
@@ -119,7 +119,7 @@ run-efi-amd64-ahci:
.PHONY: run-efi-amd64-ata-pio
run-efi-amd64-ata-pio:
- $(EMU) $(EMU_FLAGS) -device piix3-ide,id=ide -drive id=disk,file=$(IMG),format=raw,if=none -device ide-hd,drive=disk,bus=ide.0 -s -S
+ $(EMU) $(EMU_FLAGS) -device piix3-ide,id=ide -drive id=disk,file=$(IMG),format=raw,if=none -device ide-hd,drive=disk,bus=ide.0 -s -S -d int
.PHONY: run-efi-amd64-ata-dma
run-efi-amd64-ata-dma:
diff --git a/dev/boot/src/BootThread.cc b/dev/boot/src/BootThread.cc
index aac3c931..ee70812f 100644
--- a/dev/boot/src/BootThread.cc
+++ b/dev/boot/src/BootThread.cc
@@ -73,23 +73,18 @@ namespace Boot
writer.Write("BootZ: Minor Subsystem Ver: ").Write(opt_header_ptr->MinorSubsystemVersion).Write("\r");
writer.Write("BootZ: Magic: ").Write(header_ptr->Signature).Write("\r");
- constexpr auto cPageSize = 512;
-
EfiPhysicalAddress loadStartAddress = opt_header_ptr->ImageBase;
loadStartAddress += opt_header_ptr->BaseOfData;
writer.Write("BootZ: Image base: ").Write(loadStartAddress).Write("\r");
- auto numPages = opt_header_ptr->SizeOfImage / cPageSize;
- BS->AllocatePages(AllocateAddress, EfiLoaderData, numPages, &loadStartAddress);
-
fStack = new UInt8[mib_cast(16)];
LDR_SECTION_HEADER_PTR sectPtr = (LDR_SECTION_HEADER_PTR)(((Char*)opt_header_ptr) + header_ptr->SizeOfOptionalHeader);
- constexpr auto sectionForCode = ".text";
- constexpr auto sectionForNewLdr = ".ldr";
- constexpr auto sectionForBSS = ".bss";
+ constexpr auto sectionForCode = ".text";
+ constexpr auto sectionForBootZ = ".ldr";
+ constexpr auto sectionForBSS = ".bss";
for (SizeT sectIndex = 0; sectIndex < numSecs; ++sectIndex)
{
@@ -114,7 +109,7 @@ namespace Boot
fStartAddress = (VoidPtr)((UIntPtr)loadStartAddress + opt_header_ptr->AddressOfEntryPoint);
writer.Write("BootZ: Executable entry address: ").Write((UIntPtr)fStartAddress).Write("\r");
}
- else if (StrCmp(sectionForNewLdr, sect->Name) == 0)
+ else if (StrCmp(sectionForBootZ, sect->Name) == 0)
{
struct HANDOVER_INFORMATION_STUB
{
@@ -159,8 +154,9 @@ namespace Boot
// ========================================= //
fStartAddress = nullptr;
+
writer.Write("BootZ: PEF executable detected, won't load it.\r");
- writer.Write("BootZ: note: PEF executables aren't loadable by default.\r");
+ writer.Write("BootZ: note: PEF executables aren't supported for now.\r");
}
else
{
@@ -187,7 +183,7 @@ namespace Boot
if (own_stack)
{
- UInt8* aligned_stack = &fStack[mib_cast(16)];
+ UInt8* aligned_stack = &fStack[mib_cast(16) - 1];
aligned_stack = (UInt8*)((UIntPtr)aligned_stack & ~0xF);
rt_jump_to_address(fStartAddress, fHandover, aligned_stack);