T118: libbarrelfish: Refactor architecture specific debug syscalls. Move common debug...
[barrelfish] / lib / barrelfish / Hakefile
1 --------------------------------------------------------------------------
2 -- Copyright (c) 2007-2012, ETH Zurich
3 -- Copyright (c) 2014, HP Labs.
4 -- All rights reserved.
5 --
6 -- This file is distributed under the terms in the attached LICENSE file.
7 -- If you do not find this file, copies can be found by writing to:
8 -- ETH Zurich D-INFK, CAB F.78, Universitaetstr. 6, CH-8092 Zurich,
9 -- Attn: Systems Group.
10 --
11 -- Hakefile for lib/barrelfish
12 --
13 --------------------------------------------------------------------------
14
15 [(let arch_dir = "arch" ./. archFamily arch
16       common_srcs = [ "capabilities.c", "init.c", "dispatch.c", "threads.c",
17                       "thread_once.c", "thread_sync.c", "slab.c", "domain.c", "idc.c",
18                       "waitset.c", "event_queue.c", "event_mutex.c",
19                       "idc_export.c", "nameservice_client.c", "msgbuf.c",
20                       "monitor_client.c", "flounder_support.c", "flounder_glue_binding.c",
21                       "flounder_txqueue.c","morecore.c", "debug.c", "heap.c",
22                       "ram_alloc.c", "terminal.c", "spawn_client.c", "vspace/vspace.c",
23                       "vspace/vregion.c", "vspace/memobj_one_frame.c",
24                       "vspace/memobj_one_frame_lazy.c",
25                       "vspace/utils.c", "vspace/memobj_fixed.c", "vspace/memobj_numa.c",
26                       "vspace/memobj_one_frame_one_map.c", "vspace/mmu_aware.c",
27                       "slot_alloc/single_slot_alloc.c", "slot_alloc/multi_slot_alloc.c",
28                       "slot_alloc/slot_alloc.c", "slot_alloc/range_slot_alloc.c",
29                       "bulk_transfer.c", "trace.c", "resource_ctrl.c", "coreset.c",
30                       "inthandler.c", "deferred.c", "syscalls.c", "sys_debug.c"
31                     ]
32
33       idc_srcs = concat $ map getsrcs $ optInterconnectDrivers $ options arch
34           where
35             getsrcs "lmp" = [ "lmp_chan.c", "lmp_endpoints.c" ]
36             getsrcs "ump" = [ "ump_chan.c", "ump_endpoint.c" ]
37             getsrcs "multihop" = [ "multihop_chan.c" ]
38             getsrcs _ = []
39
40       -- configure default morecore pagesize based on Config.hs
41       morecore_pagesize "x86_64" = case Config.morecore_pagesize of
42           "large" -> "LARGE_PAGE_SIZE"
43           "huge"  -> "HUGE_PAGE_SIZE"
44           _       -> "BASE_PAGE_SIZE"
45       morecore_pagesize "x86_32" = case Config.morecore_pagesize of
46           "large" -> "LARGE_PAGE_SIZE"
47           _       -> "BASE_PAGE_SIZE"
48       morecore_pagesize _ = "BASE_PAGE_SIZE"
49
50
51       -- sources specific to the architecture family
52       archfam_srcs "x86_32"  = [ "arch/x86_32/debug.c" ,
53                               "arch/x86_32/dispatch.c" , "arch/x86_32/syscalls.c" ,
54                               "arch/x86_32/sys_debug.c", "target/x86_32/pmap_target.c",
55                               "target/x86/pmap_x86.c",
56                               "vspace/arch/x86_32/layout.c" , "vspace/memobj_pinned.c" ,
57                               "vspace/pinned.c", "vspace/memobj_anon.c",
58                               "arch/x86/perfmon.c", "arch/x86/tls.c",
59                               "arch/x86/sys_debug.c"]
60       archfam_srcs "x86_64"  = [ "arch/x86_64/debug.c", "arch/x86_64/dispatch.c" ,
61                                  "arch/x86_64/syscalls.c", "arch/x86_64/sys_debug.c",
62                                  "arch/x86_64/ldt.c",
63                                  "target/x86_64/pmap_target.c", "target/x86/pmap_x86.c",
64                                  "vspace/arch/x86_64/layout.c",
65                                  "vspace/memobj_pinned.c", "vspace/pinned.c", "vspace/memobj_anon.c",
66                                  "arch/x86/perfmon.c", "arch/x86/tls.c",
67                                  "arch/x86/sys_debug.c"]
68       archfam_srcs "k1om"   = [ "arch/x86_64/debug.c", "arch/x86_64/dispatch.c" ,
69                                  "arch/x86_64/syscalls.c", "arch/x86_64/sys_debug.c",
70                                  "arch/x86_64/ldt.c",
71                                  "target/x86_64/pmap_target.c", "target/x86/pmap_x86.c",
72                                  "vspace/arch/x86_64/layout.c",
73                                  "vspace/memobj_pinned.c", "vspace/pinned.c", "vspace/memobj_anon.c",
74                                  "arch/x86/perfmon.c", "arch/x86/tls.c",
75                                  "arch/x86/sys_debug.c"]
76       archfam_srcs "arm"     = [ "arch/arm/debug.c", "arch/arm/dispatch.c",
77                                  "arch/arm/pmap_arch.c", "arch/arm/sys_debug.c",
78                                  "arch/arm/syscalls.c", "vspace/memobj_pinned.c" ,
79                                  "vspace/pinned.c", "vspace/memobj_anon.c",
80                                  "vspace/arch/arm/layout.c",
81                                  "arch/arm/sys_debug.c"]
82       archfam_srcs _         = []
83
84       -- sources specific to the architecture
85       arch_srcs "scc" = [ "arch/x86/ipi_notify.c" ]
86       arch_srcs "x86_32" = [ "arch/x86/ipi_notify.c" ]
87       arch_srcs "x86_64" = [ "arch/x86/ipi_notify.c" ]
88       arch_srcs "k1om" = [ "arch/x86/ipi_notify.c" ]
89       arch_srcs _     = []
90
91       arch_assembly "x86_32"  = [ "arch/x86_32/entry.S" ]
92       arch_assembly "x86_64"  = [ "arch/x86_64/entry.S" ]
93       arch_assembly "k1om"    = [ "arch/x86_64/entry.S" ]
94       arch_assembly "arm"     = [ "arch/arm/entry.S", "arch/arm/syscall.S" ]
95       arch_assembly "armv7-m" = [ "arch/arm/entry.S", "arch/arm/syscall.S" ]
96       arch_assembly _         = []
97
98   in
99     build library { target = "barrelfish",
100                     architectures = [arch],
101                     cFiles = arch_srcs arch ++ archfam_srcs (archFamily arch)
102                              ++ common_srcs ++ idc_srcs,
103                     assemblyFiles = arch_assembly (archFamily arch),
104                     flounderBindings = [ "mem", "octopus", "interdisp", "spawn",
105                                          "terminal", "arrakis", "terminal_config" ],
106                     -- only makes sense to compile monitor binding for lmp
107                     flounderTHCStubs = [ "octopus" ],
108                     flounderExtraBindings = [ ("monitor", ["lmp"]),
109                                               ("monitor_blocking", ["lmp", "rpcclient"]),
110                                               ("mem", ["rpcclient"]),
111                                               ("octopus", ["rpcclient"]),
112                                               ("spawn", ["rpcclient"]),
113                                               ("arrakis", ["rpcclient"])],
114                     addCFlags = [ "-DMORECORE_PAGESIZE="++(morecore_pagesize arch) ],
115                     addIncludes = [ "include", "include" ./. arch_dir ],
116                     addGeneratedDependencies = [ "/include/asmoffsets.h" ]
117                   }
118  ) | arch <- allArchitectures ] ++
119 [(let arch_dir = "arch" ./. archFamily arch
120       common_srcs = [ "capabilities.c", "init.c", "dispatch.c", "threads.c",
121                       "thread_sync.c", "slab.c", "domain.c", "idc.c",
122                       "waitset.c", "event_queue.c", "event_mutex.c",
123                       "idc_export.c", "nameservice_client.c", "msgbuf.c",
124                       "monitor_client.c", "flounder_support.c", "flounder_glue_binding.c",
125                       "morecore.c", "debug.c", "heap.c", "ram_alloc.c",
126                       "terminal.c", "spawn_client.c", "vspace/vspace.c",
127                       "vspace/vregion.c", "vspace/memobj_one_frame.c",
128                       "vspace/memobj_one_frame_lazy.c",
129                       "vspace/utils.c",
130                       "vspace/memobj_one_frame_one_map.c", "vspace/mmu_aware.c",
131                       "slot_alloc/single_slot_alloc.c", "slot_alloc/multi_slot_alloc.c",
132                       "slot_alloc/slot_alloc.c", "slot_alloc/range_slot_alloc.c",
133                       "bulk_transfer.c", "trace.c", "resource_ctrl.c", "coreset.c",
134                       "inthandler.c", "deferred.c", "syscalls.c", "sys_debug.c"
135                     ]
136
137       idc_srcs = concat $ map getsrcs $ optInterconnectDrivers $ options arch
138           where
139             getsrcs "lmp" = [ "lmp_chan.c", "lmp_endpoints.c" ]
140             getsrcs "ump" = [ "ump_chan.c", "ump_endpoint.c" ]
141             getsrcs "multihop" = [ "multihop_chan.c" ]
142             getsrcs _ = []
143
144       -- configure default morecore pagesize based on Config.hs
145       morecore_pagesize "x86_64" = case Config.morecore_pagesize of
146           "large" -> "LARGE_PAGE_SIZE"
147           "huge"  -> "HUGE_PAGE_SIZE"
148           _       -> "BASE_PAGE_SIZE"
149       morecore_pagesize "x86_32" = case Config.morecore_pagesize of
150           "large" -> "LARGE_PAGE_SIZE"
151           _       -> "BASE_PAGE_SIZE"
152       morecore_pagesize _ = "BASE_PAGE_SIZE"
153
154
155       -- sources specific to the architecture family
156       archfam_srcs "x86_32"  = [ "arch/x86_32/debug.c" ,
157                               "arch/x86_32/dispatch.c" , "arch/x86_32/syscalls.c" ,
158                               "arch/x86_32/sys_debug.c", "target/x86_32/pmap_target.c",
159                               "target/x86/pmap_x86.c",
160                               "vspace/arch/x86_32/layout.c" , "vspace/memobj_pinned.c" ,
161                               "vspace/pinned.c", "vspace/memobj_anon.c",
162                               "arch/x86/perfmon.c", "arch/x86/tls.c",
163                               "arch/x86/sys_debug.c"]
164       archfam_srcs "x86_64"  = [ "arch/x86_64/debug.c", "arch/x86_64/dispatch.c" ,
165                                  "arch/x86_64/syscalls.c", "arch/x86_64/sys_debug.c",
166                                  "arch/x86_64/ldt.c",
167                                  "target/x86_64/pmap_target.c", "target/x86/pmap_x86.c",
168                                  "vspace/arch/x86_64/layout.c",
169                                  "vspace/memobj_pinned.c", "vspace/pinned.c", "vspace/memobj_anon.c",
170                                  "arch/x86/perfmon.c", "arch/x86/tls.c",
171                                  "arch/x86/sys_debug.c"]
172       archfam_srcs "arm"     = [ "arch/arm/debug.c", "arch/arm/dispatch.c",
173                                  "arch/arm/pmap_arch.c", "arch/arm/sys_debug.c",
174                                  "arch/arm/syscalls.c", "vspace/memobj_pinned.c" ,
175                                  "vspace/pinned.c", "vspace/memobj_anon.c",
176                                  "vspace/arch/arm/layout.c",
177                                  "arch/arm/sys_debug.c"]
178       archfam_srcs _         = []
179
180       -- sources specific to the architecture
181       arch_srcs "scc" = [ "arch/x86/ipi_notify.c" ]
182       arch_srcs "x86_32" = [ "arch/x86/ipi_notify.c" ]
183       arch_srcs "x86_64" = [ "arch/x86/ipi_notify.c" ]
184       arch_srcs _     = []
185
186       arch_assembly "x86_32"  = [ "arch/x86_32/entry.S" ]
187       arch_assembly "x86_64"  = [ "arch/x86_64/entry.S" ]
188       arch_assembly "arm"     = [ "arch/arm/entry.S", "arch/arm/syscall.S" ]
189       arch_assembly _         = []
190
191   in
192     build library { target = "arrakis",
193                     architectures = [arch],
194                     cFiles = arch_srcs arch ++ archfam_srcs (archFamily arch)
195                              ++ common_srcs ++ idc_srcs,
196                     assemblyFiles = arch_assembly (archFamily arch),
197                     addCFlags = [ "-DARRAKIS", "-DMORECORE_PAGESIZE="++(morecore_pagesize arch) ],
198                     flounderBindings = [ "mem", "octopus", "interdisp", "spawn", "arrakis",
199                                          "terminal", "terminal_config", "terminal_session" ],
200                     -- only makes sense to compile monitor binding for lmp
201                     flounderTHCStubs = [ "octopus" ],
202                     flounderExtraBindings = [ ("monitor", ["lmp"]),
203                                               ("monitor_blocking", ["lmp", "rpcclient"]),
204                                               ("mem", ["rpcclient"]),
205                                               ("octopus", ["rpcclient"]),
206                                               ("spawn", ["rpcclient"]),
207                                               ("arrakis", ["rpcclient"])],
208                     addIncludes = [ "include", "include" ./. arch_dir ],
209                     addGeneratedDependencies = [ "/include/asmoffsets.h" ]
210                   }
211  ) | arch <- allArchitectures ]