From d191858a7e3b91fa01fab2d7b42a11aaa792d415 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Wed, 23 Mar 2016 01:01:16 -0400 Subject: [PATCH] Pass multiboot magic to kmain() --- src/Main.cc | 3 ++- src/boot.s | 19 ++++--------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/Main.cc b/src/Main.cc index b73a87a..52b465d 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -39,7 +39,8 @@ kearly() /** The beginning of the world... */ extern "C" void -kmain(multiboot::Information *information) +kmain(multiboot::Information *information, + u32 magic) { multiboot::Information::setInformation(information); auto info = multiboot::Information::information(); diff --git a/src/boot.s b/src/boot.s index d97e40a..e490cef 100644 --- a/src/boot.s +++ b/src/boot.s @@ -36,27 +36,16 @@ _start: movl $stack_top, %esp movl %esp, %ebp - # Very early initialization done here. - call kearly + # Push the multiboot parameters before calling anything else. These will get passed to kmain. + pushl %eax + pushl %ebx # Global initialization done here. call _init - # Here we go... Give kmain the address of the multiboot info structure. - pushl %ebx + # Here we go! This will never return. call kmain - # In case the function returns, we'll want to put the computer into an - # infinite loop. To do that, we use the clear interrupt ('cli') instruction - # to disable interrupts, the halt instruction ('hlt') to stop the CPU until - # the next interrupt arrives, and jumping to the halt instruction if it ever - # continues execution, just to be safe. We will create a local label rather - # than real symbol and jump to there endlessly. - cli -.Lhang: - hlt - jmp .Lhang - # Set the size of the _start symbol to the current location '.' minus its start. # This is useful when debugging or when you implement call tracing. .size _start, . - _start