Code: Select all
static EFI_SYSTEM_TABLE* efi;
extern "C" EFIAPI EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE* systemTable)
{
efi = systemTable;
printf("Kiznix EFI Application (efi_main) - %d bits.", sizeof(void*)*8);
// Wait for a key press
UINTN index;
EFI_EVENT event = systemTable->ConIn->WaitForKey;
systemTable->BootServices->WaitForEvent(1, &event, &index);
return EFI_SUCCESS;
}
// TODO: If I move this function above efi_main(), it crashes on Virtual Box (32 bits).
// It works fine in 64 bits. No idea.
extern "C" int putchar(int i)
{
CHAR16 c = (CHAR16)i;
CHAR16 s[2] = { c, 0 };
SIMPLE_TEXT_OUTPUT_INTERFACE* out = efi->ConOut;
out->OutputString(out, s);
return c;
}
Again, this works fine in 64 bits on 3 platforms and the order of the functions doesn't matter. I only have the issue in 32 bits in virtualbox. I do not have any other system/emulator that will even attempt to boot bootia32.efi.
Google returns nothing.
Any idea?