summaryrefslogtreecommitdiff
path: root/kernel/entry.c
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2009-12-26 21:15:05 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2009-12-26 21:15:05 +0100
commita35e29c07873db467e0ca670290666f8786dab03 (patch)
tree93ca3d311b76a8259f6883d3f32d1eabfefea60b /kernel/entry.c
parentf57cbe8ecdb4f6ecb22618de361d4fcaee3fdcf3 (diff)
First steps reading multiboot info. Added GDT.
Diffstat (limited to 'kernel/entry.c')
-rw-r--r--kernel/entry.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/kernel/entry.c b/kernel/entry.c
index d040cfb..4dd2ee1 100644
--- a/kernel/entry.c
+++ b/kernel/entry.c
@@ -1,4 +1,5 @@
#include "types.h"
+#include "multiboot.h"
extern void addr_phys;
extern void addr_virt;
@@ -18,13 +19,15 @@ asm(
".globl entry\n"
"entry:\n"
"mov $entry_stack_top,%esp\n"
+ "push %ebx\n"
"push %eax\n"
"call entry_main\n"
);
void entry_serial_out(char* str);
+void entry_serial_out_hex(uint32_t x);
-void entry_main(uint32_t mb_magic, void* mb_info) {
+void entry_main(uint32_t mb_magic, multiboot_info* mb_info) {
entry_serial_out("entry_main()\n");
if(mb_magic != 0x2badb002) {
entry_serial_out("Multiboot magic word is wrong!\n");
@@ -34,6 +37,17 @@ void entry_main(uint32_t mb_magic, void* mb_info) {
// TODO: Copy multiboot information.
+ entry_serial_out("Flags: ");
+ entry_serial_out_hex(mb_info->flags);
+
+ if(mb_info->flags & (1 << 2)) {
+ entry_serial_out(mb_info->cmdline);
+ entry_serial_out("\n");
+ } else {
+ entry_serial_out("No cmdline.\n");
+ }
+
+
// Create initial page tables.
for(unsigned int i = 0; i < 1024; i++) {
// Clear page directory.
@@ -90,3 +104,12 @@ void entry_serial_out(char* str) {
outb(0x3f8, *str++);
}
}
+
+void entry_serial_out_hex(uint32_t x) {
+ char str[] = "00000000\n";
+ for(int i = 0; i < 8; i++) {
+ int z = (x >> (28 - i * 4)) & 0xf;
+ str[i] = z < 10 ? '0' + z : 'a' - 10 + z;
+ }
+ entry_serial_out(str);
+}