aboutsummaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
Diffstat (limited to 'boot')
-rw-r--r--boot/entry.asm19
-rw-r--r--boot/load.c17
2 files changed, 25 insertions, 11 deletions
diff --git a/boot/entry.asm b/boot/entry.asm
index dc65b97..fa6f0ef 100644
--- a/boot/entry.asm
+++ b/boot/entry.asm
@@ -454,13 +454,12 @@ protected_mode:
mov ax, (gdt_tss - gdt) | 0b11 ; Load TSS in ring 3
ltr ax
- mov eax, drive ; Pass drive to kernel loader
- push eax ; Push as third kernel parameter
+ mov [boot_info], dword vid_info
+ mov [boot_info + 4], dword mem_info
+ mov [boot_info + 8], dword tss_entry
+ mov [boot_info + 12], dword drive
- mov eax, vid_info ; Pass VBE struct to kernel loader
- push eax ; Push as second kernel parameter
-
- mov eax, mem_info ; Pass meminfo to kernel loader
+ mov eax, boot_info ; Pass boot_info to kernel loader
push eax ; Push as first kernel parameter
mov edx, LOADER_POSITION
@@ -474,6 +473,13 @@ mem_info:
dd 0 ; End address
dd 0 ; Count
+align 16
+boot_info:
+ dd 0 ; VBE
+ dd 0 ; MMAP
+ dd 0 ; TSS
+ dd 0 ; Drive
+
; GDT
align 32
gdt: ; GDTs start
@@ -521,6 +527,7 @@ gdt_desc:
dd gdt
; TSS
+align 4
tss_entry:
dd 0 ; Previous TSS
dd STACK_POINTER ; esp0
diff --git a/boot/load.c b/boot/load.c
index dfa6e9c..375d144 100644
--- a/boot/load.c
+++ b/boot/load.c
@@ -819,21 +819,28 @@ static s32 elf_load(const char *path, u8 drive)
* Let's go!
*/
-int main(void *first, void *second, u8 drive)
+struct boot_info {
+ u32 vid;
+ u32 mem;
+ u32 tss;
+ u32 drive;
+};
+
+int main(struct boot_info *boot)
{
serial_install();
print("Loaded bootloader!\n");
- assert(drive);
+ assert(boot->drive);
- s32 elf = elf_load("/apps/kernel/exec", drive);
+ s32 elf = elf_load("/apps/kernel/exec", boot->drive);
assert(elf > 0);
- void (*kernel)(void *, void *);
+ void (*kernel)(void *);
*(void **)(&kernel) = (void *)elf;
print("Loaded kernel!\n");
- kernel(first, second);
+ kernel(boot);
print("WTF, kernel returned!\n");