vfs: check userland buffers before reading them.
[haiku.git] / src / system / kernel / Jamfile
blob79643208831457115b1a212a4aa56d37c10b7df9
1 SubDir HAIKU_TOP src system kernel ;
4         local defines =
5                 HAIKU_ARCH=\\\"$(TARGET_ARCH)\\\"
6                 ;
8         defines = [ FDefines $(defines) ] ;
9         SubDirCcFlags $(defines) ;
10         SubDirC++Flags $(defines) ;
13 SEARCH_SOURCE += [ FDirName $(SUBDIR) locks ] ;
14 SEARCH_SOURCE += [ FDirName $(SUBDIR) scheduler ] ;
16 UsePrivateHeaders libroot ;
17 UsePrivateHeaders shared ;
18 UsePrivateHeaders runtime_loader ;
20 AddResources kernel_$(TARGET_ARCH) : kernel.rdef ;
22 SetVersionScript kernel_$(TARGET_ARCH) : kernel_versions ;
23 SetVersionScript kernel.so : kernel_versions ;
25 KernelMergeObject kernel_core.o :
26         boot_item.cpp
27         boot_splash.cpp
28         commpage.cpp
29         condition_variable.cpp
30         convertutf.cpp
31         cpu.cpp
32         DPC.cpp
33         elf.cpp
34         guarded_heap.cpp
35         heap.cpp
36         image.cpp
37         int.cpp
38         kernel_daemon.cpp
39         linkhack.c
40         listeners.cpp
41         low_resource_manager.cpp
42         main.cpp
43         module.cpp
44         Notifications.cpp
45         port.cpp
46         real_time_clock.cpp
47         sem.cpp
48         shutdown.cpp
49         signal.cpp
50         system_info.cpp
51         smp.cpp
52         syscalls.cpp
53         team.cpp
54         thread.cpp
55         timer.cpp
56         UserEvent.cpp
57         usergroup.cpp
58         UserTimer.cpp
59         wait_for_objects.cpp
61         # locks
62         lock.cpp
63         user_mutex.cpp
65         # scheduler
66         low_latency.cpp
67         power_saving.cpp
68         scheduler.cpp
69         scheduler_cpu.cpp
70         scheduler_profiler.cpp
71         scheduler_thread.cpp
72         scheduler_tracing.cpp
73         scheduling_analysis.cpp
75         : $(TARGET_KERNEL_PIC_CCFLAGS)
78 # Generate the header defining macros for C++ structure sizes.
79 local kernelC++StructSizesHeader = [ FGristFiles kernel_c++_struct_sizes.h ] ;
80 TARGET_HDRS_$(TARGET_PACKAGING_ARCH) on $(kernelC++StructSizesHeader)
81         = [ on $(kernelC++StructSizesHeader)
82                         return $(TARGET_HDRS_$(TARGET_PACKAGING_ARCH)) ]
83                 $(TARGET_PRIVATE_KERNEL_HEADERS) ;
84 CreateAsmStructOffsetsHeader $(kernelC++StructSizesHeader)
85         : kernel_c++_structs.cpp ;
87 # We need to specify the dependency on the generated syscalls files explicitly.
88 Includes [ FGristFiles syscalls.cpp ]
89         :
90         <syscalls!$(TARGET_PACKAGING_ARCH)>syscall_dispatcher.h
91         <syscalls!$(TARGET_PACKAGING_ARCH)>syscall_table.h
92         <syscalls!$(TARGET_PACKAGING_ARCH)>syscall_numbers.h
95 KernelLd linkhack.so :
96         <$(SOURCE_GRIST)>linkhack.o
97         :
98         :
99         -shared -Bdynamic
102 KernelLd kernel_$(TARGET_ARCH) :
103         kernel_cache.o
104         kernel_core.o
105         kernel_debug.o
106         kernel_device_manager.o
107         kernel_disk_device_manager.o
108         kernel_fs.o
109         kernel_messaging.o
110         kernel_posix.o
111         kernel_slab.o
112         kernel_util.o
113         kernel_vm.o
115         kernel_arch_$(TARGET_KERNEL_ARCH).o
116         kernel_platform_$(TARGET_BOOT_PLATFORM).o
118         linkhack.so
120         # kernel parts borrowed from libroot and others
121         kernel_os_main.o
122         kernel_os_arch_$(TARGET_ARCH).o
123         kernel_lib_posix.o
124         kernel_lib_posix_arch_$(TARGET_ARCH).o
125         kernel_misc.o
127         : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/kernel.ld
128         : -Bdynamic -export-dynamic -dynamic-linker /foo/bar
129           $(TARGET_KERNEL_PIC_LINKFLAGS)
130         :
133 if $(HAIKU_ARCH) in x86_64 arm {
134         # Cannot relink everything as a shared object on x86_64 as shared library
135         # code is required to be position-independent. Instead create a copy of the
136         # executable kernel image and change the ELF header type to DYN. A bit of
137         # a hack, but avoids having to recompile a PIC copy of the kernel code.
138         # kernel.so is only used when linking modules to provide symbol information,
139         # this is sufficient for that purpose.
140         KernelSo kernel.so : kernel_$(TARGET_ARCH) ;
141 } else {
142         KernelLd kernel.so :
143                 kernel_cache.o
144                 kernel_core.o
145                 kernel_debug.o
146                 kernel_device_manager.o
147                 kernel_disk_device_manager.o
148                 kernel_fs.o
149                 kernel_messaging.o
150                 kernel_posix.o
151                 kernel_slab.o
152                 kernel_util.o
153                 kernel_vm.o
155                 kernel_arch_$(TARGET_KERNEL_ARCH).o
156                 kernel_platform_$(TARGET_BOOT_PLATFORM).o
158                 linkhack.so
160                 # kernel libroot parts
161                 kernel_os_main.o
162                 kernel_os_arch_$(TARGET_ARCH).o
163                 kernel_lib_posix.o
164                 kernel_lib_posix_arch_$(TARGET_ARCH).o
165                 kernel_misc.o
167                 : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/kernel.ld
168                 : -Bdynamic -shared -export-dynamic -dynamic-linker /foo/bar
169                   $(TARGET_KERNEL_PIC_LINKFLAGS)
170         ;
173 NotFile kernel ;
174 Depends kernel : kernel_$(TARGET_ARCH) ;
175 Depends kernel.so : kernel ;
176         # kernel.so will be rebuilt with the kernel
178 # propagate the container update variable from kernel to kernel_$(TARGET_ARCH)
179 PropagateContainerUpdateTargetFlags kernel_$(TARGET_ARCH) : kernel ;
181 # Copy kernel and update the copy's revision section. We link everything
182 # against the original, but the copy will end up on the disk image (this way
183 # we avoid unnecessary dependencies). The copy will be located in a subdirectory.
184 if $(TARGET_PLATFORM) = haiku {
185         MakeLocate <revisioned>kernel_$(TARGET_ARCH)
186                 : [ FDirName $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET) revisioned ] ;
187         CopySetHaikuRevision <revisioned>kernel_$(TARGET_ARCH)
188                 : kernel_$(TARGET_ARCH) ;
192 SubInclude HAIKU_TOP src system kernel arch ;
193 SubInclude HAIKU_TOP src system kernel cache ;
194 SubInclude HAIKU_TOP src system kernel device_manager ;
195 SubInclude HAIKU_TOP src system kernel debug ;
196 SubInclude HAIKU_TOP src system kernel disk_device_manager ;
197 SubInclude HAIKU_TOP src system kernel fs ;
198 SubInclude HAIKU_TOP src system kernel lib ;
199 SubInclude HAIKU_TOP src system kernel messaging ;
200 SubInclude HAIKU_TOP src system kernel posix ;
201 SubInclude HAIKU_TOP src system kernel slab ;
202 SubInclude HAIKU_TOP src system kernel util ;
203 SubInclude HAIKU_TOP src system kernel vm ;
205 if $(TARGET_BOOT_PLATFORM) {
206         SubInclude HAIKU_TOP src system kernel platform $(TARGET_BOOT_PLATFORM) ;