blob: 28e491afe131215d742ae7fbf142ef0d0de0c9eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
global _start
global stack_ptr
extern kernel_main
; declare some constants
MODULEALIGN equ 1<<0 ; align loaded modules on page boundaries
MEMINFO equ 1<<1 ; provide memory map
FLAGS equ MODULEALIGN | MEMINFO ; this is the Multiboot 'flag' field
MAGIC equ 0x1BADB002 ; 'magic number' lets bootloader find the header
CHECKSUM equ -(MAGIC + FLAGS) ; checksum of above, to prove we are multiboot
; the bootloader will search for this magic sequence
; and recognize us as a multiboot kernel
section .multiboot
align 4
MultiBootHeader:
dd MAGIC
dd FLAGS
dd CHECKSUM
section .code
; setup the stack
STACKSIZE equ 0x16384
_start:
mov esp, stack+STACKSIZE
push eax
push ebx
call kernel_main
cli
hang:
hlt
jmp hang
section .bss
align 4
stack:
resb STACKSIZE
stack_ptr:
|