FENIX_kernel/arch/i386/boot.S
2020-12-01 20:41:09 -06:00

39 lines
757 B
ArmAsm
Executable file

# Constants for multiboot
.set ALIGN, 1<<0 # align on page boundaries
.set MEMINFO, 1<<1 # memory map
.set FLAGS, ALIGN | MEMINFO # for multiboot 'flag' field
.set MAGIC, 0x1BADB002 # magic number for bootloader
.set CHECKSUM, -(MAGIC + FLAGS) # checksum to prove we're multiboot
# Declare header for multiboot
.section .multiboot
.align 4
.long MAGIC
.long FLAGS
.long CHECKSUM
# Reserve stack for initial thread
.section .bss
.align 16
stack_bottom:
.skip 16384 # 16K
stack_top:
# Kernel entry
.section .text
.global _start
.type _start, @function
_start:
movl $stack_top, %esp
# Call global constructors
call _init
# Start kernel
call kern_main
# Hang if kernel returns
cli
1: hlt
jmp 1b
.size _start, . - _start