Merge branch 'net-dev'. See body of commit for details.
[akaros.git] / kern / src / init.c
index 5aff619..04b009d 100644 (file)
@@ -1,5 +1,9 @@
 /* See COPYRIGHT for copyright information. */
 
+#ifdef __SHARC__
+#pragma nosharc
+#endif
+
 #ifdef __BSD_ON_CORE_0__
 #include Everything For Free -- It just works!!
 #else
@@ -21,6 +25,7 @@
 #include <syscall.h>
 #include <kclock.h>
 #include <manager.h>
+#include <testing.h>
 
 #include <arch/rl8168.h>
 #include <arch/ne2k.h>
@@ -43,11 +48,15 @@ void kernel_init(multiboot_info_t *mboot_info)
 
        print_cpuinfo();
 
-       // zra: using KADDR macro gives a runtime warning, but it is possibly more
-    //      clear what's going on this way?
+       // Old way, pre Zach's Ivy annotations
        //multiboot_detect_memory((multiboot_info_t*)((uint32_t)mboot_info + KERNBASE));
        //multiboot_print_memory_map((multiboot_info_t*)((uint32_t)mboot_info + KERNBASE));
-       multiboot_detect_memory((multiboot_info_t*COUNT(1))KADDR((physaddr_t)mboot_info));
+       
+       // Paul: Can't use KADDR as arg to multiboot_detect_memory
+       //  since multiboot_detect_memory is what sets npages. 
+       //  Must simulate KADDR macro (ugly).
+       multiboot_detect_memory((multiboot_info_t*SAFE)(void*TRUSTED)((physaddr_t)mboot_info + KERNBASE));
+       
        multiboot_print_memory_map((multiboot_info_t*COUNT(1))KADDR((physaddr_t)mboot_info));
 
        vm_init();
@@ -55,27 +64,39 @@ void kernel_init(multiboot_info_t *mboot_info)
        cache_init();
        page_init();
        page_check();
-
-       env_init();
+       //test_page_coloring();
 
        idt_init();
        sysenter_init();
        timer_init();
        
+       // @todo: Add an arch specific init? This is ugly
        #ifdef __i386__
        mptables_parse();
        pci_init();
        ioapic_init(); // MUST BE AFTER PCI/ISA INIT!
        #endif // __i386__
-       
-       
+               
        // this returns when all other cores are done and ready to receive IPIs
        smp_boot();
+       env_init();
        
-       #ifdef __i386__
+
+       /* EXPERIMENTAL NETWORK FUNCTIONALITY
+        * To enable, define __NETWORK__ in your Makelocal
+        * If enabled, will load the rl8168 driver (if device exists)
+        * and will a boot into userland matrix, so remote syscalls can be performed.
+        * If in simulation, will do some debugging information with the ne2k device
+        *
+        * Note: If you use this, you should also define the mac address of the 
+        * teathered machine via USER_MAC_ADDRESS in Makelocal.
+        *
+        * Additionally, you should have a look at the syscall server in the tools directory
+        */
+       #ifdef __NETWORK__
        rl8168_init();          
        ne2k_init();
-       #endif // __i386__
+       #endif // __NETWORK__
 
        manager();
 }