Boots under QEMU on all three ISAs from one clang build: - shared C core (kmain, console) calls a small per-arch contract (arch.h) - per-arch asm entry + trap/vector table + UART driver - parallel Makefile (make -j), 'make run-<arch>', 'make sizes' M1 = boot, UART up, trap vector installed, banner from kmain().
28 lines
667 B
ArmAsm
28 lines
667 B
ArmAsm
# boot.S (x86, i386) — multiboot header + entry.
|
|
# The Multiboot1 header lets QEMU -kernel (and GRUB) load us directly.
|
|
# We set a stack and call kmain(). Irreducible asm part for x86.
|
|
|
|
.set MB_MAGIC, 0x1BADB002
|
|
.set MB_FLAGS, 0x0
|
|
.set MB_CHECKSUM, -(MB_MAGIC + MB_FLAGS)
|
|
|
|
.section .multiboot, "a"
|
|
.align 4
|
|
.long MB_MAGIC
|
|
.long MB_FLAGS
|
|
.long MB_CHECKSUM
|
|
|
|
.section .bss
|
|
.align 16
|
|
stack_bottom:
|
|
.skip 0x4000 # 16 KiB stack
|
|
stack_top:
|
|
|
|
.section .text.boot
|
|
.globl _start
|
|
.type _start, @function
|
|
_start:
|
|
mov $stack_top, %esp # set up the stack
|
|
call kmain
|
|
1: hlt # kmain shouldn't return; if it does, halt
|
|
jmp 1b
|