-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.asm
40 lines (34 loc) · 850 Bytes
/
start.asm
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
; Note: interrupts are disabled at this point
[BITS 32]
SECTION .text
global start
start:
mov esp, sys_stack ; This points the stack to our new stack area
jmp stublet
; This part MUST be 4byte aligned
ALIGN 4
mboot:
MULTIBOOT_PAGE_ALIGN equ 1<<0
MULTIBOOT_MEMORY_INFO equ 1<<1
MULTIBOOT_HEADER_MAGIC equ 0x1BADB002
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO
MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
EXTERN code, bss, end
; This is the Multiboot header.
dd MULTIBOOT_HEADER_MAGIC
dd MULTIBOOT_HEADER_FLAGS
dd MULTIBOOT_CHECKSUM
SECTION .data
stublet:
extern main
push ebx
push eax
call main
jmp $
; Reserve 8Kb of stack space
ALIGN 4096
SECTION .bss
global sys_stack_end
sys_stack_end:
resb 8192
sys_stack: