kernel: refactor aarch64 boot code
Some checks failed
Build OS / Analyze (${{ matrix.language }}) (manual, c-cpp) (push) Blocked by required conditions
Build OS / Build amd64 (push) Blocked by required conditions
Build OS / Build i386 (push) Blocked by required conditions
Build OS / Build aarch64 (push) Blocked by required conditions
Build OS / Build arm (push) Blocked by required conditions
Build OS / Deploy Documentation to GitHub Pages (push) Failing after 4m9s
Build OS / Build Cross-Compiler & Toolchain (push) Failing after 56m7s

Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
2025-01-24 15:27:11 +02:00
parent 0ab1833034
commit 7ce73ab813
2 changed files with 23 additions and 3 deletions

View File

@ -0,0 +1,49 @@
/*
This file is part of Fennix Kernel.
Fennix Kernel is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
Fennix Kernel is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
*/
.section ".bootstrap.boot", "a"
.extern _kernel_bss_start
.extern _kernel_bss_end
.extern _kernel_bss_size
.global _start
_start:
/* Keep only the main core */
mrs x1, mpidr_el1
and x1, x1, #3
cbz x1, 2f
/* Halt */
1: wfe
b 1b
/* Initialize the stack */
2: ldr x1, =_start
mov sp, x1
/* Clear the BSS */
ldr x1, =_kernel_bss_start
ldr w2, =_kernel_bss_size
3: cbz w2, 4f
str xzr, [x1], #8
sub w2, w2, #1
cbnz w2, 3b
/* Start the kernel */
4: bl _aarch64_start
b 1b