diff cos/kernel/kernel.c @ 36:91f91ff07ea8

Removed test variables
author windel
date Mon, 16 Jan 2012 20:47:05 +0100
parents bcb3b68c8147
children 5c20bd53cccd
line wrap: on
line diff
--- a/cos/kernel/kernel.c	Mon Jan 16 17:38:00 2012 +0100
+++ b/cos/kernel/kernel.c	Mon Jan 16 20:47:05 2012 +0100
@@ -14,9 +14,6 @@
    kfree(a);
 }
 
-uint64_t testvar = 1234; // Ends up in data section
-uint64_t testvar2 = 0; // Ends up in bss section
-
 multiboot_info_t *multiboot_info = 0; // Set by startup code.
 
 /* This routine initializes the kernel.
@@ -27,16 +24,10 @@
    // No kmalloc required here yet:
    init_screen();
    setupIDT();
-   keyboard_init();
-   timer_init();
-
-   testvar++;
-   testvar2++;
-   printf("Test variable = %d, testvar2 = %d\n", testvar, testvar2);
 
    /* Retrieve memory information from multiboot header */
    uint64_t available_memory = 0;
-   if ((multiboot_info->flags & (1<<6)) == (1<<6))
+   if ((multiboot_info->flags & (1 << 6)) == (1 << 6))
    {
       multiboot_memory_map_t *mmap;
       for (mmap = (multiboot_memory_map_t*)(uint64_t)multiboot_info->mmap_addr; 
@@ -54,13 +45,19 @@
          }
       }
    }
-   else
+   
+   if (available_memory == 0)
    {
-      panic("Found no GRUB memory map\n");
+      panic("Found no usable memory in grub's memory map\n");
    }
 
    printf("Running with %d MB ram\n", available_memory / 1000000);
 
+   init_memory(available_memory); // Setup paging and memory manager
+
+   keyboard_init();
+   timer_init();
+
    /*
    fs_node_t *fs_root = 0;
    if ( (multiboot_info->flags & (1<<3)) == (1<<3))
@@ -92,9 +89,6 @@
    }
    */
 
-   // Assume first 16MB:
-   // TODO: get size from grub
-   init_memory(0x1000000);
 
    // TODO: make below a user space program!
    printf("Welcome!\n");
@@ -137,7 +131,6 @@
       x = (uint64_t*)0x4000000; // Address that is not mapped
       *x = 0x2; // trigger paging exception
       }
-
    }
 }