-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathboot.nasm
More file actions
60 lines (50 loc) · 714 Bytes
/
boot.nasm
File metadata and controls
60 lines (50 loc) · 714 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
[bits 32]
MALIGN equ 1<<0
MEMINFO equ 1<<1
FLAGS equ MALIGN | MEMINFO
MAGIC equ 0x1BADB002
CHECKSUM equ -(MAGIC + FLAGS)
section .multiboot
align 4
dd MAGIC
dd FLAGS
dd CHECKSUM
section .bootstrap_stack nobits write align=16
align 16
stack_bottom:
resb 32768
stack_top:
extern kernel_main
section .text
global _start:function (_start.end - _start)
_start:
mov esp, stack_top
;sti
push ebx
call kernel_main
.end
global halt
halt:
cli
hlt
.Lhang:
jmp halt
.end
section .text
global pause
pause:
hlt
ret
section .text
global sys_cli
sys_cli:
hlt
ret
section .text
global sys_sti
sys_sti:
hlt
ret
section .kend
global end_of_kernel
end_of_kernel: