swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 1 | ;;; GRUB Multiboot header, calls main() in main.c |
| 2 | |
| 3 | MBOOT_PAGE_ALIGN equ 1<<0 |
| 4 | MBOOT_MEM_INFO equ 1<<1 |
| 5 | MBOOT_HEADER_MAGIC equ 0x1BADB002 |
| 6 | |
| 7 | MBOOT_HEADER_FLAGS equ MBOOT_PAGE_ALIGN | MBOOT_MEM_INFO |
| 8 | MBOOT_CHECKSUM equ -(MBOOT_HEADER_MAGIC + MBOOT_HEADER_FLAGS) |
| 9 | |
| 10 | |
| 11 | [bits 32] |
| 12 | |
| 13 | [global mboot] |
| 14 | [extern code] |
| 15 | [extern bss] |
| 16 | [extern end] |
| 17 | |
| 18 | mboot: |
| 19 | dd MBOOT_HEADER_MAGIC ; This tells GRUB to start executing here: |
| 20 | dd MBOOT_HEADER_FLAGS |
| 21 | dd MBOOT_CHECKSUM |
| 22 | |
| 23 | dd mboot ; Current location |
| 24 | dd code ; .text section |
| 25 | dd bss ; End of .data |
| 26 | dd end ; End of kernel |
| 27 | dd start |
| 28 | |
| 29 | [global start] |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 30 | [extern kmain] ; C code |
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 31 | |
| 32 | start: |
| 33 | push ebx ; Holds multiboot header location |
| 34 | |
| 35 | cli |
swissChili | 0b35bf2 | 2021-02-18 12:49:40 -0800 | [diff] [blame] | 36 | call kmain |
swissChili | d813792 | 2021-02-17 15:34:07 -0800 | [diff] [blame] | 37 | jmp $ |