- Add kernel/arch/arm/boot.S with ARMv7 assembly entry, stack setup, BSS clear - Add kernel/arch/arm/linker.ld for QEMU virt memory layout (load at 0x40000000) - Add kernel/arch/arm/uart.c/uart.h for PL011 serial output - Add kernel/kernel.c with kernel_main() idle loop - Add kernel/Makefile for arm-none-eabi-gcc cross-compile and QEMU launch - Add kernel/README.md with build/run instructions - Ignore kernel build artifacts in .gitignore
34 lines
700 B
ArmAsm
34 lines
700 B
ArmAsm
/*
|
|
* Universalisos ARMv7 boot code for QEMU virt machine.
|
|
*
|
|
* This is the first code executed after QEMU loads the kernel image.
|
|
* It sets up the stack, zeroes the BSS, and jumps to kernel_main().
|
|
*/
|
|
|
|
.syntax unified
|
|
.arch armv7-a
|
|
|
|
.section .text.boot
|
|
.global _start
|
|
_start:
|
|
/* Disable interrupts until the kernel is ready. */
|
|
cpsid if
|
|
|
|
/* Set up the stack at the top of the reserved boot region. */
|
|
ldr sp, =_stack_top
|
|
|
|
/* Clear the BSS section. */
|
|
ldr r0, =_bss_start
|
|
ldr r1, =_bss_end
|
|
mov r2, #0
|
|
1:
|
|
cmp r0, r1
|
|
bge 2f
|
|
str r2, [r0], #4
|
|
b 1b
|
|
2:
|
|
/* Enter the C kernel. */
|
|
bl kernel_main
|
|
|
|
/* Halt if kernel_main ever returns. */
|
|
b .
|