]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/Modules.amd64
373abc1a56f7272c41224977e3c5a44861f0a8fe
[l4.git] / kernel / fiasco / src / Modules.amd64
1 # -*- makefile -*-
2
3 SUBSYSTEMS = JABI ABI DRIVERS KERNEL CRT0 BOOT LIBK LIBAMM \
4              CHECKSUM CXXLIB MINILIBC LIBKERN TCBOFFSET SYMBOLS VERSION GBLCFG
5
6 ifeq ("$(CONFIG_GSTABS)","y")      
7   SUBSYSTEMS            += LINES
8 endif
9
10 PREPROCESS_PARTS        += arch $(CONFIG_ABI) 64bit iofp         \
11                            $(CONFIG_XARCH) apic abs-timeout-hack \
12                            i8259 pc i8254 fpu                    \
13                            auto_map_kip
14
15 OBJ_SPACE-y = phys
16 OBJ_SPACE-  = virt
17 OBJ_SPACE   = $(OBJ_SPACE-$(CONFIG_DISABLE_VIRT_OBJ_SPACE))
18
19 PREPROCESS_PARTS += obj_space_$(OBJ_SPACE)
20
21 PREPROCESS_PARTS-$(CONFIG_MP)                += mp
22 PREPROCESS_PARTS-$(CONFIG_LIST_ALLOC_SANITY) += list_alloc_debug
23 PREPROCESS_PARTS-$(CONFIG_JDB)               += debug log
24 PREPROCESS_PARTS-$(CONFIG_PROFILE)           += profile
25 PREPROCESS_PARTS-$(CONFIG_SCHED_PIT)         += pit_timer
26 PREPROCESS_PARTS-$(CONFIG_SCHED_RTC)         += rtc_timer
27 PREPROCESS_PARTS-$(CONFIG_SCHED_APIC)        += apic_timer
28 PREPROCESS_PARTS-$(CONFIG_SCHED_HPET)        += hpet_timer
29 PREPROCESS_PARTS-$(CONFIG_SERIAL)            += serial 16550
30 PREPROCESS_PARTS-$(CONFIG_WATCHDOG)          += watchdog
31 PREPROCESS_PARTS-$(CONFIG_PERF_CNT)          += perf_cnt
32 PREPROCESS_PARTS-$(CONFIG_IO_PROT)           += io
33 PREPROCESS_PARTS-$(CONFIG_CPU_VIRT)          += svm vmx
34 PREPROCESS_PARTS-$(CONFIG_SCHED_FIXED_PRIO)  += sched_fixed_prio
35 PREPROCESS_PARTS-$(CONFIG_SCHED_WFQ)         += sched_wfq
36 PREPROCESS_PARTS-$(CONFIG_SCHED_FP_WFQ)      += sched_fp_wfq
37
38 PREPROCESS_PARTS        += $(PREPROCESS_PARTS-y)
39
40 #
41 # TYPES subsystem
42 #
43 PRIVATE_INCDIR          += types/$(CONFIG_XARCH) types
44
45 #
46 # ABI Subsystem
47 #
48 ABI                     := libabi.a
49 VPATH                   += abi/$(CONFIG_XARCH) abi
50 INTERFACES_ABI          := l4_fpage l4_msg_item l4_buf_desc kip l4_types \
51                            l4_error virt
52
53 kip_IMPL                := kip kip-debug kip-amd64 kip-amd64-debug
54 l4_types_IMPL           := l4_types l4_types-debug
55 virt_IMPL               := virt-ia32-amd64
56
57 #
58 # JABI Subsystem
59 #
60 JABI                    := libjabi.a
61 VPATH                   += jabi/$(CONFIG_XARCH) jabi
62 INTERFACES_JABI         := jdb_ktrace
63
64 #
65 # DRIVERS subsystem
66 #
67 DRIVERS                 := libdrivers.a libgluedriverslibc.a
68 VPATH                   += drivers/$(CONFIG_XARCH) drivers
69 PRIVATE_INCDIR          += drivers/$(CONFIG_XARCH) drivers
70 INTERFACES_DRIVERS      := mux_console console keyb io pci vga_console reset \
71                            processor delayloop mem
72 ifeq ("$(CONFIG_SERIAL)","y")
73 INTERFACES_DRIVERS      += filter_console uart
74 endif
75 reset_IMPL              := reset-amd64
76 uart_IMPL               := uart uart-16550
77 CXXSRC_DRIVERS          := glue_libc.cc
78 NOOPT                   += $(patsubst %.o, %, $(OBJ_DRIVERS))
79
80 keyb_IMPL               := keyb keyb-pc 
81 io_IMPL                 := io io-amd64
82 mem_IMPL                := mem mem-amd64
83 processor_IMPL          := processor processor-amd64
84
85 #
86 # KERNEL subsystem
87 #
88 KERNEL                  := fiasco.image
89 VPATH                   += kern/$(CONFIG_XARCH) kern/ia32/64 kern/ia32 kern
90 PRIVATE_INCDIR          += kern/$(CONFIG_XARCH) kern/ia32/64 kern/ia32 kern
91
92 INTERFACES_KERNEL       := cpu_mask rcupdate pages kobject_mapdb \
93                            mem_region per_cpu_data startup boot_info cmdline \
94                            __main queue queue_item l4_buf_iter irq_pin \
95                            bitmap acpi io_apic mapping spin_lock \
96                            mapping_tree mappable dbg_page_info  \
97                            mapdb region pic dirq_pic_pin dirq_io_apic \
98                            kobject_dbg kobject ready_queue_wfq ready_queue_fp \
99                            obj_space ptab_base io_space_sigma0 irq_msi \
100                            io_space ram_quota ref_ptr ref_obj \
101                            mem_space mem_space_sigma0 space vlog \
102                            kmem kmem_alloc slab_cache_anon mem_layout        \
103                            kmem_slab_simple kmem_slab switch_lock kip_init   \
104                            thread_lock helping_lock cpu_lock timer timeout   \
105                            ipc_timeout timeslice_timeout    \
106                            per_cpu_data_alloc vcpu kobject_helper icu_helper \
107                            thread_state context mp_lock sender receiver      \
108                            mem_unit factory lock ipc_sender \
109                            thread syscalls kernel_thread map_util irq banner \
110                            warn app_cpu_thread                               \
111                            dirq globals apic watchdog kernel_uart pit        \
112                            checksum main config mapped_alloc      \
113                            vmem_alloc paging fpu fpu_state fpu_alloc cpu     \
114                            entry_frame kernel_console boot_console profile   \
115                            ipc_gate task kernel_task irq_controller          \
116                            irq_chip terminate continuation \
117                            sched_context utcb_init \
118                            perf_cnt x86desc gdt idt tss trap_state \
119                            buddy_alloc vkey kdb_ke prio_list ipi timer_irq \
120                            scheduler clock vm_factory \
121
122 INTERFACES_KERNEL-$(CONFIG_CPU_VIRT) += svm vmx vm vm_svm vm_vmx
123
124 PREPROCESS_PARTS        += ulock
125 INTERFACES_KERNEL       += u_semaphore
126
127
128 apic_IMPL               := apic-ia32 apic-ia32-mp
129 boot_console_IMPL       := boot_console-ia32-amd64
130 boot_info_IMPL          := boot_info boot_info-ia32
131 clock_IMPL              := clock clock-ia32
132 config_IMPL             := config config-ia32-64 config-ia32
133 context_IMPL            := context context-ia32 context-ia32-64 context-vcpu
134 continuation_IMPL       := continuation-ia32-64
135 cpu_IMPL                := cpu cpu-ia32 cpu-64
136 dirq_IMPL               := dirq dirq-ia32-ux
137 dirq_pic_pin_IMPL       := dirq_pic_pin dirq_pic_pin-ia32-ux
138 entry_frame_IMPL        := entry_frame entry_frame-amd64 \
139                            entry_frame-abs-timeout-hack
140 fpu_IMPL                := fpu fpu-ia32-ux fpu-ia32
141 ipi_IMPL                := ipi ipi-ia32
142 kdb_ke_IMPL             := kdb_ke kdb_ke-ia32
143 kernel_thread_IMPL      := kernel_thread kernel_thread-std kernel_thread-ia32
144 kernel_uart_IMPL        := kernel_uart kernel_uart-16550
145 kip_init_IMPL           := kip_init-ia32
146 kmem_IMPL               := kmem-ia32 kmem-ia32-64
147 kmem_alloc_IMPL         := kmem_alloc kmem_alloc-ia32
148 main_IMPL               := main-ia32-64 main-ia32
149 mapping_IMPL            := mapping-ia32-64 mapping
150 map_util_IMPL           := map_util map_util-mem map_util-io map_util-objs
151 mem_layout_IMPL         := mem_layout mem_layout-ia32 mem_layout-ia32-64
152 mem_space_IMPL          := mem_space mem_space-user mem_space-ia32
153 mem_unit_IMPL           := mem_unit-amd64
154 obj_space_IMPL          := obj_space obj_space-$(OBJ_SPACE)
155 paging_IMPL             := paging-ia32-64 paging-ia32 paging
156 perf_cnt_IMPL           := perf_cnt perf_cnt-ia32
157 pic_IMPL                := pic pic-i8259
158 pit_IMPL                := pit-i8254
159 pmem_alloc_IMPL         := pmem_alloc pmem_alloc-ia32-ux
160 rtc_IMPL                := rtc-ia32
161 sched_context_IMPL      := sched_context-wfq sched_context-fixed_prio \
162                            sched_context-fp_wfq sched_context
163 space_IMPL              := space space-ia32
164 spin_lock_IMPL          := spin_lock spin_lock-ia32
165 startup_IMPL            := startup startup-ia32
166 task_IMPL               := task task-ia32-amd64
167 tb_entry_IMPL           := tb_entry tb_entry-ia32-64
168 timer_IMPL              := timer timer-ia32-amd64-ux
169 thread_IMPL             := thread thread-ia32 thread-ia32-64 \
170                            thread-ipc \
171                            thread-list \
172                            thread-pagefault thread-log      \
173                            thread-debug thread-dbf thread-ulock thread-vcpu
174 trap_state_IMPL         := trap_state-amd64
175 tss_IMPL                := tss-amd64
176 utcb_init_IMPL          := utcb_init utcb_init-ia32
177 vmem_alloc_IMPL         := vmem_alloc vmem_alloc-ia32
178 vm_factory_IMPL         := vm_factory vm_factory-ia32
179 watchdog_IMPL           := watchdog watchdog-ia32
180
181 INTERFACES_KERNEL-$(CONFIG_SERIAL) += uart_console
182
183 ifeq ("$(CONFIG_PROFILE)","y")
184   cpu_lock_IMPL         := cpu_lock cpu_lock-pic
185 else
186   cpu_lock_IMPL         := cpu_lock cpu_lock-generic
187 endif
188
189 ifeq ("$(CONFIG_SCHED_PIT)","y")
190   timer_IMPL            += timer-pit
191 endif
192 ifeq ("$(CONFIG_SCHED_RTC)","y")
193   timer_IMPL            += timer-rtc
194   INTERFACES_KERNEL     += rtc
195 endif
196 ifeq ("$(CONFIG_SCHED_APIC)","y")
197   timer_IMPL            += timer-apic
198 endif
199 ifeq ("$(CONFIG_SCHED_HPET)","y")
200   timer_IMPL            += timer-hpet
201   INTERFACES_KERNEL     += hpet
202 endif
203
204
205 ifeq ("$(CONFIG_IO_PROT)","y")
206   space_IMPL            += space-io
207   thread_IMPL           += thread-io
208 endif
209
210 ifeq ("$(CONFIG_JDB)","y")
211 VPATH                   += jdb/ia32/64 jdb/ia32 jdb
212 INTERFACES_KERNEL       += jdb jdb_util jdb_prompt_ext jdb_symbol jdb_lines \
213                            jdb_dbinfo jdb_bp \
214                            jdb_tbuf jdb_module jdb_core jdb_io_ports \
215                            jdb_kern_info jdb_prompt_module jdb_tbuf_output \
216                            jdb_input jdb_dump jdb_ptab jdb_misc jdb_mapdb \
217                            jdb_tcb jdb_attach_irq jdb_tbuf_init jdb_trace \
218                            jdb_trace_set jdb_counters jdb_table kern_cnt  \
219                            tb_entry tb_entry_output jdb_exit_module \
220                            jdb_tbuf_show jdb_console_buffer virq \
221                            jdb_list jdb_screen push_console jdb_timeout \
222                            jdb_handler_queue jdb_halt_thread \
223                            jdb_kern_info_kmem_alloc jdb_kern_info_region \
224                            jdb_kern_info_kip jdb_kern_info_config \
225                            loadcnt jdb_utcb jdb_thread_list \
226                            jdb_entry_frame jdb_kobject jdb_space jdb_io_apic \
227                            jdb_trap_state jdb_ipi jdb_kobject_names \
228                            jdb_rcupdate jdb_bt jdb_ipc_gate jdb_obj_space \
229                            jdb_log jdb_factory jdb_semaphore jdb_iomap \
230                            jdb_thread jdb_scheduler jdb_sender_list \
231                            jdb_regex jdb_disasm
232
233 apic_IMPL               += apic-debug
234 jdb_IMPL                := jdb jdb-ia32-amd64 jdb-ansi jdb-ia32-ux jdb-thread \
235                            jdb-int3-ia32-amd64 jdb-int3-ia32-ux
236 jdb_bp_IMPL             := jdb_bp-ia32-ux jdb_bp-ia32-amd64 jdb_bp-amd64
237 jdb_bt_IMPL             := jdb_bt-ia32-ux
238 jdb_entry_frame_IMPL    := jdb_entry_frame-ia32
239 jdb_kern_info_IMPL      := jdb_kern_info jdb_kern_info-ia32-amd64 \
240                            jdb_kern_info-ia32-ux jdb_kern_info-apic \
241                            jdb_kern_info-pci jdb_kern_info-bench \
242                            jdb_kern_info-bench-ia32-64 \
243                            jdb_kern_info-dr jdb_kern_info-mtrr
244 jdb_misc_IMPL           := jdb_misc-ia32-amd64
245 jdb_ptab_IMPL           := jdb_ptab jdb_ptab-amd64
246 jdb_screen_IMPL         := jdb_screen jdb_screen-ia32
247 jdb_tcb_IMPL            := jdb_tcb jdb_tcb-amd64
248 jdb_trace_set_IMPL      := jdb_trace_set jdb_trace_set-ia32-ux
249
250 INTERFACES_KERNEL-$(CONFIG_JDB_MISC)    += jdb_tetris
251 endif
252
253
254 CXXSRC_KERNEL           := kernel_panic.cc libc_backend_lock.cc
255 ASSRC_KERNEL            := entry.S entry-native.S shortcut.S
256
257 ASSRC_KERNEL-$(CONFIG_KIP_SYSCALLS_ABS) += sys_call_page-asm.S
258 ASSRC_KERNEL-$(CONFIG_MP)               += tramp-mp.S entry-mp.S
259 ASSRC_KERNEL-$(CONFIG_CPU_VIRT)         += vm_svm_asm.S vm_vmx_asm.S
260 ASSRC_KERNEL                            += $(ASSRC_KERNEL-y)
261
262 NOOPT                   += $(filter jdb%,\
263                              $(foreach in,$(INTERFACES_KERNEL), \
264                                $(if $($(in)_IMPL),$($(in)_IMPL),$(in))))
265 NOOPT                   += tb_entry_output $(tb_entry_IMPL) $(perf_cnt_IMPL)  \
266                            kern_cnt loadcnt $(apic_IMPL) $(watchdog_IMPL) kdb \
267                            $(kernel_uart_IMPL) push_console virq thread-dbf   \
268                            trap_state
269
270 ### When testing with test threads, uncomment the following:
271 #
272 # VPATH                 += kern-test
273 # PRIVATE_INCDIR        += kern-test
274 #
275 # INTERFACES_KERNEL     += generic_test_thread test_thread node cpu \
276 #                          back_trace cpu_guard types
277 #
278 # node_IMPL             := node node-up
279 # cpu_IMPL              := cpu cpu-perf cpu-perfp4
280 # config_IMPL           := config config-test
281 #
282 # kernel_thread_IMPL    := $(filter-out kernel_thread-std,$(kernel_thread_IMPL)) \
283 #                          kernel_thread-test
284 #
285 # Replace this definition with your own test thread.
286 # test_thread_IMPL      := test_thread-test26
287 #
288 ### End of test-thread section
289
290 #
291 # CRT0 subsystem
292 #
293 CRT0                    := crt0.o
294 ASSRC_CRT0              := crt0.S
295
296 #
297 # BOOT subsystem
298 #
299 BOOT                    := main
300 VPATH                   += boot/$(CONFIG_XARCH) boot
301 PRIVATE_INCDIR          += boot boot/amd64
302 CXXSRC_BOOT             := boot_libc_glue.cc bootstrap.cc boot_cpu.cc \
303                            direct_cons_putchar.cc
304 ASSRC_BOOT              := boot.S boot_idt.S
305 NOOPT                   += $(patsubst %.o, %, $(OBJ_BOOT))
306
307 #
308 # TCBOFFSET subsystem
309 #
310 TCBOFFSET               := tcboffset.h
311 CXXSRC_TCBOFFSET        := tcboffset.cc dump_tcboffsets.cc
312
313 #
314 # SYMBOLS subsystem
315 #
316 SYMBOLS                 := Symbols
317
318 #
319 # LINES subsystem
320 #
321 LINES                   := Lines
322 PROG_LINES              := genlines
323
324 #
325 # CHECKSUM subsystem
326 #
327 CHECKSUM                := checksum
328 CXXSRC_CHECKSUM         := genchecksum.cc
329
330 #
331 # VERSION subsystem
332 #
333 VERSION                 := version.h
334
335 #
336 # GBLCFG subsystem
337 #
338 GBLCFG                  := gblcfg.o
339 OBJ_KERNEL              += gblcfg.o
340
341 #
342 # CXXLIB Subsystem
343 #
344
345 CXXLIB                  := libcxx.a
346 VPATH                   += lib/cxxlib
347 INTERFACES_CXXLIB       := paranoia s_cruft
348
349 #
350 # LIBK subsystem
351 #
352 LIBK            := libk.a
353 VPATH           += lib/libk/$(CONFIG_XARCH) lib/libk
354 PRIVATE_INCDIR  += lib/libk/$(CONFIG_XARCH) lib/libk
355 INTERFACES_LIBK := atomic lock_guard auto_ptr std_macros dlist
356 ifeq ("$(CONFIG_PROFILE)","y")
357 INTERFACES_LIBK += gmon unistd
358 endif
359 atomic_IMPL     := atomic atomic-amd64
360
361 NOPROFILE       += profile gmon
362
363 #
364 # LIBKERN Subsystem
365 #
366 LIBKERN         := libkern.a
367 VPATH           += lib/kern
368 PRIVATE_INCDIR  += lib/kern/include
369 CSRC_LIBKERN    :=
370 NOOPT           += $(patsubst %.o, %, $(OBJ_LIBKERN))
371
372 #
373 # LIBAMM subsystem
374 #
375 LIBAMM          := libamm.a
376 VPATH           += lib/amm
377 PRIVATE_INCDIR  += lib/amm
378 CSRC_LIBAMM     := amm_alloc_entry.c amm_allocate.c amm_deallocate.c \
379                    amm_destroy.c amm_dump.c amm_find_addr.c amm_find_gen.c \
380                    amm_free_entry.c amm_init.c amm_init_gen.c amm_iterate.c \
381                    amm_iterate_gen.c amm_join.c amm_modify.c amm_protect.c \
382                    amm_reserve.c amm_select.c amm_split.c
383
384 #
385 # LIBGZIP subsystem (only for Jdb)
386 #
387 ifneq ($(CONFIG_JDB_GZIP),)
388   LIBGZIP               := libgzip.a
389   VPATH                 += lib/gzip
390   PRIVATE_INCDIR        += lib/gzip
391   CSRC_LIBGZIP          := adler32.c crc32.c gzip.c trees.c deflate.c zutil.c
392   NOOPT                 += $(patsubst %.o, %, $(OBJ_LIBGZIP))
393 endif
394
395 #
396 # LIBDISASM subsystem (only for Jdb)
397 #
398 ifeq ("$(CONFIG_JDB_DISASM)","y")
399   # $(srcdir)/lib/disasm may be removed
400   ifeq ($(wildcard $(srcdir)/lib/disasm),)
401     $(error $(srcdir)/lib/disasm is missing, disable CONFIG_JDB_DISASM)
402   endif
403
404   SUBSYSTEMS        += LIBDISASM
405   KERNEL_EXTRA_LIBS += $(LIBDISASM)
406   PREPROCESS_PARTS  += jdb_disasm
407
408   LIBDISASM         := libdisasm.a
409   VPATH             += lib/disasm lib/disasm/elf lib/disasm/include \
410                        lib/disasm/include/opcode lib/disasm/opcodes \
411                        lib/disasm/libiberty lib/disasm/bfd
412   PRIVATE_INCDIR    += lib/disasm lib/disasm/elf lib/disasm/include \
413                        lib/disasm/include/opcode lib/disasm/opcodes \
414                        lib/disasm/libiberty lib/disasm/bfd
415   PRIVATE_INCDIR    += lib/disasm
416   CSRC_LIBDISASM    := disasm.c dis-init.c i386-dis.c dis-buf.c
417   NOOPT             += $(patsubst %.o, %, $(OBJ_LIBDISASM))
418 endif
419
420 #
421 # LIBPERFCTR subsystem (only for Jdb)
422 #
423 LIBPERFCTR      := libperfctr.a
424 VPATH           += lib/perfctr
425 PRIVATE_INCDIR  += lib/perfctr
426 CSRC_LIBPERFCTR := event_set_p5.c event_set_p6.c event_set_amd.c \
427                    event_set_p4.c event_set_x86.c perfctr.c \
428                    event_set_centaur.c
429 NOOPT           += $(patsubst %.o, %, $(OBJ_LIBPERFCTR))
430
431 #
432 # LIBREGEX subsystem (only for Jdb)
433 #
434 LIBREGEX        := libregex.a
435 VPATH           += lib/regex
436 PRIVATE_INCDIR  += lib/regex
437 CSRC_LIBREGEX   := alloc.c rx.c
438 NOOPT           += $(patsubst %.o, %, $(OBJ_LIBREGEX))
439
440 #
441 # MINILIBC Subsystem
442 #
443 MINILIBC        := libc.a
444 VPATH           += lib/minilibc/$(CONFIG_XARCH) lib/minilibc
445 PRIVATE_INCDIR  += lib/minilibc/$(CONFIG_XARCH)/include lib/minilibc/include
446 CSRC_MINILIBC   := atexit.c memccpy.c memcmp.c memmove.c memset.c memcpy.c \
447                    memchr.c strchr.c strcmp.c strcpy.c strlen.c strncmp.c \
448                    strncpy.c strstr.c __assert_fail.c printf.c __v_printf.c \
449                    vprintf.c strtol.c strtoul.c lltostr.c __ltostr.c \
450                    putchar.c puts.c getchar.c gets.c construction.c sprintf.c \
451                    snprintf.c vsnprintf.c vsprintf.c longjmp.c isalnum.c \
452                    isalpha.c isascii.c isblank.c iscntrl.c isdigit.c \
453                    isgraph.c islower.c isprint.c ispunct.c isspace.c \
454                    isupper.c isxdigit.c tolower.c strcspn.c strspn.c panic.c
455 ASSRC_MINILIBC  := setjmp.S
456
457 # do not profile all of MINILIBC, because it is used in the BOOT subsystem
458 NOOPT           += $(patsubst %.o, %, $(OBJ_MINILIBC))
459
460 ifeq ("$(CONFIG_JDB)","y")
461
462 ifneq ($(CONFIG_JDB_GZIP),)
463  ifneq ($(wildcard $(srcdir)/lib/gzip),)
464   SUBSYSTEMS            += LIBGZIP
465   KERNEL_EXTRA_LIBS     += $(LIBGZIP)
466   INTERFACES_KERNEL     += jdb_gzip
467  endif
468 endif
469
470 ifneq ($(wildcard $(srcdir)/lib/perfctr),)
471   SUBSYSTEMS            += LIBPERFCTR
472   KERNEL_EXTRA_LIBS     += $(LIBPERFCTR)
473   KERNEL_UNRES_SYMS     += -u perfctr_set_cputype
474 endif
475
476 ifneq ($(wildcard $(srcdir)/lib/regex),)
477   SUBSYSTEMS            += LIBREGEX
478   KERNEL_EXTRA_LIBS     += $(LIBREGEX)
479   PREPROCESS_PARTS      += jdb_regex
480 endif
481
482 endif
483
484 MODULES_FILES = $(MODULES_FILE) $(MODULES_FILE_BSP)
485
486 INTERFACES_KERNEL       += $(INTERFACES_KERNEL-y)