-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
382 lines (355 loc) · 10.8 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
project(darlingserver-duct-tape)
include_directories(
defines
xnu/osfmk
xnu/bsd
xnu/libkern
xnu/osfmk/libsa
xnu/pexpert
xnu/iokit
xnu/EXTERNAL_HEADERS
xnu
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk
${CMAKE_CURRENT_BINARY_DIR}/../include
${CMAKE_BINARY_DIR}/src/startup
)
add_compile_definitions(
__DARLING__
DARLING_DEBUG
PAGE_SIZE_FIXED
CONFIG_SCHED_TRADITIONAL
CONFIG_SCHED_TIMESHARE_CORE
APPLE
KERNEL
KERNEL_PRIVATE
XNU_KERNEL_PRIVATE
PRIVATE
__MACHO__=1
volatile=__volatile
NEXT
__LITTLE_ENDIAN__=1
__private_extern__=extern
_NLINK_T
VM32_SUPPORT=1
MACH_KERNEL_PRIVATE
ARCH_PRIVATE
DRIVER_PRIVATE
_KERNEL_BUILD
KERNEL_BUILD
MACH_KERNEL
BSD_BUILD
BSD_KERNEL_PRIVATE
LP64KERN=1
LP64_DEBUG=0
TIMEZONE=0
PST=0
QUOTA
ABSOLUTETIME_SCALAR_TYPE
CONFIG_LCTX
MACH
CONFIG_ZLEAKS
NO_DIRECT_RPC
IPFIREWALL_FORWARD
IPFIREWALL_DEFAULT_TO_ACCEPT
TRAFFIC_MGT
RANDOM_IP_ID
TCP_DROP_SYNFIN
ICMP_BANDLIM
IFNET_INPUT_SANITY_CHK
PSYNCH
SECURE_KERNEL
OLD_SEMWAIT_SIGNAL
CONFIG_MBUF_JUMBO
CONFIG_WORKQUEUE
CONFIG_HFS_STD
CONFIG_HFS_TRIM
CONFIG_TASK_MAX=512
CONFIG_IPC_TABLE_ENTRIES_STEPS=256
NAMEDSTREAMS
CONFIG_VOLFS
CONFIG_IMGSRC_ACCESS
CONFIG_TRIGGERS
CONFIG_VFS_FUNNEL
CONFIG_EXT_RESOLVER
CONFIG_SEARCHFS
IPSEC
IPSEC_ESP
IPV6FIREWALL_DEFAULT_TO_ACCEPT
crypto
randomipid
CONFIG_KN_HASHSIZE=64
CONFIG_VNODES=750
CONFIG_VNODE_FREE_MIN=75
CONFIG_NC_HASH=1024
CONFIG_VFS_NAMES=2048
CONFIG_MAX_CLUSTERS=4
KAUTH_CRED_PRIMES_COUNT=3
#"KAUTH_CRED_PRIMES={5, 17, 97}"
CONFIG_MIN_NBUF=64
CONFIG_MIN_NIOBUF=32
#"CONFIG_NMBCLUSTERS=((1024 * 256) / MCLBYTES)"
CONFIG_TCBHASHSIZE=128
CONFIG_ICMP_BANDLIM=50
CONFIG_AIO_MAX=10
CONFIG_AIO_PROCESS_MAX=4
CONFIG_AIO_THREAD_COUNT=2
CONFIG_THREAD_MAX=1024
CONFIG_MAXVIFS=2
CONFIG_MFCTBLSIZ=16
CONFIG_MSG_BSIZE=4096
CONFIG_ENFORCE_SIGNED_CODE
CONFIG_MEMORYSTATUS
CONFIG_JETSAM
CONFIG_FREEZE
CONFIG_ZLEAK_ALLOCATION_MAP_NUM=8192
CONFIG_ZLEAK_TRACE_MAP_NUM=4096
VM_PRESSURE_EVENTS
CONFIG_KERNEL_0DAY_SYSCALL_HANDLER
EVENTMETER
CONFIG_APP_PROFILE=0
CC_USING_FENTRY=1
IMPORTANCE_INHERITANCE=1
#MACH_BSD=1
CONFIG_REQUIRES_U32_MUNGING=1
KERNEL_SERVER=1
KERNEL_USER=1
MACH_NOTIFY_SEND_POSSIBLE_EXPECTED
XNU_TARGET_OS_OSX=1
_CLOCK_T=1
NO_KDEBUG=1
CONFIG_IPC_KERNEL_MAP_SIZE=64
__DARWIN_LITTLE_ENDIAN=1234
__DARWIN_BYTE_ORDER=__DARWIN_LITTLE_ENDIAN
)
add_compile_options(
-fblocks
-ffunction-sections
-fdata-sections
-Wno-incompatible-library-redeclaration
-Wno-error=int-conversion
)
if (DSERVER_ASAN OR DSERVER_UBSAN)
add_compile_options(
-fsanitize=${dserver_sanitizers}
-fsanitize-recover=all
-fno-omit-frame-pointer
-g
-Og
)
add_link_options(
-fsanitize=${dserver_sanitizers}
-fsanitize-recover=all
)
endif()
if (DSERVER_EXTENDED_DEBUG)
add_compile_options(
-fno-omit-frame-pointer
)
endif()
set(MIG_USER_SOURCE_SUFFIX "User.c")
set(MIG_SERVER_SOURCE_SUFFIX "Server.c")
set(MIG_SERVER_HEADER_SUFFIX "Server.h")
set(MIG_NO_XTRACE 1)
mig(xnu/osfmk/UserNotification/UNDReply.defs)
set(MIG_USER_SOURCE_SUFFIX "_user.c")
set(MIG_SERVER_SOURCE_SUFFIX "_server.c")
set(MIG_SERVER_HEADER_SUFFIX "_server.h")
mig(xnu/osfmk/device/device.defs)
mig(xnu/osfmk/default_pager/default_pager_alerts.defs)
mig(xnu/osfmk/default_pager/default_pager_object.defs)
mig(xnu/osfmk/kextd/kextd_mach.defs)
mig(xnu/osfmk/mach/audit_triggers.defs)
mig(xnu/osfmk/mach/clock.defs)
mig(xnu/osfmk/mach/clock_priv.defs)
mig(xnu/osfmk/mach/clock_reply.defs)
mig(xnu/osfmk/mach/exc.defs)
mig(xnu/osfmk/mach/host_notify_reply.defs)
mig(xnu/osfmk/mach/host_priv.defs)
mig(xnu/osfmk/mach/host_security.defs)
mig(xnu/osfmk/mach/lock_set.defs)
mig(xnu/osfmk/mach/mach_exc.defs)
mig(xnu/osfmk/mach/mach_host.defs)
mig(xnu/osfmk/mach/mach_notify.defs)
mig(xnu/osfmk/mach/mach_port.defs)
mig(xnu/osfmk/mach/mach_vm.defs)
mig(xnu/osfmk/mach/mach_voucher.defs)
mig(xnu/osfmk/mach/mach_voucher_attr_control.defs)
mig(xnu/osfmk/mach/memory_entry.defs)
mig(xnu/osfmk/mach/memory_object_control.defs)
mig(xnu/osfmk/mach/memory_object_default.defs)
mig(xnu/osfmk/mach/memory_object.defs)
mig(xnu/osfmk/mach/processor.defs)
mig(xnu/osfmk/mach/processor_set.defs)
mig(xnu/osfmk/mach/resource_notify.defs)
mig(xnu/osfmk/mach/restartable.defs)
mig(xnu/osfmk/mach/task_access.defs)
mig(xnu/osfmk/mach/task.defs)
mig(xnu/osfmk/mach/thread_act.defs)
mig(xnu/osfmk/mach/upl.defs)
mig(xnu/osfmk/mach/vm_map.defs)
mig(xnu/osfmk/mach/vm32_map.defs)
mig(xnu/osfmk/mach/exc.defs)
mig(xnu/osfmk/mach/mach_exc.defs)
mig(xnu/osfmk/mach/notify.defs)
mig(xnu/osfmk/mach/vm_map.defs)
mig(xnu/osfmk/mach/memory_object_default.defs)
mig(xnu/osfmk/mach/memory_object_control.defs)
mig(xnu/osfmk/mach/memory_object.defs)
mig(xnu/osfmk/mach/upl.defs)
mig(xnu/osfmk/mach/mach_notify.defs)
mig(xnu/osfmk/mach/vm32_map.defs)
mig(xnu/osfmk/mach/host_notify_reply.defs)
mig(xnu/osfmk/mach/mach_voucher_attr_control.defs)
mig(xnu/osfmk/mach/mach_voucher.defs)
mig(xnu/osfmk/mach/mach_eventlink.defs)
add_custom_target(kernel_mig_generate
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/upl.h
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/host_notify_reply.h
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/vm32_map_server.h
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/vm32_map_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/mach_notify.h
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/mach_voucher_attr_control.h
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/memory_entry_server.h
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/memory_object_control.h
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/memory_object_server.h
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/memory_object_default_server.h
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/mach_voucher_server.h
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/vm_map.h
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/resource_notify.h
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/restartable_server.h
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/exc_server.h
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/mach_exc_server.h
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/notify_server.h
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/task_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/clock_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/clock_priv_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/processor_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/host_priv_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/host_security_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/lock_set_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/mach_port_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/mach_vm_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/mach_host_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/processor_set_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/thread_act_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/clock_reply_user.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/mach_eventlink_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/mach_eventlink_server.h
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/device/device_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/UserNotification/UNDReplyServer.c
)
add_library(darlingserver_duct_tape STATIC
src/init.c
src/misc.c
src/stubs.c
src/locks.c
src/memory.c
src/task.c
src/thread.c
src/timer.c
src/traps.c
src/host.c
src/processor.c
src/kqchan.c
src/semaphore.c
src/psynch.c
src/condvar.c
src/debug.c
xnu/libkern/os/refcnt.c
xnu/libkern/gen/OSAtomicOperations.c
xnu/libkern/c++/priority_queue.cpp
xnu/osfmk/kern/ipc_clock.c
xnu/osfmk/kern/ipc_host.c
xnu/osfmk/kern/ipc_kobject.c
xnu/osfmk/kern/ipc_mig.c
xnu/osfmk/kern/ipc_misc.c
xnu/osfmk/kern/ipc_sync.c
xnu/osfmk/kern/ipc_tt.c
xnu/osfmk/kern/turnstile.c
xnu/osfmk/kern/waitq.c
xnu/osfmk/kern/clock.c
xnu/osfmk/kern/ltable.c
xnu/osfmk/kern/mpsc_queue.c
xnu/osfmk/kern/thread_call.c
xnu/osfmk/kern/mk_timer.c
xnu/osfmk/kern/host.c
xnu/osfmk/kern/host_notify.c
xnu/osfmk/kern/timer_call.c
xnu/osfmk/kern/clock_oldops.c
xnu/osfmk/kern/sync_sema.c
xnu/osfmk/kern/sync_lock.c
xnu/osfmk/kern/syscall_emulation.c
xnu/osfmk/kern/ux_handler.c
xnu/osfmk/kern/exception.c
xnu/osfmk/kern/task_ident.c
xnu/osfmk/ipc/ipc_entry.c
xnu/osfmk/ipc/ipc_hash.c
xnu/osfmk/ipc/ipc_importance.c
xnu/osfmk/ipc/ipc_init.c
xnu/osfmk/ipc/ipc_kmsg.c
xnu/osfmk/ipc/ipc_mqueue.c
xnu/osfmk/ipc/ipc_notify.c
xnu/osfmk/ipc/ipc_object.c
xnu/osfmk/ipc/ipc_port.c
xnu/osfmk/ipc/ipc_pset.c
xnu/osfmk/ipc/ipc_right.c
xnu/osfmk/ipc/ipc_space.c
xnu/osfmk/ipc/ipc_table.c
xnu/osfmk/ipc/ipc_voucher.c
xnu/osfmk/ipc/mach_debug.c
xnu/osfmk/ipc/mach_kernelrpc.c
xnu/osfmk/ipc/mach_msg.c
xnu/osfmk/ipc/mach_port.c
xnu/osfmk/ipc/mig_log.c
xnu/osfmk/ipc/ipc_eventlink.c
xnu/osfmk/i386/rtclock.c
xnu/osfmk/prng/prng_random.c
xnu/osfmk/vm/vm32_user.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/clock_priv_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/clock_reply_user.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/clock_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/exc_user.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/exc_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/host_priv_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/host_security_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/lock_set_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/mach_exc_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/mach_exc_user.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/mach_host_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/mach_port_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/mach_vm_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/mach_voucher_attr_control_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/mach_voucher_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/memory_entry_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/notify_user.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/processor_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/processor_set_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/restartable_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/task_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/thread_act_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/mach_eventlink_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/mach/vm32_map_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/device/device_server.c
${CMAKE_CURRENT_BINARY_DIR}/xnu/osfmk/UserNotification/UNDReplyServer.c
pthread/kern_synch.c
)
set_source_files_properties(pthread/kern_synch.c PROPERTIES
COMPILE_FLAGS "-I${CMAKE_CURRENT_SOURCE_DIR}/pthread"
)
target_include_directories(darlingserver_duct_tape PRIVATE
internal-include
${CMAKE_CURRENT_BINARY_DIR}/../internal-include
../include
)
target_include_directories(darlingserver_duct_tape PUBLIC
include
)
add_dependencies(darlingserver_duct_tape
kernel_mig_generate
generate_dserver_rpc_wrappers
rtsig_h
)
target_link_libraries(darlingserver_duct_tape PUBLIC
libsimple_darlingserver
)