2017-11-01 04:53:27 -04:00
|
|
|
.set MULTIBOOT_1_MAGIC, 0x1BADB002
|
|
|
|
.set MULTIBOOT_1_FLAGS, (1 << 0) | (1 << 1) // Align, meminfo
|
|
|
|
.set MULTIBOOT_1_CHECKSUM, -(MULTIBOOT_1_MAGIC + MULTIBOOT_1_FLAGS)
|
2017-11-01 00:43:42 -04:00
|
|
|
|
2017-11-01 04:53:27 -04:00
|
|
|
.set MULTIBOOT_2_MAGIC, 0xE85250D6
|
|
|
|
.set MULTIBOOT_2_ARCH, 0
|
2017-11-01 05:45:56 -04:00
|
|
|
.set MULTIBOOT_2_LENGTH, 16 + 8
|
2017-11-01 04:53:27 -04:00
|
|
|
.set MULTIBOOT_2_CHECKSUM, -(MULTIBOOT_2_MAGIC + MULTIBOOT_2_ARCH + MULTIBOOT_2_LENGTH)
|
|
|
|
|
|
|
|
.section .multiboot2
|
|
|
|
.align 4
|
|
|
|
.long MULTIBOOT_2_MAGIC
|
|
|
|
.long MULTIBOOT_2_ARCH
|
|
|
|
.long MULTIBOOT_2_LENGTH
|
|
|
|
.long MULTIBOOT_2_CHECKSUM
|
2017-11-01 05:45:56 -04:00
|
|
|
.long 0
|
|
|
|
.long 8
|
2017-11-01 04:53:27 -04:00
|
|
|
|
|
|
|
.section .multiboot1
|
2017-11-01 00:43:42 -04:00
|
|
|
.align 4
|
2017-11-01 04:53:27 -04:00
|
|
|
.long MULTIBOOT_1_MAGIC
|
|
|
|
.long MULTIBOOT_1_FLAGS
|
|
|
|
.long MULTIBOOT_1_CHECKSUM
|
2017-11-01 00:43:42 -04:00
|
|
|
|
|
|
|
.section .bss
|
|
|
|
.align 16
|
|
|
|
stack_bottom:
|
|
|
|
.skip 16384 # 16 KiB
|
|
|
|
stack_top:
|
|
|
|
|
|
|
|
.section .text
|
|
|
|
|
|
|
|
.global _start
|
|
|
|
.type _start, @function
|
|
|
|
_start:
|
|
|
|
mov $stack_top, %esp
|
2017-11-01 04:25:39 -04:00
|
|
|
push %eax // uint32_t multiboot_magic
|
2017-11-01 00:43:42 -04:00
|
|
|
call main
|
|
|
|
cli
|
|
|
|
1:
|
|
|
|
hlt
|
|
|
|
jmp 1b
|
|
|
|
|
|
|
|
.size _start, . - _start
|