Actually this is the second time I compile UEFI app, the first one I think is UEFI boot services driver, from:
https://github.com/MichalStrehovsky/zerosharp (efi-no-runtime, C#)
This is what I get when I run my Hi.EFI.

The source code is in Assembly language, to be compiled by FASM.
CODE
format PE64 EFI DLL on 'nul'
section '.code' code readable executable
entry $
; in: rcx = ImageHandle
; rdx = SystemTable
sub rsp,32
mov rcx, qword [rdx + 0x40]
lea rdx, [_msg]
call qword [rcx + 0x08]
add rsp, 32
retn
_msg db 'H',0,'e',0,'l',0,'l',0,'o',0,13,0,10,0,0,0
section '.code' code readable executable
entry $
; in: rcx = ImageHandle
; rdx = SystemTable
sub rsp,32
mov rcx, qword [rdx + 0x40]
lea rdx, [_msg]
call qword [rcx + 0x08]
add rsp, 32
retn
_msg db 'H',0,'e',0,'l',0,'l',0,'o',0,13,0,10,0,0,0
Actually I skipped the various struct definition, by directly pointing to the offset in EFI_SYSTEM_TABLE and EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.
I think my code is the shortest possible. Also I learned that text string in UEFI must be UTF-16 .
If you ask me what can I add to this "Hello" UEFI App, maybe can change it to accept key input from user.
This is how I run it:
CODE
"C:\Program Files\qemu\qemu-system-x86_64" -bios OVMF.fd -hda fat:rw:LYN/
LYN is a subfolder where I put Hi.EFI (1024 bytes) executable.
Before I forget, the "on 'nul'" in
CODE
format PE64 EFI DLL on 'nul'
...is to tell the assembler stop generating DOS stub for this EFI App, from what I heard from Tomasz Grystarz.
Dec 10 2023, 06:18 AM, updated 2y ago
Quote
0.0120sec
0.54
5 queries
GZIP Disabled