From f83e7bddcf24433adbfc9214e0f8f8139f8b6362 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 1 Dec 2024 18:41:41 +0100 Subject: FIX: Fixing ARM64 execution when booting from bootloader. FIX: Now works both for ARM64 and AMD64 EFI backends. TODO: The ACB backend needs to be done too. Signed-off-by: Amlal El Mahrouss --- dev/ZBAKit/src/HEL/ARM64/BootAPI.S | 12 ++++++++++++ dev/ZBAKit/src/HEL/ARM64/BootMain.cc | 14 +++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 dev/ZBAKit/src/HEL/ARM64/BootAPI.S (limited to 'dev/ZBAKit/src') diff --git a/dev/ZBAKit/src/HEL/ARM64/BootAPI.S b/dev/ZBAKit/src/HEL/ARM64/BootAPI.S new file mode 100644 index 00000000..9a53dfc9 --- /dev/null +++ b/dev/ZBAKit/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 + br x19 + diff --git a/dev/ZBAKit/src/HEL/ARM64/BootMain.cc b/dev/ZBAKit/src/HEL/ARM64/BootMain.cc index 1d3d9150..99e321ee 100644 --- a/dev/ZBAKit/src/HEL/ARM64/BootMain.cc +++ b/dev/ZBAKit/src/HEL/ARM64/BootMain.cc @@ -9,12 +9,12 @@ #include #include -#ifndef cExpectedWidth -#define cExpectedWidth 844 +#ifndef kExpectedWidth +#define kExpectedWidth 844 #endif -#ifndef cExpectedHeight -#define cExpectedHeight 390 +#ifndef kExpectedHeight +#define kExpectedHeight 390 #endif EXTERN EfiBootServices* BS; @@ -52,8 +52,8 @@ EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr ImageHandle, writer.Write(infoPtr->VerticalResolution); writer.Write("\r"); - if (infoPtr->HorizontalResolution == cExpectedWidth && - infoPtr->VerticalResolution == cExpectedHeight) + if (infoPtr->HorizontalResolution == kExpectedWidth && + infoPtr->VerticalResolution == kExpectedHeight) { kGop->SetMode(kGop, i); break; @@ -69,7 +69,7 @@ EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr ImageHandle, auto kernel_thread = Boot::BThread(reader_kernel.Blob()); if (kernel_thread.IsValid()) - kernel_thread.Start(nullptr); + kernel_thread.Start(nullptr, YES); } CANT_REACH(); -- cgit v1.2.3