forked from SerenityOS/serenity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kernel: Use a multiboot header instead of a convoluted two-part bootl…
…oader. The old bootloader was hilariously complicated, requiring a floppy disk with the kernel on it, and a hard drive with the file system. This patch removes the floppy disk from the equation and replaces it with a multiboot header. This means the kernel can now be booted with qemu-system-i386 -kernel kernel
- Loading branch information
1 parent
d5a9f45
commit ee4d7c1
Showing
7 changed files
with
81 additions
and
293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
*.o | ||
*.d | ||
.floppy-image | ||
Boot/boot.bin | ||
Boot/boot.ao | ||
kernel | ||
kernel.map | ||
_fs_contents | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
.set MULTIBOOT_MAGIC, 0x1badb002 | ||
.set MULTIBOOT_PAGE_ALIGN, 0x1 | ||
.set MULTIBOOT_MEMORY_INFO, 0x2 | ||
.set MULTIBOOT_VIDEO_MODE, 0x4 | ||
.set multiboot_flags, MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_VIDEO_MODE | ||
.set multiboot_checksum, -(MULTIBOOT_MAGIC + multiboot_flags) | ||
|
||
.section .multiboot | ||
.align 4 | ||
|
||
.long MULTIBOOT_MAGIC | ||
.long multiboot_flags | ||
.long multiboot_checksum | ||
|
||
|
||
/* for MULTIBOOT_MEMORY_INFO */ | ||
.long 0x00000000 /* header_addr */ | ||
.long 0x00000000 /* load_addr */ | ||
.long 0x00000000 /* load_end_addr */ | ||
.long 0x00000000 /* bss_end_addr */ | ||
.long 0x00000000 /* entry_addr */ | ||
|
||
/* for MULTIBOOT_VIDEO_MODE */ | ||
.long 0x00000000 /* mode_type */ | ||
.long 0 /* width */ | ||
.long 0 /* height */ | ||
.long 32 /* depth */ | ||
|
||
.section .stack, "aw", @nobits | ||
stack_bottom: | ||
.skip 32768 | ||
stack_top: | ||
|
||
.section .text | ||
|
||
.global start | ||
.type start, @function | ||
|
||
.extern init | ||
.type init, @function | ||
|
||
start: | ||
mov $stack_top, %esp | ||
|
||
and $-16, %esp | ||
|
||
pushl %esp | ||
pushl %eax /* Multiboot header magic */ | ||
pushl %ebx /* Multiboot header pointer */ | ||
|
||
cli | ||
call init | ||
|
||
pushl $exit_message | ||
call kprintf | ||
|
||
cli | ||
|
||
loop: | ||
hlt | ||
jmp loop | ||
|
||
exit_message: | ||
.asciz "Kernel exited." |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.