boot: Add EFISTUB and refactor boot protocols

This commit is contained in:
2026-10-27 22:50:43 +01:00
parent 6827dc309e
commit 196543c3d3
40 changed files with 1923 additions and 208 deletions
+48
View File
@@ -0,0 +1,48 @@
// SPDX-License-Identifier: ISC
.intel_syntax noprefix
.text
.globl _start
.type _start, @function
_start:
// Align the stack pointer
push rbp
mov rbp, rsp
push rdi
push rsi
push rbx
push r12
and rsp, -16
cld
mov rbx, rcx
mov r12, rdx
// Clear .bss
lea rdi, [rip + __bss_start]
lea rcx, [rip + __bss_end]
sub rcx, rdi
xor eax, eax
rep stosb
// Self-relocate
lea rdi, [rip + __image_base]
lea rsi, [rip + _DYNAMIC]
call efistub_relocate
test rax, rax
jnz 1f
mov rdi, rbx
mov rsi, r12
call efi_main
1:
lea rsp, [rbp - 32]
pop r12
pop rbx
pop rsi
pop rdi
pop rbp
ret
.size _start, . - _start