diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-03 15:47:41 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-03 15:47:41 +0100 |
| commit | 83d4a3734178d93c73395a002c5a07d487be4e06 (patch) | |
| tree | 848244161775cfb94cc84bf0cbb7c011edbd9f4a | |
| parent | c7fe1ab6e2f97a7f0bfc6aaf97374f841fb63c0d (diff) | |
fix: BootThread.cpp: Fix regression.v0.1.4
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
| -rw-r--r-- | src/boot/src/BootThread.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/boot/src/BootThread.cpp b/src/boot/src/BootThread.cpp index d18026db..c0c72d8b 100644 --- a/src/boot/src/BootThread.cpp +++ b/src/boot/src/BootThread.cpp @@ -185,7 +185,29 @@ Int32 BootThread::Start(HEL::BootInfoHeader* handover, Bool own_stack) { writer.Write("BootZ: Starting: ").Write(fBlobName).Write("\r"); writer.Write("BootZ: Handover address: ").Write((UIntPtr) fHandover).Write("\r"); - return reinterpret_cast<HEL::HandoverProc>(fStartAddress)(fHandover); + if (own_stack) { + writer.Write("BootZ: Using it's own stack.\r"); + writer.Write("BootZ: Stack address: ").Write((UIntPtr) &fStack[kBootThreadSz - 1]).Write("\r"); + writer.Write("BootZ: Stack size: ").Write(kBootThreadSz).Write("\r"); + + fHandover->f_StackTop = &fStack[kBootThreadSz - 1]; + fHandover->f_StackSz = kBootThreadSz; + + auto ret = rt_jump_to_address(fStartAddress, fHandover, &fStack[kBootThreadSz - 1]); + + // we don't need the stack anymore. + + delete[] fStack; + fStack = nullptr; + + return ret; + } else { + writer.Write("BootZ: Using the bootloader's stack.\r"); + + return reinterpret_cast<HEL::HandoverProc>(fStartAddress)(fHandover); + } + + return kEfiFail; } const Char* BootThread::GetName() { |
