forked from OfficialBishal/NugaOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloader.s
More file actions
38 lines (27 loc) · 907 Bytes
/
loader.s
File metadata and controls
38 lines (27 loc) · 907 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 constants for the multiboot header. */
.set ALIGN, 1<<0 /* align loaded modules on page boundaries */
.set MEMINFO, 1<<1 /* provide memory map */
.set FLAGS, (ALIGN | MEMINFO) /* this is the Multiboot 'flag' field */
.set MAGIC, 0x1BADB002 /* 'magic number' lets bootloader find the header */
.set CHECKSUM, -(MAGIC + FLAGS) /* checksum of above, to prove we are multiboot */
.section .multiboot
.long MAGIC
.long FLAGS
.long CHECKSUM
.section .text
.extern kernelMain
.extern callConstructors()
.global loader
loader:
mov $kernel_stack, %esp
call callConstructors #test
push %eax #use info from multiboot structure
push %ebx #use info from multiboot structure
call kernelMain
_stop:
cli # clear interrupt
hlt
jmp _stop
.section .bss
.space 2*1024*1024; # 2B x KB x MB
kernel_stack: