T121: kernel: Make BSP KCB a proper capability on ARM
authorMoritz Hoffmann <moritz.hoffmann@inf.ethz.ch>
Wed, 17 Jun 2015 13:20:21 +0000 (15:20 +0200)
committerMoritz Hoffmann <moritz.hoffmann@inf.ethz.ch>
Wed, 17 Jun 2015 13:20:21 +0000 (15:20 +0200)
Signed-off-by: Moritz Hoffmann <moritz.hoffmann@inf.ethz.ch>

kernel/arch/arm_gem5/startup_arch.c
kernel/arch/armv5/startup_arch.c
kernel/arch/omap44xx/init.c
kernel/arch/omap44xx/startup_arch.c
kernel/arch/x86/startup_x86.c
lib/barrelfish/Hakefile

index 22137d9..2152ed7 100644 (file)
@@ -706,6 +706,7 @@ void arm_kernel_startup(void)
 
         /* allocate initial KCB */
         kcb_current = (struct kcb *) local_phys_to_mem(bsp_alloc_phys(sizeof(*kcb_current)));
+        memset(kcb_current, 0, sizeof(*kcb_current));
         assert(kcb_current);
 
         /* spawn init */
index 8eb8d2c..a553d80 100644 (file)
@@ -576,5 +576,10 @@ void arm_kernel_startup(phys_mmap_t* mmap,
                 panic("Invalid initrd filesystem\n");
     }
 
+    /* allocate initial KCB */
+    kcb_current = (struct kcb *) local_phys_to_mem(bsp_alloc_phys(sizeof(*kcb_current)));
+    memset(kcb_current, 0, sizeof(*kcb_current));
+    assert(kcb_current);
+
     spawn_init(BSP_INIT_MODULE_NAME, 0, initrd_cpio_base, initrd_bytes);
 }
index cb1650d..fcec295 100644 (file)
@@ -979,10 +979,6 @@ void arch_init(void *pointer)
         *((volatile lvaddr_t *)ap_wait) = AP_STARTED;
     }
 
-    if (kcb_current == NULL) {
-        panic("Did not receive a valid KCB.");
-    }
-
     // XXX: print kernel address for debugging with gdb
     printf("Barrelfish OMAP44xx CPU driver starting at addr 0x%"PRIxLVADDR" on core %"PRIuCOREID"\n",
             local_phys_to_mem((lpaddr_t)&kernel_first_byte), my_core_id);
index f963a5b..e466fcc 100644 (file)
@@ -27,6 +27,7 @@
 #include <offsets.h>
 #include <startup_arch.h>
 #include <global.h>
+#include <kcb.h>
 
 #define CNODE(cte)              (cte)->cap.u.cnode.cnode
 #define UNUSED(x)               (x) = (x)
@@ -713,6 +714,11 @@ void arm_kernel_startup(void)
        /* Initialize the location to allocate phys memory from */
        bsp_init_alloc_addr = glbl_core_data->start_free_ram;
 
+        /* allocate initial KCB */
+        kcb_current = (struct kcb *) local_phys_to_mem(bsp_alloc_phys(sizeof(*kcb_current)));
+        memset(kcb_current, 0, sizeof(*kcb_current));
+        assert(kcb_current);
+
         // Bring up init
         init_dcb = spawn_bsp_init(BSP_INIT_MODULE_NAME, bsp_alloc_phys);
 
@@ -721,6 +727,9 @@ void arm_kernel_startup(void)
     } else {
         printf("Doing non-BSP related bootup \n");
 
+        kcb_current = (struct kcb *)
+            local_phys_to_mem((lpaddr_t) kcb_current);
+
         /* Initialize the allocator with the information passed to us */
         app_alloc_phys_start = glbl_core_data->memory_base_start;
         app_alloc_phys_end   = app_alloc_phys_start
index 70d3ae4..db66c48 100644 (file)
@@ -552,6 +552,7 @@ void kernel_startup(void)
 
         /* allocate initial KCB */
         kcb_current = (struct kcb *) local_phys_to_mem(bsp_alloc_phys(sizeof(*kcb_current)));
+        memset(kcb_current, 0, sizeof(*kcb_current));
         assert(kcb_current);
 
         /* spawn init */
index 950344b..8959d52 100644 (file)
@@ -74,7 +74,7 @@
                                  "arch/x86/perfmon.c", "arch/x86/tls.c",
                                  "arch/x86/sys_debug.c"]
       archfam_srcs "arm"     = [ "arch/arm/debug.c", "arch/arm/dispatch.c",
-                                 "arch/arm/pmap_arch.c", "arch/arm/sys_debug.c",
+                                 "arch/arm/pmap_arch.c",
                                  "arch/arm/syscalls.c", "vspace/memobj_pinned.c" ,
                                  "vspace/pinned.c", "vspace/memobj_anon.c",
                                  "vspace/arch/arm/layout.c",
                                  "arch/x86/perfmon.c", "arch/x86/tls.c",
                                  "arch/x86/sys_debug.c"]
       archfam_srcs "arm"     = [ "arch/arm/debug.c", "arch/arm/dispatch.c",
-                                 "arch/arm/pmap_arch.c", "arch/arm/sys_debug.c",
+                                 "arch/arm/pmap_arch.c",
                                  "arch/arm/syscalls.c", "vspace/memobj_pinned.c" ,
                                  "vspace/pinned.c", "vspace/memobj_anon.c",
                                  "vspace/arch/arm/layout.c",