Rebuilt Hakefile for kernel to allow multiple CPU drivers
authorMothy <troscoe@inf.ethz.ch>
Thu, 2 Aug 2012 13:25:05 +0000 (15:25 +0200)
committerMothy <troscoe@inf.ethz.ch>
Thu, 2 Aug 2012 13:25:05 +0000 (15:25 +0200)
--HG--
rename : kernel/arch/arm_gem5/boot.S => kernel/arch/omap44xx/boot.S
rename : kernel/arch/arm_gem5/exceptions.S => kernel/arch/omap44xx/exceptions.S
rename : kernel/arch/arm_gem5/exn.c => kernel/arch/omap44xx/exn.c
rename : kernel/arch/arm_gem5/init.c => kernel/arch/omap44xx/init.c
rename : kernel/arch/arm_gem5/integrator.c => kernel/arch/omap44xx/integrator.c
rename : kernel/arch/arm_gem5/kludges.c => kernel/arch/omap44xx/kludges.c
rename : kernel/arch/arm_gem5/kputchar.c => kernel/arch/omap44xx/kputchar.c
rename : kernel/arch/arm_gem5/linker.lds.in => kernel/arch/omap44xx/linker.lds.in
rename : kernel/arch/arm_gem5/multiboot.c => kernel/arch/omap44xx/multiboot.c
rename : kernel/arch/arm_gem5/omap.c => kernel/arch/omap44xx/omap.c
rename : kernel/arch/arm_gem5/omap_uart.c => kernel/arch/omap44xx/omap_uart.c
rename : kernel/arch/arm_gem5/paging.c => kernel/arch/omap44xx/paging.c
rename : kernel/arch/arm_gem5/pl011_uart.c => kernel/arch/omap44xx/pl011_uart.c
rename : kernel/arch/arm_gem5/start_aps.c => kernel/arch/omap44xx/start_aps.c
rename : kernel/arch/arm_gem5/startup_arch.c => kernel/arch/omap44xx/startup_arch.c
rename : kernel/arch/arm_gem5/syscall.c => kernel/arch/omap44xx/syscall.c

24 files changed:
hake/ArmGem5.hs
hake/Main.hs
hake/RuleDefs.hs
hake/symbolic_targets.mk
kernel/Hakefile
kernel/arch/omap44xx/boot.S [moved from kernel/arch/arm_gem5/boot.S with 100% similarity]
kernel/arch/omap44xx/exceptions.S [moved from kernel/arch/arm_gem5/exceptions.S with 100% similarity]
kernel/arch/omap44xx/exn.c [moved from kernel/arch/arm_gem5/exn.c with 100% similarity]
kernel/arch/omap44xx/init.c [moved from kernel/arch/arm_gem5/init.c with 98% similarity]
kernel/arch/omap44xx/integrator.c [moved from kernel/arch/arm_gem5/integrator.c with 100% similarity]
kernel/arch/omap44xx/kludges.c [moved from kernel/arch/arm_gem5/kludges.c with 100% similarity]
kernel/arch/omap44xx/kputchar.c [moved from kernel/arch/arm_gem5/kputchar.c with 100% similarity]
kernel/arch/omap44xx/linker.lds.in [moved from kernel/arch/arm_gem5/linker.lds.in with 100% similarity]
kernel/arch/omap44xx/multiboot.c [moved from kernel/arch/arm_gem5/multiboot.c with 100% similarity]
kernel/arch/omap44xx/omap.c [moved from kernel/arch/arm_gem5/omap.c with 100% similarity]
kernel/arch/omap44xx/omap_uart.c [moved from kernel/arch/arm_gem5/omap_uart.c with 100% similarity]
kernel/arch/omap44xx/paging.c [moved from kernel/arch/arm_gem5/paging.c with 100% similarity]
kernel/arch/omap44xx/pl011_uart.c [moved from kernel/arch/arm_gem5/pl011_uart.c with 100% similarity]
kernel/arch/omap44xx/start_aps.c [moved from kernel/arch/arm_gem5/start_aps.c with 100% similarity]
kernel/arch/omap44xx/startup_arch.c [moved from kernel/arch/arm_gem5/startup_arch.c with 100% similarity]
kernel/arch/omap44xx/syscall.c [moved from kernel/arch/arm_gem5/syscall.c with 100% similarity]
lib/octopus/Hakefile
tools/arm_molly/build_data_files.sh
tools/arm_molly/molly_init.c

index a72c3f4..8a2dd1a 100644 (file)
@@ -160,13 +160,18 @@ kernelLdFlags = [ Str "-Wl,-N",
 -- Link the kernel (CPU Driver)\r
 --\r
 linkKernel :: Options -> [String] -> [String] -> String -> HRule\r
-linkKernel opts objs libs kbin =\r
-    let linkscript = "/kernel/linker.lds"\r
-        kbootable  = kbin ++ ".bin"\r
+linkKernel opts objs libs name =\r
+    let linkscript = "/kernel/" ++ name ++ ".lds"\r
+        kernelmap  = "/kernel/" ++ name ++ ".map"\r
+        kasmdump   = "/kernel/" ++ name ++ ".asm"\r
+        kbinary    = "/sbin/" ++ name\r
+        kbootable  = kbinary ++ ".bin"\r
     in\r
         Rules [ Rule ([ Str compiler, Str Config.cOptFlags,\r
                       NStr "-T", In BuildTree arch linkscript,\r
-                      Str "-o", Out arch kbin\r
+                      Str "-o", Out arch kbinary,\r
+                      NStr "-Wl,-Map,", Out arch kernelmap\r
+                                \r
                     ]\r
                     ++ (optLdFlags opts)\r
                     ++\r
@@ -176,12 +181,12 @@ linkKernel opts objs libs kbin =
                     ++\r
                     [ Str "-lgcc" ]\r
                    ),\r
-              -- Edit ELF header so qemu-system-arm will treat it as a Linux kernel\r
---              Rule [ In SrcTree "src" "/tools/arm-mkbootelf.sh",\r
---                     Str objdump, In BuildTree arch kbin, Out arch (kbootable)],\r
               -- Generate kernel assembly dump\r
-              Rule [ Str (objdump ++ " -d -M reg-names-raw"),\r
-                    In BuildTree arch kbin, Str ">", Out arch (kbin ++ ".asm")],\r
+              Rule [ Str objdump, \r
+                     Str "-d", \r
+                     Str "-M reg-names-raw",\r
+                     In BuildTree arch kbinary, \r
+                     Str ">", Out arch kasmdump ],\r
               Rule [ Str "cpp",\r
                      NStr "-I", NoDep SrcTree "src" "/kernel/include/arch/arm_gem5",\r
                      Str "-D__ASSEMBLER__",\r
index c55747b..210f817 100644 (file)
@@ -321,7 +321,7 @@ stripSrcDir s = Path.removePrefix Config.source_dir s
 hakeModule :: [String] -> [(String,String)] -> String
 hakeModule allfiles hakefiles = 
     let unqual_imports = ["RuleDefs", "HakeTypes", "Path", "Args"]
-        qual_imports = ["Config"]
+        qual_imports = ["Config", "List" ]
         relfiles = [ stripSrcDir f | f <- allfiles ]
         wrap1 n c = wrapLet "build a" 
                     ("(buildFunction a) allfiles " ++ (show n) ++ " a")
index 0e989c5..3dcecd0 100644 (file)
@@ -715,13 +715,13 @@ linkCxx opts objs libs bin =
 --
 linkKernel :: Options -> String -> [String] -> [String] -> HRule
 linkKernel opts name objs libs
-    | optArch opts == "x86_64" = X86_64.linkKernel opts objs [libraryPath l | l <- libs ] kernelPath
-    | optArch opts == "x86_32" = X86_32.linkKernel opts objs [libraryPath l | l <- libs ] kernelPath
-    | optArch opts == "scc"    = SCC.linkKernel opts objs [libraryPath l | l <- libs ] kernelPath
-    | optArch opts == "arm" = ARM.linkKernel opts objs [libraryPath l | l <- libs ] kernelPath
-    | optArch opts == "arm11mp" = ARM11MP.linkKernel opts objs [libraryPath l | l <- libs ] kernelPath
-    | optArch opts == "xscale" = XScale.linkKernel opts objs [libraryPath l | l <- libs ] kernelPath
-    | optArch opts == "arm_gem5" = ArmGem5.linkKernel opts objs [libraryPath l | l <- libs ] kernelPath
+    | optArch opts == "x86_64" = X86_64.linkKernel opts objs [libraryPath l | l <- libs ] ("/sbin" ./. name)
+    | optArch opts == "x86_32" = X86_32.linkKernel opts objs [libraryPath l | l <- libs ] ("/sbin" ./. name)
+    | optArch opts == "scc"    = SCC.linkKernel opts objs [libraryPath l | l <- libs ] ("/sbin" ./. name)
+    | optArch opts == "arm" = ARM.linkKernel opts objs [libraryPath l | l <- libs ] ("/sbin" ./. name)
+    | optArch opts == "arm11mp" = ARM11MP.linkKernel opts objs [libraryPath l | l <- libs ] ("/sbin" ./. name)
+    | optArch opts == "xscale" = XScale.linkKernel opts objs [libraryPath l | l <- libs ] ("/sbin" ./. name)
+    | optArch opts == "arm_gem5" = ArmGem5.linkKernel opts objs [libraryPath l | l <- libs ] name
     | otherwise = Rule [ Str ("Error: Can't link kernel for '" ++ (optArch opts) ++ "'") ]
 
 --
@@ -1006,3 +1006,16 @@ libDeps xs = [x | (LibDep x) <- (sortBy xcmp) . nub . flat $ map str2dep xs ]
                   , "hashtable"]
           xcmp (LibDep a) (LibDep b) = compare (elemIndex a xord) (elemIndex b xord)
 
+
+--
+-- Build a CPU driver
+--
+
+cpuDriver :: Args.Args
+cpuDriver = Args.defaultArgs { Args.buildFunction = cpuDriverBuildFn, 
+                               Args.target = "cpu" }
+
+-- CPU drivers are built differently
+cpuDriverBuildFn :: [String] -> String -> Args.Args -> HRule
+cpuDriverBuildFn af tf args = Rules []
+
index 1dfee13..bbd7ce5 100644 (file)
@@ -38,7 +38,6 @@ BIN_RCCE_BT= \
 
 # Default list of modules to build/install for all enabled architectures
 MODULES_COMMON= \
-       sbin/cpu \
        sbin/init_null \
        sbin/init \
        sbin/chips \
@@ -71,6 +70,7 @@ MODULES_GENERIC= \
 # x86_64-specific modules to build by default
 # this should shrink as targets are ported and move into the generic list above
 MODULES_x86_64= \
+       sbin/cpu \
        sbin/mdbtest_range_query \
        sbin/mdbtest_addr_zero \
        sbin/mdb_bench \
@@ -166,6 +166,7 @@ MODULES_x86_64_broken= \
 
 # x86-32-specific module to build by default
 MODULES_x86_32=\
+       sbin/cpu \
        sbin/lpc_kbd \
        sbin/serial \
        $(BIN_RCCE_BT) \
@@ -191,6 +192,7 @@ MODULES_x86_32=\
 
 # SCC-specific module to build by default
 MODULES_scc=\
+       sbin/cpu \
        $(BIN_RCCE_BT) \
        $(BIN_RCCE_LU) \
        sbin/rcce_pingpong \
@@ -211,10 +213,12 @@ MODULES_scc=\
 
 # ARM-specific modules to build by default
 MODULES_arm=\
+       sbin/cpu \
        sbin/cpu.bin
 
 # XScale-specific modules to build by default
 MODULES_xscale=\
+       sbin/cpu \
        sbin/cpu.bin
 
 # ArmGem5-specific modules to build by default
@@ -222,6 +226,7 @@ MODULES_xscale=\
 
 # ARM11MP-specific modules to build by default
 MODULES_arm11mp=\
+       sbin/cpu \
        sbin/cpu.bin
 
 # construct list of all modules to be built (arch-specific and common for each arch)
@@ -424,7 +429,7 @@ arm_gem5_mc: arm_gem5_kernel_mc $(SRCDIR)/tools/arm_gem5/gem5script.py
        gem5.fast $(SRCDIR)/tools/arm_gem5/gem5script.py --kernel=arm_gem5_kernel --n=4 --caches --l2cache
 .PHONY : arm_gem5_mc
 
-# For the panda board
+# For the emulating the Pandaboard using GEM5
 menu.lst.arm_gem5_panda: $(SRCDIR)/hake/menu.lst.arm_gem5_panda
        cp $< $@
 
@@ -513,3 +518,33 @@ $(TESTS): %.txt: %.cfg tools/bin/simulator
 
 schedsim-check: $(wildcard $(SRCDIR)/tools/schedsim/*.cfg)
        for f in $^; do tools/bin/simulator $$f $(RUNTIME) | diff -q - `dirname $$f`/`basename $$f .cfg`.txt || exit 1; done
+
+
+#######################################################################
+#
+# Pandaboard builds
+#
+#######################################################################
+
+PANDABOARD_MODULES=\
+       arm_gem5/sbin/cpu_omap44xx \
+       arm_gem5/sbin/init \
+       arm_gem5/sbin/mem_serv \
+       arm_gem5/sbin/monitor \
+       arm_gem5/sbin/ramfsd \
+       arm_gem5/sbin/skb \
+       arm_gem5/sbin/spawnd \
+       arm_gem5/sbin/startd \
+       arm_gem5/sbin/memtest
+
+menu.lst.pandaboard: $(SRCDIR)/hake/menu.lst.pandaboard
+       cp $< $@
+
+pandaboard: $(PANDABOARD_MODULES) tools/bin/arm_molly menu.lst.pandaboard $(SRCDIR)/tools/arm_gem5/gem5script.py
+       # Translate each of the binary files we need
+       $(SRCDIR)/tools/arm_molly/build_data_files.sh menu.lst.pandaboard molly_tmp
+       # Build a C file to link into a single image for the 2nd-stage
+       # bootloader
+       tools/bin/arm_molly menu.lst.pandaboard arm_mbi.c
+       # Compile the complete boot image into a single executable
+       $(ARM_PREFIX)gcc -std=c99 -g -fPIC -pie -Wl,-N -fno-builtin -nostdlib -march=armv7-a -mapcs -fno-unwind-tables  -T$(SRCDIR)/tools/arm_molly/molly_ld_script -I$(SRCDIR)/include -I$(SRCDIR)/include/arch/arm -I./arm_gem5/include -I$(SRCDIR)/include/oldc -I$(SRCDIR)/include/c -imacros $(SRCDIR)/include/deputy/nodeputy.h $(SRCDIR)/tools/arm_molly/molly_boot.S $(SRCDIR)/tools/arm_molly/molly_init.c $(SRCDIR)/tools/arm_molly/lib.c ./arm_mbi.c $(SRCDIR)/lib/elf/elf32.c ./molly_tmp/* -o pandaboard_kernel
index 866dd56..df075c8 100644 (file)
 --
 -- This file is distributed under the terms in the attached LICENSE file.
 -- If you do not find this file, copies can be found by writing to:
--- ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
---
--- Hakefile for kernel
+-- ETH Zurich D-INFK, CAB F.78, Universitaetstr. 6, CH-8092 Zurich. 
+-- Attn: Systems Group.
 --
+-- Hakefile for Barrelfish CPU drivers
+-- 
 --------------------------------------------------------------------------
 
-let
-    scheduler = case Config.scheduler of
-                        Config.RR   -> "schedule_rr.c"
-                        Config.RBED -> "schedule_rbed.c"
-    microbench = if Config.microbenchmarks then ["microbenchmarks.c"] else []
-    timer = if Config.oneshot_timer then ["timer.c"] else []
-    indep_cfiles = [ "gdb_stub.c", "capabilities.c", "dispatch.c",
-                     scheduler, "memset.c", "memmove.c", "printf.c",
-                     "startup.c", "stdlib.c", "string.c", "syscall.c",
-                     "wakeup.c", "useraccess.c" ]
-                     ++ microbench ++ timer
-    indep_libs = [ "getopt", "mdb_kernel" ]
-    mkrules arch arch_cfiles arch_sfiles mackerelFiles arch_libs arch_absolute_cfiles arch_absolute_sfiles realarch_cfiles realarch_sfiles = (
-        let
-            opts = kernelOptions arch
-            in_arch_dir f = ("arch" ./. archFamily arch) ./. f
-            in_realarch_dir f = ("arch" ./. arch) ./. f
-            all_cfiles = indep_cfiles ++ (map in_arch_dir arch_cfiles) ++ arch_absolute_cfiles ++ (map in_realarch_dir realarch_cfiles)
-            sfiles = (map in_realarch_dir realarch_sfiles) ++ (map in_arch_dir arch_sfiles) ++ arch_absolute_sfiles
-            objs = [ objectFilePath opts f | f <- (sfiles ++ all_cfiles) ]
-        in
-            Rules ([
-                compileCFiles opts all_cfiles,
-                assembleSFiles opts sfiles,
-                linkKernel opts "cpu" objs (indep_libs ++ arch_libs),
-                Rule ( [ Str "OBJDUMP=objdump",
-                         In SrcTree "src" "/tools/gen-gdbscript.sh",
-                         In SrcTree "src" "/tools/debug.gdb.in",
-                         In BuildTree arch "../sbin/cpu",
-                         Str ">", Out arch "/debug.gdb"
-                        ] )
-             ] ++
-             [ mackerelDependencies opts m all_cfiles | m <- mackerelFiles ]
-            ))
-in [
-   -- x86_64
-   (let sfiles = [ "boot.S", "entry.S" ]
-        cfiles = ["debug.c", "gdb_arch.c", "init.c", "irq.c",
-                  "startup_arch.c", "exec.c", "syscall.c", "paging.c",
-                  "vmkit.c" , "page_mappings_arch.c" ] ++ microbench
-        in_x86_dir f = ("arch/x86") ./. f
-        x86_cFiles = [ "apic.c", "pic.c", "start_aps.c", "cmos.c", "misc.c",
-                       "serial.c", "multiboot.c", "conio.c", "syscall.c", "debugregs.c",
-                       "perfmon.c", "perfmon_intel.c", "perfmon_amd.c", "rtc.c", "timing.c",
-                       "startup_x86.c", "mcheck.c", "ipi_notify.c" ]
-        x86_sFiles = [ "init_ap_x86_64.S", "init_ap_x86_32.S" ]
-        absolute_cFiles = (map in_x86_dir x86_cFiles)
-        absolute_sFiles = (map in_x86_dir x86_sFiles)
-        mackerelFiles = [ "lpc_pic", "pc16550d", "ia32", "amd64",
-                          "xapic", "amd_vmcb", "cpuid", "lpc_rtc" ]
-        libs = [ "elf_kernel" ]
-    in mkrules "x86_64" cfiles sfiles mackerelFiles libs absolute_cFiles absolute_sFiles [] []),
-
-   -- x86_32
-   (let sfiles = [ "boot.S", "entry.S", "pic.S" ]
-        cfiles = ["debug.c", "gdb_arch.c", "init.c", "irq.c", "paging.c",
-                  "startup_arch.c", "exec.c", "syscall.c", "page_mappings_arch.c" ] ++ microbench
-        in_x86_dir f = ("arch/x86") ./. f
-        x86_cFiles = [ "apic.c", "pic.c", "start_aps.c", "cmos.c", "misc.c",
-                       "serial.c", "multiboot.c", "conio.c", "syscall.c", "debugregs.c",
-                       "perfmon.c", "perfmon_intel.c", "perfmon_amd.c", "rtc.c", "timing.c",
-                       "startup_x86.c", "ipi_notify.c" ]
-        x86_sFiles = [ "init_ap_x86_64.S", "init_ap_x86_32.S" ]
-        absolute_cFiles = (map in_x86_dir x86_cFiles)
-        absolute_sFiles = (map in_x86_dir x86_sFiles)
-        mackerelFiles = [ "lpc_pic", "pc16550d", "ia32", "amd64",
-                          "xapic", "cpuid", "lpc_rtc" ]
-        libs = [ "elf_kernel" ]
-    in mkrules "x86_32" cfiles sfiles mackerelFiles libs absolute_cFiles absolute_sFiles [] []),
-
-   -- scc
-   (let sfiles = [ "entry.S", "pic.S" ]
-        cfiles = [ "debug.c", "gdb_arch.c", "init.c", "irq.c", "paging.c",
-                   "startup_arch.c", "exec.c", "syscall.c", "page_mappings_arch.c" ] ++ microbench
-        arch_sfiles = [ "boot.S" ]
-        arch_cfiles = [ "rck.c" ]
-        in_x86_dir f = ("arch/x86") ./. f
-        x86_cFiles = [ "apic.c", "misc.c", "multiboot.c", "syscall.c", "debugregs.c", "timing.c",
-                       "startup_x86.c", "serial.c" ]
-        x86_sFiles = []
-        indep_cFiles = (map in_x86_dir x86_cFiles)
-        indep_sFiles = (map in_x86_dir x86_sFiles)
-        mackerelFiles = [ "pc16550d", "ia32", "xapic", "rck", "eMAC", "cpuid", "lpc_rtc" ]
-        libs = [ "elf_kernel" ]
-    in mkrules "scc" cfiles sfiles mackerelFiles libs indep_cFiles indep_sFiles arch_cfiles arch_sfiles),
-
-   -- arm
-   (let sfiles = [ "boot.S", "exceptions.S" ]
-        cfiles = [ "exn.c", "exec.c", "init.c", "integrator.c", "kludges.c", "kputchar.c", "misc.c", "pl011_uart.c", "paging.c", "phys_mmap.c", "startup_arch.c", "syscall.c" ]
-        mackerelFiles = [ "arm", "arm_icp_pit", "arm_icp_pic0", "pl011_uart" ]
-        libs = [ "elf", "cpio" ]
-    in mkrules "arm" cfiles sfiles mackerelFiles libs [] [] [] []),
+--
+-- Missing from this new Hakefile is the rule to build kernel debug
+-- symbols, since this requires some thinking about naming
+-- conventions.  Here is the rule we need:
+--
+--                Rule ( [ Str "OBJDUMP=objdump",
+--                         In SrcTree "src" "/tools/gen-gdbscript.sh",
+--                         In SrcTree "src" "/tools/debug.gdb.in",
+--                         In BuildTree arch "../sbin/cpu",
+--                         Str ">", Out arch "/debug.gdb"
+--                        ] )
 
-    -- arm_gem5
-   (let sfiles = [  ]
-        cfiles = [ "exec.c", "misc.c", "phys_mmap.c" ]
-        arch_sfiles = [ "boot.S", "exceptions.S" ]
-       arch_cfiles = ["init.c", "omap.c", "paging.c", "pl011_uart.c", "startup_arch.c", "syscall.c", "kludges.c", "multiboot.c", "omap_uart.c", "start_aps.c", "exn.c",  "kputchar.c" ]
-       mackerelFiles = [ "arm", "arm_icp_pit", "pl011_uart", "pl130_gic", "sp804_pit", "cortex_a9_pit", "a9scu", "omap_uart", "omap44xx_id" ]
-        libs = [ "elf", "cpio" ]
-    in mkrules "arm_gem5" cfiles sfiles mackerelFiles libs [] [] arch_cfiles arch_sfiles),
 
-   -- xscale
-   (let sfiles = [ "exceptions.S"  ]
-        cfiles = [ "exn.c", "exec.c", "init.c", "kludges.c", "misc.c", "phys_mmap.c", "startup_arch.c", "syscall.c" ]
-        arch_sfiles = [ "boot.S" ]
-        arch_cfiles = [ "ixp2800_integrator.c", "ixp2800_uart.c",
-                        "ixp2800_paging.c", "kputchar.c" ]
-        mackerelFiles = [ "arm", "ixp2800_icp_pit", "ixp2800_icp_pic0",
-                          "ixp2800_uart" ]
-        libs = [ "elf", "cpio" ]
-    in mkrules "xscale" cfiles sfiles mackerelFiles libs [] [] arch_cfiles arch_sfiles),
 
-   -- arm11mp
-   (let sfiles = [ "boot.S", "exceptions.S", "paging_cp.S" ]
-        cfiles = [ "exn.c", "exec.c", "init.c", "integrator.c", "kludges.c", "kputchar.c", "misc.c", "pl011_uart.c", "paging.c", "phys_mmap.c", "startup_arch.c", "syscall.c" ]
-        mackerelFiles = [ "arm", "arm_icp_pit", "arm_icp_pic0", "pl011_uart" ]
-    in mkrules "arm11mp" cfiles sfiles mackerelFiles [] [] [] [] [])
+let
+  scheduler = case Config.scheduler of
+      Config.RR   -> "schedule_rr.c"
+      Config.RBED -> "schedule_rbed.c"
+  common_c = [ "gdb_stub.c", 
+               "capabilities.c", 
+               "dispatch.c",
+               scheduler, 
+               "memset.c", 
+               "memmove.c", 
+               "printf.c",
+               "startup.c", 
+               "stdlib.c", 
+               "string.c", 
+               "syscall.c",
+               "wakeup.c", 
+               "useraccess.c" ]
+             ++ (if Config.microbenchmarks then ["microbenchmarks.c"] else [])
+             ++ (if Config.oneshot_timer then ["timer.c"] else [])
+  common_libs = [ "getopt", "mdb_kernel" ]
+  
+  link_cpudriver arg = linkKernel opts name objs libs
+    where 
+      opts = (kernelOptions $ head $ Args.architectures arg)
+      suffix = if "cpu" == Args.target arg 
+             then "" 
+             else "_" ++ (Args.target arg)
+      name = "cpu" ++ suffix
+      objs = [ objectFilePath opts f 
+             | f <- (Args.assemblyFiles arg) ++ (Args.cFiles arg) ++ common_c ] 
+      libs = (Args.addLibraries arg) ++ common_libs
+    
+  cpudrivers arglist = 
+    let 
+      cafiles = List.nub $ concat [ [ [ arch, cfile ] 
+                                    | arch <- Args.architectures arg,
+                                      cfile <- common_c ++ (Args.cFiles arg) ]
+                                  | arg <- arglist ]
+      safiles = List.nub $ concat [ [ [ arch, sfile ]
+                                    | arch <- Args.architectures arg,
+                                      sfile <- Args.assemblyFiles arg ]
+                                  | arg <- arglist ]
+      mafiles = List.nub $ concat [ [ [ arch, mfile ]
+                                    | arch <- Args.architectures arg,
+                                      mfile <- Args.mackerelDevices arg ]
+                                  | arg <- arglist ]
+    in
+     ( [ compileCFile (kernelOptions a) f | [a,f] <- cafiles ]
+       ++
+       [ assembleSFile (kernelOptions a) f | [a,f] <- safiles ]
+       ++
+       [ mackerelDependencies (kernelOptions a) f [ c | [a,c] <- cafiles]  
+       | [a,f] <- mafiles ]
+       ++
+       [ link_cpudriver arg | arg <- arglist ]
+     )
+         
+  in cpudrivers [
+  --
+  -- Generic Intel/AMD amd64 64-bit x86 core
+  --
+  cpuDriver { 
+     architectures = [ "x86_64" ],
+     assemblyFiles = [ "arch/x86_64/boot.S", 
+                       "arch/x86_64/entry.S", 
+                       "arch/x86/init_ap_x86_64.S", 
+                       "arch/x86/init_ap_x86_32.S" ],
+     cFiles = [ "arch/x86_64/debug.c", 
+                "arch/x86_64/gdb_arch.c", 
+                "arch/x86_64/init.c", 
+                "arch/x86_64/irq.c",
+                "arch/x86_64/startup_arch.c", 
+                "arch/x86_64/exec.c", 
+                "arch/x86_64/syscall.c", 
+                "arch/x86_64/paging.c",
+                "arch/x86_64/vmkit.c" , 
+                "arch/x86_64/page_mappings_arch.c",
+                "arch/x86/apic.c", 
+                "arch/x86/pic.c", 
+                "arch/x86/start_aps.c", 
+                "arch/x86/cmos.c", 
+                "arch/x86/misc.c",
+                "arch/x86/serial.c", 
+                "arch/x86/multiboot.c", 
+                "arch/x86/conio.c", 
+                "arch/x86/syscall.c", 
+                "arch/x86/debugregs.c",
+                "arch/x86/perfmon.c", 
+                "arch/x86/perfmon_intel.c", 
+                "arch/x86/perfmon_amd.c", 
+                "arch/x86/rtc.c", 
+                "arch/x86/timing.c",
+                "arch/x86/startup_x86.c", 
+                "arch/x86/mcheck.c", 
+                "arch/x86/ipi_notify.c"
+              ],
+     mackerelDevices = [ "lpc_pic", 
+                         "pc16550d", 
+                         "ia32", 
+                         "amd64", 
+                         "xapic", 
+                         "amd_vmcb", 
+                         "cpuid", 
+                         "lpc_rtc" ],
+     addLibraries = [ "elf_kernel" ]
+     },
+  --
+  -- Generic Intel ia32 32-bit x86 core
+  --
+  cpuDriver { 
+     architectures = [ "x86_32" ],
+     assemblyFiles = [ "arch/x86_32/boot.S", 
+                       "arch/x86_32/entry.S", 
+                       "arch/x86_32/pic.S",
+                       "arch/x86/init_ap_x86_64.S", 
+                       "arch/x86/init_ap_x86_32.S" ],
+     cFiles = [ "arch/x86_32/debug.c", 
+                "arch/x86_32/gdb_arch.c", 
+                "arch/x86_32/init.c", 
+                "arch/x86_32/irq.c",
+                "arch/x86_32/startup_arch.c", 
+                "arch/x86_32/exec.c", 
+                "arch/x86_32/syscall.c", 
+                "arch/x86_32/paging.c",
+                "arch/x86_32/page_mappings_arch.c",
+                "arch/x86/apic.c", 
+                "arch/x86/pic.c", 
+                "arch/x86/start_aps.c", 
+                "arch/x86/cmos.c", 
+                "arch/x86/misc.c",
+                "arch/x86/serial.c", 
+                "arch/x86/multiboot.c", 
+                "arch/x86/conio.c", 
+                "arch/x86/syscall.c", 
+                "arch/x86/debugregs.c",
+                "arch/x86/perfmon.c", 
+                "arch/x86/perfmon_intel.c", 
+                "arch/x86/perfmon_amd.c", 
+                "arch/x86/rtc.c", 
+                "arch/x86/timing.c",
+                "arch/x86/startup_x86.c", 
+                "arch/x86/ipi_notify.c"
+              ],
+     mackerelDevices = [ "lpc_pic", 
+                         "pc16550d", 
+                         "ia32", 
+                         "amd64", 
+                         "xapic", 
+                         "cpuid", 
+                         "lpc_rtc" ],
+     addLibraries = [ "elf_kernel" ]
+     },
+  --
+  -- Intel Gauss Lake P54C core in the Rock Creek Single-Chip Cloud Computer
+  --
+  cpuDriver { 
+     architectures = [ "scc" ],
+     assemblyFiles = [ "arch/scc/boot.S",
+                       "arch/x86_32/entry.S", 
+                       "arch/x86_32/pic.S" ],
+     cFiles = [ "arch/scc/rck.c",
+                "arch/x86_32/debug.c", 
+                "arch/x86_32/gdb_arch.c", 
+                "arch/x86_32/init.c", 
+                "arch/x86_32/irq.c",
+                "arch/x86_32/startup_arch.c", 
+                "arch/x86_32/exec.c", 
+                "arch/x86_32/syscall.c", 
+                "arch/x86_32/paging.c",
+                "arch/x86_32/page_mappings_arch.c",
+                "arch/x86/apic.c", 
+                "arch/x86/misc.c",
+                "arch/x86/serial.c", 
+                "arch/x86/multiboot.c", 
+                "arch/x86/syscall.c", 
+                "arch/x86/debugregs.c",
+                "arch/x86/timing.c",
+                "arch/x86/startup_x86.c"
+              ],
+     mackerelDevices = [ "pc16550d", 
+                         "ia32", 
+                         "xapic", 
+                         "rck", 
+                         "eMAC", 
+                         "cpuid", 
+                         "lpc_rtc" ],
+     addLibraries = [ "elf_kernel" ]
+     },
+  --
+  -- Generic ARMv7 core, unused?
+  --
+  cpuDriver {
+     architectures = [ "arm" ],
+     assemblyFiles = [ "arch/arm/boot.S", 
+                       "arch/arm/exceptions.S" ],
+     cFiles = [ "arch/arm/exn.c", 
+                "arch/arm/exec.c", 
+                "arch/arm/init.c", 
+                "arch/arm/integrator.c", 
+                "arch/arm/kludges.c", 
+                "arch/arm/kputchar.c", 
+                "arch/arm/misc.c", 
+                "arch/arm/pl011_uart.c", 
+                "arch/arm/paging.c", 
+                "arch/arm/phys_mmap.c", 
+                "arch/arm/startup_arch.c", 
+                "arch/arm/syscall.c" ],
+     mackerelDevices = [ "arm", 
+                         "arm_icp_pit", 
+                         "arm_icp_pic0", 
+                         "pl011_uart" ],
+     addLibraries = [ "elf", "cpio" ]
+     },
+  --
+  -- ARM 11MP v7 core, used for QEmu testing
+  --
+  cpuDriver {
+     architectures = [ "arm11mp" ],
+     assemblyFiles = [ "arch/arm/boot.S", 
+                       "arch/arm/exceptions.S", 
+                       "arch/paging_cp.S" ],
+     cFiles = [ "arch/arm/exn.c", 
+                "arch/arm/exec.c", 
+                "arch/arm/init.c", 
+                "arch/arm/integrator.c", 
+                "arch/arm/kludges.c", 
+                "arch/arm/kputchar.c", 
+                "arch/arm/misc.c", 
+                "arch/arm/pl011_uart.c", 
+                "arch/arm/paging.c", 
+                "arch/arm/phys_mmap.c", 
+                "arch/arm/startup_arch.c", 
+                "arch/arm/syscall.c" ],
+     mackerelDevices = [ "arm", 
+                         "arm_icp_pit", 
+                         "arm_icp_pic0", 
+                         "pl011_uart" ],
+     addLibraries = [ "elf", "cpio" ]
+     },
+  --
+  -- ARM Gem5 Cortex-A series core
+  --
+  cpuDriver { 
+    architectures = [ "arm_gem5" ],
+    assemblyFiles = [ "arch/arm_gem5/boot.S",
+                      "arch/arm_gem5/exceptions.S" ],
+    cFiles = [ "arch/arm/exec.c", 
+               "arch/arm/misc.c", 
+               "arch/arm/phys_mmap.c",
+               "arch/arm_gem5/init.c", 
+               "arch/arm_gem5/paging.c", 
+               "arch/arm_gem5/pl011_uart.c", 
+               "arch/arm_gem5/startup_arch.c", 
+               "arch/arm_gem5/syscall.c", 
+               "arch/arm_gem5/kludges.c", 
+               "arch/arm_gem5/multiboot.c", 
+               "arch/arm_gem5/start_aps.c", 
+               "arch/arm_gem5/exn.c", 
+               "arch/arm_gem5/kputchar.c" ],
+    mackerelDevices = [ "arm", 
+                        "arm_icp_pit", 
+                        "pl011_uart", 
+                        "pl130_gic", 
+                        "sp804_pit", 
+                        "cortex_a9_pit", 
+                        "a9scu" ],
+    addLibraries = [ "elf", "cpio" ]
+    },
+  --
+  -- Intel ixp2800 XScale core
+  --
+  cpuDriver {
+     target = "ixp2800",
+     architectures = [ "xscale" ],
+     assemblyFiles = [ "arch/xscale/boot.S", 
+                       "arch/arm/exceptions.S"  ],
+     cFiles = [ "arch/arm/exn.c", 
+                "arch/arm/exec.c", 
+                "arch/arm/init.c", 
+                "arch/arm/kludges.c", 
+                "arch/arm/misc.c", 
+                "arch/arm/phys_mmap.c", 
+                "arch/arm/startup_arch.c", 
+                "arch/arm/syscall.c", 
+                "arch/xscale/ixp2800_integrator.c", 
+                "arch/xscale/ixp2800_uart.c", 
+                "arch/xscale/ixp2800_paging.c", 
+                "arch/xscale/kputchar.c" ],
+     mackerelDevices = [ "arm", 
+                         "ixp2800_icp_pit", 
+                         "ixp2800_icp_pic0", 
+                         "ixp2800_uart" ],
+     addLibraries = [ "elf", "cpio" ]
+     },
+  --
+  -- Broadcom OMAP44xx-series dual-core Cortex-A9 SoC
+  --
+  cpuDriver {
+     target = "omap44xx",
+     architectures = [ "arm_gem5" ],
+     assemblyFiles = [ "arch/omap44xx/boot.S",
+                       "arch/omap44xx/exceptions.S" ],
+     cFiles = [ "arch/arm/exec.c", 
+                "arch/arm/misc.c", 
+                "arch/arm/phys_mmap.c",
+                "arch/omap44xx/init.c", 
+                "arch/omap44xx/omap.c", 
+                "arch/omap44xx/paging.c", 
+                "arch/omap44xx/pl011_uart.c", 
+                "arch/omap44xx/startup_arch.c", 
+                "arch/omap44xx/syscall.c", 
+                "arch/omap44xx/kludges.c", 
+                "arch/omap44xx/multiboot.c", 
+                "arch/omap44xx/omap_uart.c", 
+                "arch/omap44xx/start_aps.c", 
+                "arch/omap44xx/exn.c", 
+                "arch/omap44xx/kputchar.c" ],
+     mackerelDevices = [ "arm", 
+                         "arm_icp_pit", 
+                         "pl011_uart", 
+                         "pl130_gic", 
+                         "sp804_pit", 
+                         "cortex_a9_pit", 
+                         "a9scu", 
+                         "omap_uart", 
+                         "omap44xx_id" ],
+     addLibraries = [ "elf", "cpio" ]
+     }                            
+  
   ]
+     
+     
\ No newline at end of file
similarity index 98%
rename from kernel/arch/arm_gem5/init.c
rename to kernel/arch/omap44xx/init.c
index bb3a625..58f2b7c 100644 (file)
@@ -372,13 +372,8 @@ static void  __attribute__ ((noinline,noreturn)) text_init(void)
                                                   ARM_L1_SECTION_BYTES);
     omap44xx_id_t id;
     omap44xx_id_initialize(&id, (mackerel_addr_t)(id_code_remapped + 
-<<<<<<< variant A
-                                                  (CONFIG_PHYSBASE & ARM_L1_SECTION_MASK)));
->>>>>>> variant B
-                                (OMAP44XX_MAP_L4_CFG_SYSCTRL_GENERAL_CORE & ARM_L1_SECTION_MASK)));
-####### Ancestor
-                                (CONFIG_PHYSBASE & ARM_L1_SECTION_MASK)));
-======= end
+            (OMAP44XX_MAP_L4_CFG_SYSCTRL_GENERAL_CORE & ARM_L1_SECTION_MASK)));
+
     char buf[200];
     omap44xx_id_code_pr(buf,200,&id);
     printf("Using MMU, %s", buf);
index 811d9a1..ca8e1b7 100644 (file)
@@ -33,7 +33,7 @@
                                "client/locking.c", "client/semaphores.c", 
                                "client/capability_storage.c", 
                                "client/strnatcmp.c" ],
-                    flounderDefs = [ "octopus" ],
+                    flounderDefs = [ "octopus", "monitor" ],
                     flounderBindings = [ "octopus" ],
                     flounderExtraBindings = [ ("octopus", ["rpcclient"]) ],
                     flounderTHCStubs = [ "octopus" ],
index aa1a25e..4db65f3 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 if [ $# != 2 ]; then
-    echo Expected $0 menu.lst output_prefix
+    echo Usage: $0 menu.lst output_prefix
     exit 1
 fi
 
@@ -11,7 +11,7 @@ OUTPUT_PREFIX=$2
 # Prefix prepended to each output file within the directory
 # $OUTPUT_PREFIX (for safety, this means we can clean the directory
 # by removing everything with this prefix)
-FILE_PREFIX=tmp_m5
+FILE_PREFIX=tmp_molly
 
 # Set up output direcotry
 if [ -e $OUTPUT_PREFIX  ] && [ ! -d $OUTPUT_PREFIX ]; then
@@ -30,7 +30,7 @@ if [ ! -d $OUTPUT_PREFIX/ ]; then
 fi
 
 # Get list of binaries to translate
-BINS=$(grep -e'^kernel' -e'^module' $MENU_LST | awk '{print $2}')
+BINS=$(awk '/^kernel/ || /^module/ {print $2}' $MENU_LST)
 
 # For each binary generate an object file in the output directory.
 # The flags to objcopy cause it to place the binary image of the input
index 290babf..2b43f75 100644 (file)
@@ -49,9 +49,9 @@ static errval_t linear_alloc(void *s, genvaddr_t base, size_t size, uint32_t fla
 
 genvaddr_t kernel_entry;
 
-extern char _binary_arm_gem5_sbin_cpu_start;
-extern char _binary_arm_gem5_sbin_cpu_end;
-extern char _binary_arm_gem5_sbin_cpu_size;
+//extern char _binary_arm_gem5_sbin_cpu_start;
+//extern char _binary_arm_gem5_sbin_cpu_end;
+//extern char _binary_arm_gem5_sbin_cpu_size;
 
 
 // Prototypes for functions from molly_boot.S: