- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathboot.s
More file actions
Latest commit
38 lines (32 loc) · 938 Bytes
/
Copy pathboot.s
File metadata and controls
38 lines (32 loc) · 938 Bytes
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
; Declare Multiboot Header constants
MBALIGN equ 1 << 0 ; Align loaded modules on page boundaries
MEMINFO equ 1 << 1 ; Provide memory map
FLAGS equ MBALIGN | MEMINFO ; Multiboot 'flag' field
MAGIC equ 0x1BADB002 ; Magic number letting bootloader find header
CHECKSUM equ -(MAGIC +FLAGS) ; Checksum required by Multiboot standard
; Multiboot Header
section .multiboot
align4
dd MAGIC
ddFLAGS
dd CHECKSUM
; Allocate 16 KB stack for C code
section .bss
align16
stack_bottom:
resb16384 ; 16 KB
stack_top:
; Kernel Entry Point
section .text
global_start
externkernel_main
_start:
; Set up the stack pointer register (ESP)
movesp, stack_top
; Call our main kernel function in C!
call kernel_main
; If kernel_main unexpectedly returns, halt CPU in an infinite loop
.halt:
cli
hlt
jmp .halt