Code: Select all
#include <efi.h>
#include <efilib.h>
extern "C" EFI_STATUS EFIAPI efi_main(EFI_HANDLE ImageHandle,
EFI_SYSTEM_TABLE *SystemTable) {
InitializeLib(ImageHandle, SystemTable);
Print((CHAR16*) "Hello world!");
while (true) {
}
return EFI_SUCCESS;
}
Code: Select all
src/boot/uefi.cpp: In function ‘EFI_STATUS efi_main(EFI_HANDLE, EFI_SYSTEM_TABLE*)’:
src/boot/uefi.cpp:16:23: error: invalid conversion from ‘const wchar_t*’ to ‘CHAR16* {aka short unsigned int*}’ [-fpermissive]
Print(L"Hello world!");
^
In file included from src/boot/uefi.cpp:9:0:
gnu-efi/headers/efilib.h:404:1: note: initializing argument 1 of ‘UINTN Print(CHAR16*, ...)’
Print (
^
Code: Select all
!!!! X64 Exception Type - 0000000000000006 CPU Apic ID - 00000000 !!!!
RIP - 0000000006764030, CS - 0000000000000028, RFLAGS - 0000000000000292
RAX - 0000000006772E98, RCX - 0000000000000000, RDX - 0000000007F21F18
RBX - 0000000007F21F18, RSP - 0000000007F94B40, RBP - 0000000007F94B60
RSI - 0000000007F21F1C, RDI - 0000000006772E9A
R8 - 0000000000000000, R9 - 0000000007D4DF18, R10 - 0000000006EF3F60
R11 - 0000000006EFCE30, R12 - 0000000000000000, R13 - 0000000000000000
R14 - 0000000000000000, R15 - 0000000000000000
DS - 0000000000000008, ES - 0000000000000008, FS - 0000000000000008
GS - 0000000000000008, SS - 0000000000000008
CR0 - 0000000080000033, CR2 - 0000000000000000, CR3 - 0000000007F33000
CR4 - 0000000000000668, CR8 - 0000000000000000
DR0 - 0000000000000000, DR1 - 0000000000000000, DR2 - 0000000000000000
DR3 - 0000000000000000, DR6 - 00000000FFFF0FF0, DR7 - 0000000000000400
GDTR - 0000000007F1CE98 000000000000003F, LDTR - 0000000000000000
IDTR - 0000000007C07018 0000000000000FFF, TR - 0000000000000000
FXSAVE_STATE - 0000000007F947A0
!!!! Find PE image (No PDB) (ImageBase=000000000675F000, EntryPoint=0000000006761038) !!!!
I try to distance myself from Microsoft, so I'm not familiar with the calling conventions. I'm assuming that's what the problem is.
To make sure it's not a problem with building, I directly copied the tutorial. It seems to work fine (printing "Hello, World!"), but as soon as I try to switch to C++, I get these errors.
Thanks!