diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-12-26 21:19:14 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-12-26 21:19:14 +0100 |
| commit | 486425ed00acec134f8799bdde64bfd093c5fb55 (patch) | |
| tree | 5104af49b56f39d0b14941d76f9d6d746cd1677b /dev/Boot/src/HEL/ARM64 | |
| parent | c0f7f3f300d603d355fc7ec5be317afe1f0ee1b6 (diff) | |
IMPL: A lot of new changes, see details.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Boot/src/HEL/ARM64')
| -rw-r--r-- | dev/Boot/src/HEL/ARM64/.gitkeep | 0 | ||||
| -rw-r--r-- | dev/Boot/src/HEL/ARM64/BootAPI.S | 12 | ||||
| -rw-r--r-- | dev/Boot/src/HEL/ARM64/BootMain.cc | 76 | ||||
| -rw-r--r-- | dev/Boot/src/HEL/ARM64/BootPlatform.cc | 37 |
4 files changed, 125 insertions, 0 deletions
diff --git a/dev/Boot/src/HEL/ARM64/.gitkeep b/dev/Boot/src/HEL/ARM64/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/dev/Boot/src/HEL/ARM64/.gitkeep diff --git a/dev/Boot/src/HEL/ARM64/BootAPI.S b/dev/Boot/src/HEL/ARM64/BootAPI.S new file mode 100644 index 00000000..a60ad218 --- /dev/null +++ b/dev/Boot/src/HEL/ARM64/BootAPI.S @@ -0,0 +1,12 @@ +.global rt_jump_to_address + +.text + +/** + @brief this function setups a stack and then jumps to + a function */ +rt_jump_to_address: + mov x19, x0 + mov sp, x2 + blr x19 + diff --git a/dev/Boot/src/HEL/ARM64/BootMain.cc b/dev/Boot/src/HEL/ARM64/BootMain.cc new file mode 100644 index 00000000..fe35ea1b --- /dev/null +++ b/dev/Boot/src/HEL/ARM64/BootMain.cc @@ -0,0 +1,76 @@ +/* ------------------------------------------- + + Copyright (C) 2024, Theater Quality Inc, all rights reserved. + +------------------------------------------- */ + +#include <FirmwareKit/EFI/API.h> +#include <FirmwareKit/EFI.h> +#include <BootKit/Thread.h> +#include <BootKit/BootKit.h> + +#ifndef kExpectedWidth +#define kExpectedWidth 844 +#endif + +#ifndef kExpectedHeight +#define kExpectedHeight 390 +#endif + +EXTERN EfiBootServices* BS; + +STATIC EfiGraphicsOutputProtocol* kGop = nullptr; +STATIC UInt16 kGopStride = 0U; +STATIC EfiGUID kGopGuid; + +/// @brief Main EFI entrypoint. +/// @param ImageHandle Handle of this image. +/// @param SystemTable The system table of it. +/// @return nothing, never returns. +EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr ImageHandle, + EfiSystemTable* SystemTable) +{ + InitEFI(SystemTable); + + kGopGuid = EfiGUID(EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID); + kGop = nullptr; + + BS->LocateProtocol(&kGopGuid, nullptr, (VoidPtr*)&kGop); + + kGopStride = 4; + + Boot::BTextWriter writer; + + for (SizeT i = 0; i < kGop->Mode->MaxMode; ++i) + { + EfiGraphicsOutputProtocolModeInformation* infoPtr = nullptr; + UInt32 sz = 0U; + + kGop->QueryMode(kGop, i, &sz, &infoPtr); + + writer.Write(infoPtr->HorizontalResolution); + writer.Write(infoPtr->VerticalResolution); + writer.Write("\r"); + + if (infoPtr->HorizontalResolution == kExpectedWidth && + infoPtr->VerticalResolution == kExpectedHeight) + { + kGop->SetMode(kGop, i); + break; + } + } + + Boot::BFileReader reader_kernel(L"minoskrnl.exe", ImageHandle); + + reader_kernel.ReadAll(0); + + if (reader_kernel.Blob()) + { + auto kernel_thread = Boot::BThread(reader_kernel.Blob()); + + if (kernel_thread.IsValid()) + kernel_thread.Start(nullptr, YES); + } + + CANT_REACH(); +} diff --git a/dev/Boot/src/HEL/ARM64/BootPlatform.cc b/dev/Boot/src/HEL/ARM64/BootPlatform.cc new file mode 100644 index 00000000..df16bd40 --- /dev/null +++ b/dev/Boot/src/HEL/ARM64/BootPlatform.cc @@ -0,0 +1,37 @@ +/* ------------------------------------------- + + Copyright (C) 2024, Theater Quality Inc, all rights reserved. + +------------------------------------------- */ + +#include <BootKit/Platform.h> +#include <BootKit/Protocol.h> +#include <BootKit/BootKit.h> + +#ifdef __BOOTLDR_STANDALONE__ + +using namespace Boot; + +EXTERN_C void rt_hlt() +{ + while (Yes) + ; +} + +EXTERN_C void rt_cli() +{ +} + +EXTERN_C void rt_sti() +{ +} + +EXTERN_C void rt_cld() +{ +} + +EXTERN_C void rt_std() +{ +} + +#endif // __BOOTLDR_STANDALONE__ |
