2022-11-13 01:04:10 +02:00
|
|
|
# Declare constants for the multiboot header
|
2022-12-10 03:55:24 +02:00
|
|
|
.set ALIGN, 1<<0 # align loaded modules on page boundaries
|
|
|
|
.set MEMINFO, 1<<1 # provide memory map
|
|
|
|
.set VIDEOINFO, 1<<2 # provide video info
|
|
|
|
.set MB_FLAGS, ALIGN | MEMINFO | VIDEOINFO # this is the Multiboot 'flag' field
|
|
|
|
.set MB_MAGIC, 0x1BADB002 # 'magic number' lets bootloader find the header
|
|
|
|
.set MB_CHECKSUM, -(MB_MAGIC + MB_FLAGS) #checksum of above, to prove we are multiboot
|
2022-11-13 01:04:10 +02:00
|
|
|
|
|
|
|
# Multiboot header
|
2022-11-15 00:32:07 +02:00
|
|
|
.section .multiboot
|
2022-11-12 21:04:47 +02:00
|
|
|
.align 4
|
|
|
|
.long MB_MAGIC
|
|
|
|
.long MB_FLAGS
|
|
|
|
.long MB_CHECKSUM
|
2022-12-19 11:35:24 +02:00
|
|
|
.skip 20
|
2022-12-16 00:46:10 +02:00
|
|
|
|
2022-12-10 03:55:24 +02:00
|
|
|
.long 0
|
2022-12-16 00:46:10 +02:00
|
|
|
.long 800
|
|
|
|
.long 600
|
|
|
|
.long 32
|
2022-11-13 01:04:10 +02:00
|
|
|
|
|
|
|
# Create stack
|
2022-11-15 00:32:07 +02:00
|
|
|
.section .bss
|
2022-11-12 21:04:47 +02:00
|
|
|
stack_bottom:
|
2022-11-13 01:04:10 +02:00
|
|
|
.skip 16384 # 16 KiB
|
2022-11-12 21:04:47 +02:00
|
|
|
stack_top:
|
2022-11-13 01:04:10 +02:00
|
|
|
|
2022-11-15 00:32:07 +02:00
|
|
|
.section .text
|
2022-11-12 21:04:47 +02:00
|
|
|
.global _start
|
|
|
|
.type _start, @function
|
|
|
|
_start:
|
2022-11-15 00:32:07 +02:00
|
|
|
movl $stack_top, %esp
|
2022-11-13 01:04:10 +02:00
|
|
|
|
2022-11-15 00:32:07 +02:00
|
|
|
pushl %eax
|
|
|
|
pushl %ebx
|
2022-11-13 01:04:10 +02:00
|
|
|
|
2022-11-15 00:32:07 +02:00
|
|
|
call _init
|
2022-11-13 01:04:10 +02:00
|
|
|
|
2022-11-12 21:04:47 +02:00
|
|
|
call kernel_main
|
2022-11-15 00:32:07 +02:00
|
|
|
|
2022-11-12 21:04:47 +02:00
|
|
|
cli
|
2022-11-15 00:32:07 +02:00
|
|
|
1:
|
|
|
|
hlt
|
2022-11-12 21:04:47 +02:00
|
|
|
jmp 1b
|
2022-11-15 00:32:07 +02:00
|
|
|
|
|
|
|
.size _start, . - _start
|