1*c54f35caSApple OSS Distributions#!/usr/bin/env recon 2*c54f35caSApple OSS Distributions 3*c54f35caSApple OSS Distributionslocal cjson = require 'cjson' 4*c54f35caSApple OSS Distributionslocal lpeg = require 'lpeg' 5*c54f35caSApple OSS Distributionslpeg.locale(lpeg) 6*c54f35caSApple OSS Distributions 7*c54f35caSApple OSS Distributions-- Only certain regions of the master file should be parsed. 8*c54f35caSApple OSS Distributions-- The convention is that any `#if/#else/#endif` clauses are parsed, assuming the condition is true/defined, except for `COMPAT_GETFSSTAT`. 9*c54f35caSApple OSS Distributions 10*c54f35caSApple OSS Distributionslocal region_state = { valid = true, } 11*c54f35caSApple OSS Distributionslocal function in_valid_region(line) 12*c54f35caSApple OSS Distributions -- Only C preprocessor directives can affect the region's validity. 13*c54f35caSApple OSS Distributions if line:sub(1, 1) ~= '#' then 14*c54f35caSApple OSS Distributions return region_state.valid 15*c54f35caSApple OSS Distributions end 16*c54f35caSApple OSS Distributions 17*c54f35caSApple OSS Distributions -- This is the only macro definition that is assumed to be undefined. 18*c54f35caSApple OSS Distributions local assume_defined = not line:match('COMPAT_GETFSSTAT') 19*c54f35caSApple OSS Distributions if line:match('^#if') then 20*c54f35caSApple OSS Distributions region_state.valid = assume_defined 21*c54f35caSApple OSS Distributions elseif line:match('^#else') then 22*c54f35caSApple OSS Distributions region_state.valid = not region_state.valid 23*c54f35caSApple OSS Distributions elseif line:match('^#endif') then 24*c54f35caSApple OSS Distributions region_state.valid = true 25*c54f35caSApple OSS Distributions end 26*c54f35caSApple OSS Distributionsend 27*c54f35caSApple OSS Distributions 28*c54f35caSApple OSS Distributions-- Parse a syscall declaration line from `bsd/kern/syscalls.master` into a table with `name`, `number`, `arguments`, and `old` keys. 29*c54f35caSApple OSS Distributions 30*c54f35caSApple OSS Distributions-- Primitive tokens. 31*c54f35caSApple OSS Distributionslocal space = lpeg.S(' \t')^0 32*c54f35caSApple OSS Distributionslocal identifier = (lpeg.alnum + lpeg.P('_'))^1 33*c54f35caSApple OSS Distributionslocal numeric = lpeg.digit^1 / tonumber 34*c54f35caSApple OSS Distributions 35*c54f35caSApple OSS Distributions-- Matching the function name of the syscall declaration. 36*c54f35caSApple OSS Distributionslocal function_ptn = lpeg.Cg(identifier^1, 'name') * lpeg.P('(') 37*c54f35caSApple OSS Distributionslocal nosys_ptn = lpeg.P('e')^-1 * lpeg.P('nosys(') 38*c54f35caSApple OSS Distributions 39*c54f35caSApple OSS Distributions-- Matching an argument list. 40*c54f35caSApple OSS Distributionslocal arg = lpeg.C((1 - lpeg.S(',)'))^1) 41*c54f35caSApple OSS Distributionslocal args_ptn = lpeg.Ct(arg * (lpeg.P(',') * space * arg)^0) 42*c54f35caSApple OSS Distributions 43*c54f35caSApple OSS Distributions-- Matching a normal C-style declaration of the syscall. 44*c54f35caSApple OSS Distributionslocal decl_ptn = (1 - function_ptn)^1 * (function_ptn - nosys_ptn) * 45*c54f35caSApple OSS Distributions lpeg.Cg(args_ptn, 'arguments') 46*c54f35caSApple OSS Distributions 47*c54f35caSApple OSS Distributions-- Matching an old breadcrumb, with empty arguments table. 48*c54f35caSApple OSS Distributionslocal old_ptn = lpeg.P('old') * space * lpeg.Cg(identifier^1, 'name') * 49*c54f35caSApple OSS Distributions lpeg.Cg(lpeg.Cc(true), 'old') * lpeg.Cg(lpeg.Cc({}), 'arguments') 50*c54f35caSApple OSS Distributionslocal old_decl_ptn = (1 - old_ptn)^1 * old_ptn 51*c54f35caSApple OSS Distributions 52*c54f35caSApple OSS Distributionslocal syscall_ptn = lpeg.Ct(lpeg.Cg(numeric, 'number') * 53*c54f35caSApple OSS Distributions (decl_ptn + old_decl_ptn)) 54*c54f35caSApple OSS Distributions 55*c54f35caSApple OSS Distributionslocal bsd_syscalls = {} 56*c54f35caSApple OSS Distributionsfor line in io.stdin:lines() do 57*c54f35caSApple OSS Distributions if in_valid_region(line) then 58*c54f35caSApple OSS Distributions bsd_syscalls[#bsd_syscalls + 1] = syscall_ptn:match(line) 59*c54f35caSApple OSS Distributions end 60*c54f35caSApple OSS Distributionsend 61*c54f35caSApple OSS Distributions 62*c54f35caSApple OSS Distributionslocal syscalls = { 63*c54f35caSApple OSS Distributions bsd_syscalls = bsd_syscalls, 64*c54f35caSApple OSS Distributions mach_syscalls = { 65*c54f35caSApple OSS Distributions -- Duplicate the names from `mach_trap_table` here. 66*c54f35caSApple OSS Distributions { number = 10, name = 'mach_vm_allocate', 67*c54f35caSApple OSS Distributions arguments = { 68*c54f35caSApple OSS Distributions 'mach_port_name_t target', 69*c54f35caSApple OSS Distributions 'mach_vm_address_t *address', 70*c54f35caSApple OSS Distributions 'mach_vm_size_t size', 71*c54f35caSApple OSS Distributions 'int flags', 72*c54f35caSApple OSS Distributions }, 73*c54f35caSApple OSS Distributions }, 74*c54f35caSApple OSS Distributions { number = 11, name = 'mach_vm_purgable_control', 75*c54f35caSApple OSS Distributions arguments = { 76*c54f35caSApple OSS Distributions 'mach_port_name_t target', 77*c54f35caSApple OSS Distributions 'mach_vm_offset_t address', 78*c54f35caSApple OSS Distributions 'vm_purgable_t control', 79*c54f35caSApple OSS Distributions 'int *state', 80*c54f35caSApple OSS Distributions }, 81*c54f35caSApple OSS Distributions }, 82*c54f35caSApple OSS Distributions { number = 12, name = 'mach_vm_deallocate', 83*c54f35caSApple OSS Distributions arguments = { 84*c54f35caSApple OSS Distributions 'mach_port_name_t target', 85*c54f35caSApple OSS Distributions 'mach_vm_address_t address', 86*c54f35caSApple OSS Distributions 'mach_vm_size_t size', 87*c54f35caSApple OSS Distributions }, 88*c54f35caSApple OSS Distributions }, 89*c54f35caSApple OSS Distributions { number = 13, name = 'task_dyld_process_info_notify_get', 90*c54f35caSApple OSS Distributions arguments = { 91*c54f35caSApple OSS Distributions 'mach_port_name_array_t names_addr', 92*c54f35caSApple OSS Distributions 'natural_t *names_count_addr', 93*c54f35caSApple OSS Distributions }, 94*c54f35caSApple OSS Distributions }, 95*c54f35caSApple OSS Distributions { number = 14, name = 'mach_vm_protect', 96*c54f35caSApple OSS Distributions arguments = { 97*c54f35caSApple OSS Distributions 'mach_port_name_t task', 98*c54f35caSApple OSS Distributions 'mach_vm_address_t address', 99*c54f35caSApple OSS Distributions 'mach_vm_size_t size', 100*c54f35caSApple OSS Distributions 'boolean_t set_maximum', 101*c54f35caSApple OSS Distributions 'vm_prot_t new_protection', 102*c54f35caSApple OSS Distributions } 103*c54f35caSApple OSS Distributions }, 104*c54f35caSApple OSS Distributions { number = 15, name = 'mach_vm_map', 105*c54f35caSApple OSS Distributions arguments = { 106*c54f35caSApple OSS Distributions 'mach_port_name_t target', 107*c54f35caSApple OSS Distributions 'mach_vm_address_t *address', 108*c54f35caSApple OSS Distributions 'mach_vm_size_t size', 109*c54f35caSApple OSS Distributions 'mach_vm_offset_t mask', 110*c54f35caSApple OSS Distributions 'int flags', 111*c54f35caSApple OSS Distributions 'mem_entry_name_port_t object', 112*c54f35caSApple OSS Distributions 'memory_object_offset_t offset', 113*c54f35caSApple OSS Distributions 'boolean_t copy', 114*c54f35caSApple OSS Distributions 'vm_prot_t cur_protection', 115*c54f35caSApple OSS Distributions 'vm_prot_t max_protection', 116*c54f35caSApple OSS Distributions 'vm_inherit_t inheritance', 117*c54f35caSApple OSS Distributions }, 118*c54f35caSApple OSS Distributions }, 119*c54f35caSApple OSS Distributions { number = 16, name = 'mach_port_allocate', 120*c54f35caSApple OSS Distributions arguments = { 121*c54f35caSApple OSS Distributions 'mach_port_name_t target', 122*c54f35caSApple OSS Distributions 'mach_port_right_t right', 123*c54f35caSApple OSS Distributions 'mach_port_name_t *name', 124*c54f35caSApple OSS Distributions }, 125*c54f35caSApple OSS Distributions }, 126*c54f35caSApple OSS Distributions 127*c54f35caSApple OSS Distributions { number = 18, name = 'mach_port_deallocate', 128*c54f35caSApple OSS Distributions arguments = { 129*c54f35caSApple OSS Distributions 'mach_port_name_t target', 130*c54f35caSApple OSS Distributions 'mach_port_name_t name', 131*c54f35caSApple OSS Distributions }, 132*c54f35caSApple OSS Distributions }, 133*c54f35caSApple OSS Distributions { number = 19, name = 'mach_port_mod_refs', 134*c54f35caSApple OSS Distributions arguments = { 135*c54f35caSApple OSS Distributions 'mach_port_name_t target', 136*c54f35caSApple OSS Distributions 'mach_port_name_t name', 137*c54f35caSApple OSS Distributions 'mach_port_right_t right', 138*c54f35caSApple OSS Distributions 'mach_port_delta_t delta', 139*c54f35caSApple OSS Distributions }, 140*c54f35caSApple OSS Distributions }, 141*c54f35caSApple OSS Distributions { number = 20, name = 'mach_port_move_member', 142*c54f35caSApple OSS Distributions arguments = { 143*c54f35caSApple OSS Distributions 'mach_port_name_t target', 144*c54f35caSApple OSS Distributions 'mach_port_name_t member', 145*c54f35caSApple OSS Distributions 'mach_port_name_t after', 146*c54f35caSApple OSS Distributions }, 147*c54f35caSApple OSS Distributions }, 148*c54f35caSApple OSS Distributions { number = 21, name = 'mach_port_insert_right', 149*c54f35caSApple OSS Distributions arguments = { 150*c54f35caSApple OSS Distributions 'mach_port_name_t target', 151*c54f35caSApple OSS Distributions 'mach_port_name_t name', 152*c54f35caSApple OSS Distributions 'mach_port_name_t poly', 153*c54f35caSApple OSS Distributions 'mach_msg_type_name_t polyPoly', 154*c54f35caSApple OSS Distributions }, 155*c54f35caSApple OSS Distributions }, 156*c54f35caSApple OSS Distributions { number = 22, name = 'mach_port_insert_member', 157*c54f35caSApple OSS Distributions arguments = { 158*c54f35caSApple OSS Distributions 'mach_port_name_t target', 159*c54f35caSApple OSS Distributions 'mach_port_name_t name', 160*c54f35caSApple OSS Distributions 'mach_port_name_t pset', 161*c54f35caSApple OSS Distributions }, 162*c54f35caSApple OSS Distributions }, 163*c54f35caSApple OSS Distributions { number = 23, name = 'mach_port_extract_member', 164*c54f35caSApple OSS Distributions arguments = { 165*c54f35caSApple OSS Distributions 'mach_port_name_t target', 166*c54f35caSApple OSS Distributions 'mach_port_name_t name', 167*c54f35caSApple OSS Distributions 'mach_port_name_t pset', 168*c54f35caSApple OSS Distributions }, 169*c54f35caSApple OSS Distributions }, 170*c54f35caSApple OSS Distributions { number = 24, name = 'mach_port_construct', 171*c54f35caSApple OSS Distributions arguments = { 172*c54f35caSApple OSS Distributions 'mach_port_name_t target', 173*c54f35caSApple OSS Distributions 'mach_port_options_t *options', 174*c54f35caSApple OSS Distributions 'uint64_t context', 175*c54f35caSApple OSS Distributions 'mach_port_name_t *name', 176*c54f35caSApple OSS Distributions }, 177*c54f35caSApple OSS Distributions }, 178*c54f35caSApple OSS Distributions { number = 25, name = 'mach_port_destruct', 179*c54f35caSApple OSS Distributions arguments = { 180*c54f35caSApple OSS Distributions 'mach_port_name_t target', 181*c54f35caSApple OSS Distributions 'mach_port_name_t name', 182*c54f35caSApple OSS Distributions 'mach_port_delta_t srdelta', 183*c54f35caSApple OSS Distributions 'uint64_t guard', 184*c54f35caSApple OSS Distributions }, 185*c54f35caSApple OSS Distributions }, 186*c54f35caSApple OSS Distributions { number = 26, name = 'mach_reply_port', 187*c54f35caSApple OSS Distributions arguments = { 'void' }, 188*c54f35caSApple OSS Distributions }, 189*c54f35caSApple OSS Distributions { number = 27, name = 'thread_self', 190*c54f35caSApple OSS Distributions arguments = { 'void' }, 191*c54f35caSApple OSS Distributions }, 192*c54f35caSApple OSS Distributions { number = 28, name = 'task_self', 193*c54f35caSApple OSS Distributions arguments = { 'void' }, 194*c54f35caSApple OSS Distributions }, 195*c54f35caSApple OSS Distributions { number = 29, name = 'host_self', 196*c54f35caSApple OSS Distributions arguments = { 'void' }, 197*c54f35caSApple OSS Distributions }, 198*c54f35caSApple OSS Distributions 199*c54f35caSApple OSS Distributions { number = 31, name = 'mach_msg', 200*c54f35caSApple OSS Distributions arguments = { 201*c54f35caSApple OSS Distributions 'mach_msg_header_t *msg', 202*c54f35caSApple OSS Distributions 'mach_msg_option_t option', 203*c54f35caSApple OSS Distributions 'mach_msg_size_t send_size', 204*c54f35caSApple OSS Distributions 'mach_msg_size_t rcv_size', 205*c54f35caSApple OSS Distributions 'mach_port_name_t rcv_name', 206*c54f35caSApple OSS Distributions 'mach_msg_timeout_t timeout', 207*c54f35caSApple OSS Distributions 'mach_port_name_t notify', 208*c54f35caSApple OSS Distributions }, 209*c54f35caSApple OSS Distributions }, 210*c54f35caSApple OSS Distributions { number = 32, name = 'mach_msg_overwrite', 211*c54f35caSApple OSS Distributions arguments = { 212*c54f35caSApple OSS Distributions 'mach_msg_header_t *msg', 213*c54f35caSApple OSS Distributions 'mach_msg_option_t option', 214*c54f35caSApple OSS Distributions 'mach_msg_size_t send_size', 215*c54f35caSApple OSS Distributions 'mach_msg_size_t rcv_size', 216*c54f35caSApple OSS Distributions 'mach_port_name_t rcv_name', 217*c54f35caSApple OSS Distributions 'mach_msg_timeout_t timeout', 218*c54f35caSApple OSS Distributions 'mach_port_name_t notify', 219*c54f35caSApple OSS Distributions 'mach_msg_header_t *rcv_msg', 220*c54f35caSApple OSS Distributions 'mach_msg_size_t rcv_limit', 221*c54f35caSApple OSS Distributions }, 222*c54f35caSApple OSS Distributions }, 223*c54f35caSApple OSS Distributions { number = 33, name = 'semaphore_signal', 224*c54f35caSApple OSS Distributions arguments = { 225*c54f35caSApple OSS Distributions 'mach_port_name_t signal_name', 226*c54f35caSApple OSS Distributions }, 227*c54f35caSApple OSS Distributions }, 228*c54f35caSApple OSS Distributions { number = 34, name = 'semaphore_signal_all', 229*c54f35caSApple OSS Distributions arguments = { 230*c54f35caSApple OSS Distributions 'mach_port_name_t signal_name', 231*c54f35caSApple OSS Distributions }, 232*c54f35caSApple OSS Distributions }, 233*c54f35caSApple OSS Distributions { number = 35, name = 'semaphore_signal_thread', 234*c54f35caSApple OSS Distributions arguments = { 235*c54f35caSApple OSS Distributions 'mach_port_name_t signal_name', 236*c54f35caSApple OSS Distributions 'mach_port_name_t thread_name', 237*c54f35caSApple OSS Distributions }, 238*c54f35caSApple OSS Distributions }, 239*c54f35caSApple OSS Distributions { number = 36, name = 'semaphore_wait', 240*c54f35caSApple OSS Distributions arguments = { 241*c54f35caSApple OSS Distributions 'mach_port_name_t wait_name', 242*c54f35caSApple OSS Distributions }, 243*c54f35caSApple OSS Distributions }, 244*c54f35caSApple OSS Distributions { number = 37, name = 'semaphore_wait_signal', 245*c54f35caSApple OSS Distributions arguments = { 246*c54f35caSApple OSS Distributions 'mach_port_name_t wait_name', 247*c54f35caSApple OSS Distributions 'mach_port_name_t signal_name', 248*c54f35caSApple OSS Distributions }, 249*c54f35caSApple OSS Distributions }, 250*c54f35caSApple OSS Distributions { number = 38, name = 'semaphore_timedwait', 251*c54f35caSApple OSS Distributions arguments = { 252*c54f35caSApple OSS Distributions 'mach_port_name_t wait_name', 253*c54f35caSApple OSS Distributions 'unsigned int sec', 254*c54f35caSApple OSS Distributions 'clock_res_t nsec', 255*c54f35caSApple OSS Distributions }, 256*c54f35caSApple OSS Distributions }, 257*c54f35caSApple OSS Distributions { number = 39, name = 'semaphore_timedwait_signal', 258*c54f35caSApple OSS Distributions arguments = { 259*c54f35caSApple OSS Distributions 'mach_port_name_t wait_name', 260*c54f35caSApple OSS Distributions 'mach_port_name_t signal_name', 261*c54f35caSApple OSS Distributions 'unsigned int sec', 262*c54f35caSApple OSS Distributions 'clock_res_t nsec', 263*c54f35caSApple OSS Distributions }, 264*c54f35caSApple OSS Distributions }, 265*c54f35caSApple OSS Distributions { number = 40, name = 'mach_port_get_attributes', 266*c54f35caSApple OSS Distributions arguments = { 267*c54f35caSApple OSS Distributions 'mach_port_name_t target', 268*c54f35caSApple OSS Distributions 'mach_port_name_t name', 269*c54f35caSApple OSS Distributions 'mach_port_flavor_t flavor', 270*c54f35caSApple OSS Distributions 'mach_port_info_t port_info_out', 271*c54f35caSApple OSS Distributions 'mach_msg_type_number_t *port_info_outCnt', 272*c54f35caSApple OSS Distributions }, 273*c54f35caSApple OSS Distributions }, 274*c54f35caSApple OSS Distributions { number = 41, name = 'mach_port_guard', 275*c54f35caSApple OSS Distributions arguments = { 276*c54f35caSApple OSS Distributions 'mach_port_name_t target', 277*c54f35caSApple OSS Distributions 'mach_port_name_t name', 278*c54f35caSApple OSS Distributions 'uint64_t guard', 279*c54f35caSApple OSS Distributions 'boolean_t strict', 280*c54f35caSApple OSS Distributions }, 281*c54f35caSApple OSS Distributions }, 282*c54f35caSApple OSS Distributions { number = 42, name = 'mach_port_unguard', 283*c54f35caSApple OSS Distributions arguments = { 284*c54f35caSApple OSS Distributions 'mach_port_name_t target', 285*c54f35caSApple OSS Distributions 'mach_port_name_t name', 286*c54f35caSApple OSS Distributions 'uint64_t guard', 287*c54f35caSApple OSS Distributions }, 288*c54f35caSApple OSS Distributions }, 289*c54f35caSApple OSS Distributions { number = 43, name = 'mach_generate_activity_id', 290*c54f35caSApple OSS Distributions arguments = { 291*c54f35caSApple OSS Distributions 'mach_port_name_t target', 292*c54f35caSApple OSS Distributions 'int count', 293*c54f35caSApple OSS Distributions 'uint64_t *activity_id', 294*c54f35caSApple OSS Distributions }, 295*c54f35caSApple OSS Distributions }, 296*c54f35caSApple OSS Distributions { number = 44, name = 'task_name_for_pid', 297*c54f35caSApple OSS Distributions arguments = { 298*c54f35caSApple OSS Distributions 'mach_port_name_t target_tport', 299*c54f35caSApple OSS Distributions 'int pid', 300*c54f35caSApple OSS Distributions 'mach_port_name_t *tn', 301*c54f35caSApple OSS Distributions }, 302*c54f35caSApple OSS Distributions }, 303*c54f35caSApple OSS Distributions { number = 45, name = 'task_for_pid', 304*c54f35caSApple OSS Distributions arguments = { 305*c54f35caSApple OSS Distributions 'mach_port_name_t target_tport', 306*c54f35caSApple OSS Distributions 'int pid', 307*c54f35caSApple OSS Distributions 'mach_port_name_t *t', 308*c54f35caSApple OSS Distributions }, 309*c54f35caSApple OSS Distributions }, 310*c54f35caSApple OSS Distributions { number = 46, name = 'pid_for_task', 311*c54f35caSApple OSS Distributions arguments = { 312*c54f35caSApple OSS Distributions 'mach_port_name_t t', 313*c54f35caSApple OSS Distributions 'int *x', 314*c54f35caSApple OSS Distributions }, 315*c54f35caSApple OSS Distributions }, 316*c54f35caSApple OSS Distributions { number = 47, name = 'mach_msg2', 317*c54f35caSApple OSS Distributions arguments = { 318*c54f35caSApple OSS Distributions 'void *data', 319*c54f35caSApple OSS Distributions 'mach_msg_option64_t option64', 320*c54f35caSApple OSS Distributions 'mach_msg_header_t header', 321*c54f35caSApple OSS Distributions 'mach_msg_size_t send_size', 322*c54f35caSApple OSS Distributions 'mach_msg_size_t rcv_size', 323*c54f35caSApple OSS Distributions 'mach_port_t rcv_name', 324*c54f35caSApple OSS Distributions 'uint64_t timeout', 325*c54f35caSApple OSS Distributions 'uint32_t priority', 326*c54f35caSApple OSS Distributions }, 327*c54f35caSApple OSS Distributions }, 328*c54f35caSApple OSS Distributions { number = 48, name = 'macx_swapon', 329*c54f35caSApple OSS Distributions arguments = { 330*c54f35caSApple OSS Distributions 'uint64_t filename', 331*c54f35caSApple OSS Distributions 'int flags', 332*c54f35caSApple OSS Distributions 'int size', 333*c54f35caSApple OSS Distributions 'int priority', 334*c54f35caSApple OSS Distributions }, 335*c54f35caSApple OSS Distributions }, 336*c54f35caSApple OSS Distributions { number = 49, name = 'macx_swapoff', 337*c54f35caSApple OSS Distributions arguments = { 338*c54f35caSApple OSS Distributions 'uint64_t filename', 339*c54f35caSApple OSS Distributions 'int flags', 340*c54f35caSApple OSS Distributions }, 341*c54f35caSApple OSS Distributions }, 342*c54f35caSApple OSS Distributions { number = 50, name = 'thread_get_special_reply_port', 343*c54f35caSApple OSS Distributions arguments = { 'void' }, 344*c54f35caSApple OSS Distributions }, 345*c54f35caSApple OSS Distributions { number = 51, name = 'macx_triggers', 346*c54f35caSApple OSS Distributions arguments = { 347*c54f35caSApple OSS Distributions 'int hi_water', 348*c54f35caSApple OSS Distributions 'int low_water', 349*c54f35caSApple OSS Distributions 'int flags', 350*c54f35caSApple OSS Distributions 'mach_port_t alert_port', 351*c54f35caSApple OSS Distributions }, 352*c54f35caSApple OSS Distributions }, 353*c54f35caSApple OSS Distributions { number = 52, name = 'macx_backing_store_suspend', 354*c54f35caSApple OSS Distributions arguments = { 355*c54f35caSApple OSS Distributions 'boolean_t suspend', 356*c54f35caSApple OSS Distributions }, 357*c54f35caSApple OSS Distributions }, 358*c54f35caSApple OSS Distributions { number = 53, name = 'macx_backing_store_recovery', 359*c54f35caSApple OSS Distributions arguments = { 360*c54f35caSApple OSS Distributions 'int pid', 361*c54f35caSApple OSS Distributions }, 362*c54f35caSApple OSS Distributions }, 363*c54f35caSApple OSS Distributions 364*c54f35caSApple OSS Distributions { number = 58, name = 'pfz_exit', 365*c54f35caSApple OSS Distributions arguments = { 'void' }, 366*c54f35caSApple OSS Distributions }, 367*c54f35caSApple OSS Distributions { number = 59, name = 'swtch_pri', 368*c54f35caSApple OSS Distributions arguments = { 369*c54f35caSApple OSS Distributions 'int pri', 370*c54f35caSApple OSS Distributions }, 371*c54f35caSApple OSS Distributions }, 372*c54f35caSApple OSS Distributions { number = 60, name = 'swtch', 373*c54f35caSApple OSS Distributions arguments = { 'void' }, 374*c54f35caSApple OSS Distributions }, 375*c54f35caSApple OSS Distributions { number = 61, name = 'thread_switch', 376*c54f35caSApple OSS Distributions arguments = { 377*c54f35caSApple OSS Distributions 'mach_port_name_t thread_name', 378*c54f35caSApple OSS Distributions 'int option', 379*c54f35caSApple OSS Distributions 'mach_msg_timeout_t option_time', 380*c54f35caSApple OSS Distributions }, 381*c54f35caSApple OSS Distributions }, 382*c54f35caSApple OSS Distributions { number = 62, name = 'clock_sleep', 383*c54f35caSApple OSS Distributions arguments = { 384*c54f35caSApple OSS Distributions 'mach_port_name_t clock_name', 385*c54f35caSApple OSS Distributions 'sleep_type_t sleep_type', 386*c54f35caSApple OSS Distributions 'int sleep_sec', 387*c54f35caSApple OSS Distributions 'int sleep_nsec', 388*c54f35caSApple OSS Distributions 'mach_timespec_t *wakeup_time', 389*c54f35caSApple OSS Distributions }, 390*c54f35caSApple OSS Distributions }, 391*c54f35caSApple OSS Distributions 392*c54f35caSApple OSS Distributions { number = 70, name = 'host_create_mach_voucher', 393*c54f35caSApple OSS Distributions arguments = { 394*c54f35caSApple OSS Distributions 'mach_port_name_t host', 395*c54f35caSApple OSS Distributions 'mach_voucher_attr_raw_recipe_array_t recipes', 396*c54f35caSApple OSS Distributions 'int recipes_size', 397*c54f35caSApple OSS Distributions 'mach_port_name_t *voucher', 398*c54f35caSApple OSS Distributions }, 399*c54f35caSApple OSS Distributions }, 400*c54f35caSApple OSS Distributions 401*c54f35caSApple OSS Distributions { number = 72, name = 'mach_voucher_extract_attr_recipe', 402*c54f35caSApple OSS Distributions arguments = { 403*c54f35caSApple OSS Distributions 'mach_port_name_t voucher_name', 404*c54f35caSApple OSS Distributions 'mach_voucher_attr_key_t key', 405*c54f35caSApple OSS Distributions 'mach_voucher_attr_raw_recipe_t recipe', 406*c54f35caSApple OSS Distributions 'mach_msg_type_number_t *recipe_size', 407*c54f35caSApple OSS Distributions }, 408*c54f35caSApple OSS Distributions }, 409*c54f35caSApple OSS Distributions 410*c54f35caSApple OSS Distributions { number = 76, name = 'mach_port_type', 411*c54f35caSApple OSS Distributions arguments = { 412*c54f35caSApple OSS Distributions 'ipc_space_t task', 413*c54f35caSApple OSS Distributions 'mach_port_name_t name', 414*c54f35caSApple OSS Distributions 'mach_port_type_t *ptype', 415*c54f35caSApple OSS Distributions }, 416*c54f35caSApple OSS Distributions }, 417*c54f35caSApple OSS Distributions { number = 77, name = 'mach_port_request_notification', 418*c54f35caSApple OSS Distributions arguments = { 419*c54f35caSApple OSS Distributions 'ipc_space_t task', 420*c54f35caSApple OSS Distributions 'mach_port_name_t name', 421*c54f35caSApple OSS Distributions 'mach_msg_id_t msgid', 422*c54f35caSApple OSS Distributions 'mach_port_mscount_t sync', 423*c54f35caSApple OSS Distributions 'mach_port_name_t notify', 424*c54f35caSApple OSS Distributions 'mach_msg_type_name_t notifyPoly', 425*c54f35caSApple OSS Distributions 'mach_port_name_t *previous', 426*c54f35caSApple OSS Distributions }, 427*c54f35caSApple OSS Distributions }, 428*c54f35caSApple OSS Distributions 429*c54f35caSApple OSS Distributions { number = 89, name = 'mach_timebase_info', 430*c54f35caSApple OSS Distributions arguments = { 431*c54f35caSApple OSS Distributions 'mach_timebase_info_t info', 432*c54f35caSApple OSS Distributions }, 433*c54f35caSApple OSS Distributions }, 434*c54f35caSApple OSS Distributions { number = 90, name = 'mach_wait_until', 435*c54f35caSApple OSS Distributions arguments = { 436*c54f35caSApple OSS Distributions 'uint64_t deadline', 437*c54f35caSApple OSS Distributions }, 438*c54f35caSApple OSS Distributions }, 439*c54f35caSApple OSS Distributions { number = 91, name = 'mk_timer_create', 440*c54f35caSApple OSS Distributions arguments = { 'void' }, 441*c54f35caSApple OSS Distributions }, 442*c54f35caSApple OSS Distributions { number = 92, name = 'mk_timer_destroy', 443*c54f35caSApple OSS Distributions arguments = { 444*c54f35caSApple OSS Distributions 'mach_port_name_t name', 445*c54f35caSApple OSS Distributions }, 446*c54f35caSApple OSS Distributions }, 447*c54f35caSApple OSS Distributions { number = 93, name = 'mk_timer_arm', 448*c54f35caSApple OSS Distributions arguments = { 449*c54f35caSApple OSS Distributions 'mach_port_name_t name', 450*c54f35caSApple OSS Distributions 'uint64_t expire_time', 451*c54f35caSApple OSS Distributions }, 452*c54f35caSApple OSS Distributions }, 453*c54f35caSApple OSS Distributions { number = 94, name = 'mk_timer_cancel', 454*c54f35caSApple OSS Distributions arguments = { 455*c54f35caSApple OSS Distributions 'mach_port_name_t name', 456*c54f35caSApple OSS Distributions 'uint64_t *result_time', 457*c54f35caSApple OSS Distributions }, 458*c54f35caSApple OSS Distributions }, 459*c54f35caSApple OSS Distributions { number = 95, name = 'mk_timer_arm_leeway', 460*c54f35caSApple OSS Distributions arguments = { 461*c54f35caSApple OSS Distributions 'mach_port_name_t name', 462*c54f35caSApple OSS Distributions 'uint64_t mk_timer_flags', 463*c54f35caSApple OSS Distributions 'uint64_t mk_timer_expire_time', 464*c54f35caSApple OSS Distributions 'uint64_t mk_timer_leeway', 465*c54f35caSApple OSS Distributions }, 466*c54f35caSApple OSS Distributions }, 467*c54f35caSApple OSS Distributions { number = 96, name = 'debug_control_port_for_pid', 468*c54f35caSApple OSS Distributions arguments = { 469*c54f35caSApple OSS Distributions 'mach_port_name_t target_tport', 470*c54f35caSApple OSS Distributions 'int pid', 471*c54f35caSApple OSS Distributions 'mach_port_name_t *t', 472*c54f35caSApple OSS Distributions }, 473*c54f35caSApple OSS Distributions }, 474*c54f35caSApple OSS Distributions 475*c54f35caSApple OSS Distributions { number = 100, name = 'iokit_user_client', 476*c54f35caSApple OSS Distributions arguments = { 477*c54f35caSApple OSS Distributions 'void *userClientRef', 478*c54f35caSApple OSS Distributions 'uint32_t index', 479*c54f35caSApple OSS Distributions 'void *p1', 480*c54f35caSApple OSS Distributions 'void *p2', 481*c54f35caSApple OSS Distributions 'void *p3', 482*c54f35caSApple OSS Distributions 'void *p4', 483*c54f35caSApple OSS Distributions 'void *p5', 484*c54f35caSApple OSS Distributions 'void *p6', 485*c54f35caSApple OSS Distributions }, 486*c54f35caSApple OSS Distributions }, 487*c54f35caSApple OSS Distributions }, 488*c54f35caSApple OSS Distributions} 489*c54f35caSApple OSS Distributions 490*c54f35caSApple OSS Distributions-- Basic sanity checking that the same number isn't claimed by two syscalls. 491*c54f35caSApple OSS Distributionsfor type, entries in pairs(syscalls) do 492*c54f35caSApple OSS Distributions local numbers_seen = {} 493*c54f35caSApple OSS Distributions for _, call in ipairs(entries) do 494*c54f35caSApple OSS Distributions if numbers_seen[call.number] then 495*c54f35caSApple OSS Distributions io.stderr:write(('error: %s: saw %d twice: %s and %s\n'):format(type, 496*c54f35caSApple OSS Distributions call.number, call.name, numbers_seen[call.number])) 497*c54f35caSApple OSS Distributions os.exit(1) 498*c54f35caSApple OSS Distributions end 499*c54f35caSApple OSS Distributions numbers_seen[call.number] = call.name 500*c54f35caSApple OSS Distributions end 501*c54f35caSApple OSS Distributionsend 502*c54f35caSApple OSS Distributions 503*c54f35caSApple OSS Distributionsprint(cjson.encode(syscalls)) 504