I've recently found myself following this tutorial: https://johv.dk/blog/bare-metal-assembly-tutorial
I've followed all steps, and my file boots fine using QEMU, but when I try to run it on my laptop (ASUS TUF Gaming F15 with Core i5-11400H, 16GB, RTX 3050TI) after selecting the USB stick I'm using in the boot menu the screen goes black and fans slowly ramp up to 100%, with no text anywhere.
Here's the code:
format pe64 efi
entry main
section '.text' executable readable
main:
mov rcx, [rdx + 64]
mov rax, [rcx + 8]
mov rdx, string
sub rsp, 32
call rax
add rsp,32
jmp $
section '.data' readable writable
string du 'Hello, World!', 0xD, 0xA, 0
Edit
I think I've found what the problem is: both sections are compiled to the size of 512 bytes, while from what I know 512 bytes is the maximum size of the boot file supported by UEFI. So now my question is: how do I limit the compiled section size to be less than 256 bytes?