ThatCodingGuy89 wrote:
Octocontrabass wrote:
Personally, I'd rather use a compiler that can directly target UEFI so no wrapper is needed.
Such as?
Clang or MinGW-w64 GCC. They don't actually have a preset UEFI target, but the Windows target is close enough - you just need a few extra options to create an EFI binary. With GCC, I also use a custom linker script, although I'm pretty sure that's not actually necessary.
I use something like this:
Code:
clang --target=x86_64-windows -ffreestanding -nostdlib -mno-stack-arg-probe -mgeneral-regs-only -fuse-ld=lld-link -Wl,-entry:efi_main -Wl,-subsystem:efi_application -Wl,-largeaddressaware
x86_64-w64-mingw32-gcc -ffreestanding -nostdlib -mno-stack-arg-probe -mgeneral-regs-only -pie -s -Wl,--subsystem,10 -e efi_main -T uefi.ld
ThatCodingGuy89 wrote:
I just did, I decided the reasonable first thing to check would be NumberOfPages, and it says 0.
Does it say that in all of the memory map entries, or just one of them? In QEMU I see around 100 entries.
ThatCodingGuy89 wrote:
I know you can make an ELF executable relocatable, but to my knowledge, this requires loader support, which I honestly don't want to deal with, as it's been difficult enough parsing the ELF header.
Or you can use paging to map your ELF executable wherever it needs to be. Build your page tables, call ExitBootServices(), switch to your page tables, and jump to your kernel. This way, you're not depending on any particular physical address being available, but your kernel doesn't need to be relocatable.