35 lines
906 B
ArmAsm
35 lines
906 B
ArmAsm
|
# Declare constants for multiboot header
|
||
|
.set ALIGN, 1<<0 # align loaded modules on page boundaries
|
||
|
.set MEMINFO, 1<<1 # provide memory map
|
||
|
.set FLAGS, ALIGN | MEMINFO # multiboot flag field
|
||
|
.set MAGIC, 0x1BADB002 # magic number for bootloader to find header
|
||
|
.set CHECKSUM, -(MAGIC + FLAGS) # checksum of above
|
||
|
|
||
|
# Declare header in multiboot standard
|
||
|
.section .multiboot
|
||
|
.align 4
|
||
|
.long MAGIC
|
||
|
.long FLAGS
|
||
|
.long CHECKSUM
|
||
|
|
||
|
# Reserve a stack for initial thread
|
||
|
.section .bss
|
||
|
.align 16
|
||
|
stack_bottom:
|
||
|
.skip 16384 # 16 KiB
|
||
|
stack_top:
|
||
|
|
||
|
# kernel entry point
|
||
|
.section .text
|
||
|
.global _start
|
||
|
.type _start, @function
|
||
|
_start:
|
||
|
movl $stack_top, %esp
|
||
|
call _init # call global constructors
|
||
|
call kernel_main # transfer control to main kernel
|
||
|
# Hang if kernel_main unexpectedly returns
|
||
|
cli
|
||
|
1: hlt
|
||
|
jmp 1b
|
||
|
.size _start, . - _start
|