diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-27 15:56:00 -0500 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-27 15:56:00 -0500 |
| commit | b968b1b35667f7f03119a4d891c72722bb24b663 (patch) | |
| tree | 6173011363c651301ff4ea13d8c8b719fd392ee4 /src | |
| parent | a710b34d680d55b08c5114c4a96a5a1c24f31f24 (diff) | |
chore: bootz: add alias for BootZ's handover header.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/boot/src/BootSupport.cc | 6 | ||||
| -rw-r--r-- | src/boot/src/BootTextWriter.cc | 32 | ||||
| -rw-r--r-- | src/boot/src/BootThread.cc | 4 | ||||
| -rw-r--r-- | src/kernel/HALKit/AMD64/HalHandoverStub.asm | 2 | ||||
| -rw-r--r-- | src/kernel/HALKit/ARM64/HalHandoverStub.s | 2 |
5 files changed, 26 insertions, 20 deletions
diff --git a/src/boot/src/BootSupport.cc b/src/boot/src/BootSupport.cc index d39ea884..ab3a5bd4 100644 --- a/src/boot/src/BootSupport.cc +++ b/src/boot/src/BootSupport.cc @@ -13,7 +13,11 @@ #include <KernelKit/PE.h> #ifdef __BOOTZ_STANDALONE__ -EXTERN_C int atexit(void (*f)()) { NE_UNUSED(f); return 0; } +/// @note This function is a stub, not implemented by the bootloader as of right now. (AMLALE) +EXTERN_C int atexit(void (*f)()) { + NE_UNUSED(f); + return 0; +} /// @brief memset definition in C++. /// @param dst destination pointer. diff --git a/src/boot/src/BootTextWriter.cc b/src/boot/src/BootTextWriter.cc index 0b53e845..92ace7d3 100644 --- a/src/boot/src/BootTextWriter.cc +++ b/src/boot/src/BootTextWriter.cc @@ -24,8 +24,6 @@ @brief puts wrapper over EFI ConOut. */ Boot::BootTextWriter& Boot::BootTextWriter::Write(const CharacterTypeUTF16* str) { - NE_UNUSED(str); - #ifdef __DEBUG__ if (!str || *str == 0) return *this; @@ -44,6 +42,8 @@ Boot::BootTextWriter& Boot::BootTextWriter::Write(const CharacterTypeUTF16* str) ST->ConOut->OutputString(ST->ConOut, strTmp); } } +#else + NE_UNUSED(str); #endif // ifdef __DEBUG__ return *this; @@ -52,8 +52,6 @@ Boot::BootTextWriter& Boot::BootTextWriter::Write(const CharacterTypeUTF16* str) /// @brief UTF-8 equivalent of Write (UTF-16). /// @param str the input string. Boot::BootTextWriter& Boot::BootTextWriter::Write(const Char* str) { - NE_UNUSED(str); - #ifdef __DEBUG__ if (!str || *str == 0) return *this; @@ -72,14 +70,14 @@ Boot::BootTextWriter& Boot::BootTextWriter::Write(const Char* str) { ST->ConOut->OutputString(ST->ConOut, strTmp); } } +#else + NE_UNUSED(str); #endif // ifdef __DEBUG__ return *this; } Boot::BootTextWriter& Boot::BootTextWriter::Write(const UChar* str) { - NE_UNUSED(str); - #ifdef __DEBUG__ if (!str || *str == 0) return *this; @@ -98,6 +96,8 @@ Boot::BootTextWriter& Boot::BootTextWriter::Write(const UChar* str) { ST->ConOut->OutputString(ST->ConOut, strTmp); } } +#else + NE_UNUSED(str); #endif // ifdef __DEBUG__ return *this; @@ -107,50 +107,50 @@ Boot::BootTextWriter& Boot::BootTextWriter::Write(const UChar* str) { @brief putc wrapper over EFI ConOut. */ Boot::BootTextWriter& Boot::BootTextWriter::WriteCharacter(CharacterTypeUTF16 c) { - NE_UNUSED(c); - #ifdef __DEBUG__ EfiCharType str[2]; str[0] = c; str[1] = 0; ST->ConOut->OutputString(ST->ConOut, str); +#else + NE_UNUSED(c); #endif // ifdef __DEBUG__ return *this; } Boot::BootTextWriter& Boot::BootTextWriter::Write(const UInt64& x) { - NE_UNUSED(x); - #ifdef __DEBUG__ + this->Write("0x"); this->_Write(x); - this->Write("h"); +#else + NE_UNUSED(x); #endif // ifdef __DEBUG__ return *this; } Boot::BootTextWriter& Boot::BootTextWriter::_Write(const UInt64& x) { - NE_UNUSED(x); - #ifdef __DEBUG__ UInt64 y = (x > 0 ? x : -x) / 16; UInt64 h = (x > 0 ? x : -x) % 16; if (y) this->_Write(y); - /* fail if the hex number is not base-16 */ + /// @note Let 'X' be an invalid number of hexadecimal base. if (h > 16) { - this->WriteCharacter('?'); + this->WriteCharacter('X'); return *this; } if (y == ~0UL) y = -y; - const char kNumberList[] = "0123456789ABCDEF"; + constexpr const char kNumberList[] = "0123456789ABCDEF"; this->WriteCharacter(kNumberList[h]); +#else + NE_UNUSED(x); #endif // ifdef __DEBUG__ return *this; diff --git a/src/boot/src/BootThread.cc b/src/boot/src/BootThread.cc index e3ca9221..55aebd49 100644 --- a/src/boot/src/BootThread.cc +++ b/src/boot/src/BootThread.cc @@ -84,6 +84,7 @@ BootThread::BootThread(VoidPtr blob) : fStartAddress(nullptr), fBlob(blob) { constexpr auto sectionForCode = ".text"; constexpr auto sectionForBootZ = ".ldr"; + constexpr auto sectionForBootZAlt = ".botz"; for (SizeT sectIndex = 0; sectIndex < numSecs; ++sectIndex) { LDR_SECTION_HEADER_PTR sect = §Ptr[sectIndex]; @@ -111,7 +112,8 @@ BootThread::BootThread(VoidPtr blob) : fStartAddress(nullptr), fBlob(blob) { #ifdef __NE_ARM64__ #endif - } else if (StrCmp(sectionForBootZ, sect->Name) == 0) { + } else if (StrCmp(sectionForBootZ, sect->Name) == 0 || + StrCmp(sectionForBootZAlt, sect->Name) == 0) { struct HANDOVER_INFORMATION_STUB { UInt64 HandoverMagic; UInt32 HandoverType; diff --git a/src/kernel/HALKit/AMD64/HalHandoverStub.asm b/src/kernel/HALKit/AMD64/HalHandoverStub.asm index c9cabd1c..b66f52e4 100644 --- a/src/kernel/HALKit/AMD64/HalHandoverStub.asm +++ b/src/kernel/HALKit/AMD64/HalHandoverStub.asm @@ -18,7 +18,7 @@ global _HandoverType global _HandoverPad global _HandoverArch -section .ldr +section .botz _HandoverMagic: dq kHandoverMagic diff --git a/src/kernel/HALKit/ARM64/HalHandoverStub.s b/src/kernel/HALKit/ARM64/HalHandoverStub.s index 5d5647c4..5fe7a24a 100644 --- a/src/kernel/HALKit/ARM64/HalHandoverStub.s +++ b/src/kernel/HALKit/ARM64/HalHandoverStub.s @@ -7,7 +7,7 @@ ;; * ======================================================== ;; */ -.section .ldr +.section .botz ;; // MAGIC .quad 0xDAB4 |
