[haiku-development] Re: haiku_loader.efi on arm!

  • From: "Alexander von Gluck IV" <kallisti5@xxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 02 Apr 2020 21:19:00 +0000

March 10, 2020 8:56 AM, "Alexander von Gluck IV" <kallisti5@xxxxxxxxxxx> wrote:

Good morning!

A bit of good news. The EFI haiku_loader now compiles for arm and (attempts) 
to start.

Change:

build/jam/ArchitectureRules:
HAIKU_KERNEL_PLATFORM ?= efi ;
HAIKU_BOOT_TARGETS += efi ;

jam -q @minimum-mmc

Attempting to boot the haiku_loader.efi under qemu:

qemu-system-arm -M virt -m 1024 -bios /usr/share/edk2/arm/QEMU_EFI.fd -net 
none -drive
file=fat:rw:objects/haiku/arm/release/system/boot/efi/

fs0:
haiku_loader.efi


A tiny bit of progress.

diff --git a/src/system/boot/platform/efi/start.cpp 
b/src/system/boot/platform/efi/start.cpp
index c0e535c66e..7096f87c58 100644
--- a/src/system/boot/platform/efi/start.cpp
+++ b/src/system/boot/platform/efi/start.cpp
@@ -187,9 +187,19 @@ efi_main(efi_handle image, efi_system_table *systemTable)
 
        call_ctors();
 
+       kSystemTable->ConOut->OutputString(kSystemTable->ConOut, 
(char16_t*)L"Hello!");
+       kSystemTable->ConOut->OutputString(kSystemTable->ConOut, 
(char16_t*)L"Hello Again!");
+
+       kSystemTable->ConOut->OutputString(kSystemTable->ConOut, 
(char16_t*)L"Hello 2!");
+
        console_init();
+       kSystemTable->ConOut->OutputString(kSystemTable->ConOut, 
(char16_t*)L"Hello 3!");
        serial_init();
+       kSystemTable->ConOut->OutputString(kSystemTable->ConOut, 
(char16_t*)L"Hello 4!");
        serial_enable();
+       kSystemTable->ConOut->OutputString(kSystemTable->ConOut, 
(char16_t*)L"Hello 5!");
+
+       panic("Shouldn't get here!");
 
        sBootOptions = console_check_boot_keys();
 


Results in:
FS0:\> haiku_loader.efi '.' Success
FSOpen: Open '\haiku_loader.efi' Success
[Security] 3rd party image[0] can be loaded after EndOfDxe: 
PciRoot(0x0)/Pci(0x1,0x0)/HD(1,MBR,0xBE1AFDFA,0x3F,0xFBFC1)/\haiku_loader.efi.
InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B 5DA329A8
Loading driver at 0x0005C4B4000 EntryPoint=0x0005C4B4138
Loading driver at 0x0005C4B4000 EntryPoint=0x0005C4B4138 
InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 5DA33190
ProtectUefiImageCommon - 0x5DA329A8
  - 0x000000005C4B4000 - 0x000000000004A4E4
!!!!!!!!  ProtectUefiImageCommon - Section Alignment(0x20) is incorrect  
!!!!!!!!
InstallProtocolInterface: 752F3136-4E16-4FDC-A22A-E5F46812F4CA 5FA7BB2C
Hello!
Data Abort Exception PC at 0x5C4B49C4  CPSR 0x40000013 
Data Abort Exception PC at 0x5C4B49C4  CPSR 0x40000013 nZcveaift_svc

  R0 0x00000000   R1 0x00032610   R2 0x00000000   R3 0x00800080
  R4 0x00000000   R5 0x5DA32D10   R6 0x5C4F0088   R7 0x00043030
  R8 0x5FA7BA90   R9 0x00000000  R10 0x5C5560A8  R11 0x5FA7BB20
 R12 0xFFFFFFB4   SP 0x5FA7BA90   LR 0x5C535407   PC 0x5C4B49C4
DFSR 0x00000005 DFAR 0x008000AC IFSR 0x00000000 IFAR 0x00000000
 Translation fault on Section: read from 0x008000AC

ASSERT [ArmCpuDxe] 
/builddir/build/BUILD/edk2-edk2-stable201905/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c(267):
 ((BOOLEAN)(0==1))

The "Section Alignment" errors are "normal" errors.


Anyone know why "calling EFI functions more than once" results in the exception?

X512 found a 64-bit assumption in the Fuchsia efi code... maybe there are more?

 -- Alex

Other related posts: