X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/6942ebae59c3904674dce6b67cd07c43a3bbe00d..bb5ae5c85c0812c52e8d53187f2c6b0ee9525c8c:/lunaix-os/arch/aarch64/boot/start.S diff --git a/lunaix-os/arch/aarch64/boot/start.S b/lunaix-os/arch/aarch64/boot/start.S index 13878da..489d4f7 100644 --- a/lunaix-os/arch/aarch64/boot/start.S +++ b/lunaix-os/arch/aarch64/boot/start.S @@ -1,3 +1,5 @@ +#include + .section .boot.data .align 4 stack_end: @@ -19,9 +21,25 @@ mov sp, x4 mov fp, xzr + mov x19, x0 + bl aarch64_pre_el1_init + + bl aarch64_prepare_el1_transfer + cbz x0, 1f + + /* transfer to EL1 if we are currently not in */ + adr x0, stack_top + msr SP_EL1, x0 /* EL1 stack */ + + adr x0, 1f + msr elr, x0 /* PC to resume at EL1, elr aliased to ELR_ELx */ + + eret + 1: + mov x0, x19 adr x4, aarch64_init - bl x4 + blr x4 // x0: ptr to boot_handoff adr x4, kernel_bootstrap - bl x4 \ No newline at end of file + blr x4 \ No newline at end of file