Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/native/boot/efi_entry.S # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / native / boot / efi_entry.S` 48 lines ยท 1622 bytes Raw Blame History 1 /* efi_entry.S -- UEFI entry of the AIENOS C kernel image (AArch64). 2 * Firmware calls _start(ImageHandle, SystemTable) at its own EL (EL2 on QEMU 3 * virtualization=on and on Machine 1) with its translation and stack. The 4 * image is linked at 0 and loaded anywhere: apply our R_AARCH64_RELATIVE 5 * relocations against the load address, zero .bss, then call efi_main. 6 * This runs exactly once per load. */ 7 .section .text.entry, "ax" 8 .global _start 9 .type _start, %function 10 _start: 11 stp x29, x30, [sp, #-32]! 12 mov x29, sp 13 stp x0, x1, [sp, #16] 14 adrp x2, __image_base 15 add x2, x2, :lo12:__image_base /* load address == link offset 0 */ 16 adrp x3, __rela_start 17 add x3, x3, :lo12:__rela_start 18 adrp x4, __rela_end 19 add x4, x4, :lo12:__rela_end 20 1: cmp x3, x4 21 b.hs 3f 22 ldp x5, x6, [x3] /* r_offset, r_info */ 23 ldr x7, [x3, #16] /* r_addend */ 24 add x3, x3, #24 25 and x6, x6, #0xffffffff 26 cmp x6, #1027 /* R_AARCH64_RELATIVE */ 27 b.ne 2f 28 add x7, x7, x2 29 str x7, [x2, x5] 30 b 1b 31 2: cbz x6, 1b /* R_AARCH64_NONE */ 32 mov x0, #0x8000000000000000 /* unexpected relocation type: */ 33 add x0, x0, #1 /* return EFI_LOAD_ERROR */ 34 ldp x29, x30, [sp], #32 35 ret 36 3: adrp x3, __bss_start 37 add x3, x3, :lo12:__bss_start 38 adrp x4, __bss_end 39 add x4, x4, :lo12:__bss_end 40 4: cmp x3, x4 41 b.hs 5f 42 str xzr, [x3], #8 43 b 4b 44 5: ldp x0, x1, [sp, #16] 45 bl efi_main 46 ldp x29, x30, [sp], #32 47 ret 48 .size _start, . - _start