From d7c12c5210ed1545549b9d2b14fb9fb89ce652e2 Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Wed, 13 May 2015 01:18:53 +0200 Subject: implementing multiboot spec stuff --- asm/kernel_entry.asm | 3 +++ asm/multiboot.s | 22 ++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) (limited to 'asm') diff --git a/asm/kernel_entry.asm b/asm/kernel_entry.asm index 7dacee3..71bedd1 100644 --- a/asm/kernel_entry.asm +++ b/asm/kernel_entry.asm @@ -1,3 +1,6 @@ +; DEPRECATED . use multiboot.s instead! + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;; Miguel's FoolOS Helper Functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/asm/multiboot.s b/asm/multiboot.s index 08cc87e..a497e18 100644 --- a/asm/multiboot.s +++ b/asm/multiboot.s @@ -1,7 +1,11 @@ +# https://www.gnu.org/software/grub/manual/multiboot/multiboot.html#Boot-information-format +# http://wiki.osdev.org/Bare_Bones + # Declare constants used for creating a multiboot header. .set ALIGN, 1<<0 # align loaded modules on page boundaries .set MEMINFO, 1<<1 # provide memory map -.set FLAGS, ALIGN | MEMINFO # this is the Multiboot 'flag' field +.set GFXINFO, 1<<2 # provide gfx info +.set FLAGS, ALIGN | MEMINFO # | GFXINFO # this is the Multiboot 'flag' field .set MAGIC, 0x1BADB002 # 'magic number' lets bootloader find the header .set CHECKSUM, -(MAGIC + FLAGS) # checksum of above, to prove we are multiboot @@ -16,6 +20,17 @@ .long FLAGS .long CHECKSUM +.long 0 # we dont need this +.long 0 +.long 0 +.long 0 +.long 0 + +.long 0 #gfx_stuff +.long 0 +.long 0 +.long 0 + # Currently the stack pointer register (esp) points at anything and using it may # cause massive harm. Instead, we'll provide our own stack. We will allocate # room for a small temporary stack by creating a symbol at the bottom of it, @@ -59,7 +74,10 @@ _start: # We are now ready to actually execute C code. We cannot embed that in an # assembly file, so we'll create a kernel.c file in a moment. In that file, # we'll create a C entry point called kernel_main and call it here. - call kernel_start + + push %ebx #pass address of the multiboot information data structure + push %eax #pass eax, so kernel can check for magic number + call kernel_main # 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 -- cgit v1.2.3