summaryrefslogtreecommitdiff
path: root/asm
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2015-05-13 01:18:53 +0200
committerMichal Idziorek <m.i@gmx.at>2015-05-13 01:18:53 +0200
commitd7c12c5210ed1545549b9d2b14fb9fb89ce652e2 (patch)
tree845e62b2f504138e7a95e35eee31d9b3a38bb287 /asm
parent2c1148e7920cf1d4c772d0d81757a7f8d736648e (diff)
implementing multiboot spec stuff
Diffstat (limited to 'asm')
-rw-r--r--asm/kernel_entry.asm3
-rw-r--r--asm/multiboot.s22
2 files changed, 23 insertions, 2 deletions
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