diff options
Diffstat (limited to 'Boot/Sources')
| -rw-r--r-- | Boot/Sources/HEL/AMD64/BootMain.cxx | 29 | ||||
| -rw-r--r-- | Boot/Sources/HEL/AMD64/New+Delete.cxx | 2 | ||||
| -rw-r--r-- | Boot/Sources/ProgramLoader.cxx | 9 |
3 files changed, 25 insertions, 15 deletions
diff --git a/Boot/Sources/HEL/AMD64/BootMain.cxx b/Boot/Sources/HEL/AMD64/BootMain.cxx index 8705f4a8..5e0c8b05 100644 --- a/Boot/Sources/HEL/AMD64/BootMain.cxx +++ b/Boot/Sources/HEL/AMD64/BootMain.cxx @@ -227,8 +227,6 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, diskFormatter.Format(kMachineModel, &rootDesc, 1); } -#ifdef __NEWOS_OTA__ - BFileReader readerKernel(L"newoskrnl.exe", ImageHandle); readerKernel.ReadAll(0); @@ -236,30 +234,35 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, Boot::ProgramLoader* loader = nullptr; // ------------------------------------------ // - // If we succeed in reading the blob, then execute it. + // If we succeed in reading the blob, then execute it. // ------------------------------------------ // if (readerKernel.Blob()) { loader = new Boot::ProgramLoader(readerKernel.Blob()); - loader->SetName("\"newoskrnl.exe\" (ZKA 64-bit MP)"); + loader->SetName("\"newoskrnl.exe\" (64-bit MP)"); } - writer.Write("Running: ").Write(loader->GetName()).Write("\r"); + if (!loader->IsValid()) + { + writer.Write("newosldr: Invalid kernel image!\r"); + + EFI::Stop(); -#endif // ifdef __NEWOS_OTA__ + CANT_REACH(); + } + + writer.Write("newosldr: ").Write(loader->GetName()).Write("\r"); + + CopyMem(handoverHdrPtr->f_CommandLine[0], "/SMP", StrLen("/SMP")); EFI::ExitBootServices(*MapKey, ImageHandle); // ---------------------------------------------------- // - // Call OTA kernel or fallback to builtin. + // Call kernel. // ---------------------------------------------------- // -#ifdef __NEWOS_OTA__ - if (loader) - loader->Start(handoverHdrPtr); -#else - hal_init_platform(handoverHdrPtr); -#endif // ifdef __NEWOS_OTA__ + + loader->Start(handoverHdrPtr); EFI::Stop(); diff --git a/Boot/Sources/HEL/AMD64/New+Delete.cxx b/Boot/Sources/HEL/AMD64/New+Delete.cxx index 15903bb4..62dcda35 100644 --- a/Boot/Sources/HEL/AMD64/New+Delete.cxx +++ b/Boot/Sources/HEL/AMD64/New+Delete.cxx @@ -11,6 +11,8 @@ #ifdef __STANDALONE__ #include <cstddef> /* Since we're using GCC for this EFI program. */ +EXTERN EfiBootServices* BS; + /// @brief Allocates a new object. /// @param sz the size. /// @return diff --git a/Boot/Sources/ProgramLoader.cxx b/Boot/Sources/ProgramLoader.cxx index 4ea0d4c6..fabd1c63 100644 --- a/Boot/Sources/ProgramLoader.cxx +++ b/Boot/Sources/ProgramLoader.cxx @@ -39,13 +39,13 @@ namespace Boot if (firstBytes[0] == kMagMz0 && firstBytes[1] == kMagMz1) { - writer.Write("newosldr: MZ executable detected.\r"); + writer.Write("newosldr: Windows executable detected.\r"); ExecHeaderPtr hdrPtr = (ldr_find_exec_header(firstBytes)); ExecOptionalHeaderPtr optHdr = (ldr_find_opt_exec_header(firstBytes)); // Parse PE32+ - fStartAddress = (VoidPtr)((UIntPtr)optHdr->mImageBase + optHdr->mBaseOfCode + optHdr->mAddressOfEntryPoint); + fStartAddress = (VoidPtr)(optHdr->mAddressOfEntryPoint); fStackPtr = new Char[optHdr->mSizeOfStackReserve]; writer.Write("newosldr: Major Linker: ").Write(optHdr->mMajorLinkerVersion).Write("\r"); @@ -112,4 +112,9 @@ namespace Boot { CopyMem(fBlobName, name, StrLen(name)); } + + bool ProgramLoader::IsValid() + { + return fStartAddress != nullptr; + } } // namespace Boot |
