blob: baaa52d25bfaa1aa3f809ae3c59ef8f7cf6168c4 [file] [log] [blame]
Elliott Hughes6b586e72021-04-15 13:39:08 -07001#!/usr/bin/env python3
Pavel Chupinf12a18b2012-12-12 13:11:48 +04002
3# This tool is used to generate the assembler system call stubs,
4# the header files listing all available system calls, and the
5# makefiles used to build all the stubs.
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -07006
Christopher Ferris01bd32e2014-08-05 12:19:27 -07007import atexit
Elliott Hughes103ccde2013-10-16 14:27:59 -07008import filecmp
9import glob
Elliott Hughes103ccde2013-10-16 14:27:59 -070010import re
11import shutil
12import stat
Elliott Hughesdc1fb702014-08-20 11:16:11 -070013import string
Elliott Hughes103ccde2013-10-16 14:27:59 -070014import sys
Christopher Ferris01bd32e2014-08-05 12:19:27 -070015import tempfile
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070016
Elliott Hughesdc1fb702014-08-20 11:16:11 -070017
Elliott Hughesc2faf232020-02-03 17:56:06 -080018SupportedArchitectures = [ "arm", "arm64", "x86", "x86_64" ]
Elliott Hughesdc1fb702014-08-20 11:16:11 -070019
Elliott Hughesd67b0372019-04-15 14:18:26 -070020syscall_stub_header = \
Elliott Hughes103ccde2013-10-16 14:27:59 -070021"""
Elliott Hughes0437f3f2013-10-07 23:53:13 -070022ENTRY(%(func)s)
Pavel Chupinf12a18b2012-12-12 13:11:48 +040023"""
24
Elliott Hughes0437f3f2013-10-07 23:53:13 -070025
Elliott Hughes0437f3f2013-10-07 23:53:13 -070026#
27# ARM assembler templates for each syscall stub
28#
29
30arm_eabi_call_default = syscall_stub_header + """\
31 mov ip, r7
Christopher Ferrisf5a91232016-04-27 18:31:02 -070032 .cfi_register r7, ip
Elliott Hughes0437f3f2013-10-07 23:53:13 -070033 ldr r7, =%(__NR_name)s
34 swi #0
35 mov r7, ip
Christopher Ferrisf5a91232016-04-27 18:31:02 -070036 .cfi_restore r7
Elliott Hughes0437f3f2013-10-07 23:53:13 -070037 cmn r0, #(MAX_ERRNO + 1)
38 bxls lr
39 neg r0, r0
Elliott Hughes011e1112014-09-08 15:25:01 -070040 b __set_errno_internal
Elliott Hughes0437f3f2013-10-07 23:53:13 -070041END(%(func)s)
42"""
43
44arm_eabi_call_long = syscall_stub_header + """\
45 mov ip, sp
Elliott Hughes0437f3f2013-10-07 23:53:13 -070046 stmfd sp!, {r4, r5, r6, r7}
Christopher Ferrised459702013-12-02 17:44:53 -080047 .cfi_def_cfa_offset 16
48 .cfi_rel_offset r4, 0
49 .cfi_rel_offset r5, 4
50 .cfi_rel_offset r6, 8
51 .cfi_rel_offset r7, 12
Elliott Hughes0437f3f2013-10-07 23:53:13 -070052 ldmfd ip, {r4, r5, r6}
53 ldr r7, =%(__NR_name)s
54 swi #0
55 ldmfd sp!, {r4, r5, r6, r7}
Christopher Ferrised459702013-12-02 17:44:53 -080056 .cfi_def_cfa_offset 0
Elliott Hughes0437f3f2013-10-07 23:53:13 -070057 cmn r0, #(MAX_ERRNO + 1)
58 bxls lr
59 neg r0, r0
Elliott Hughes011e1112014-09-08 15:25:01 -070060 b __set_errno_internal
Elliott Hughes0437f3f2013-10-07 23:53:13 -070061END(%(func)s)
62"""
63
64
65#
Elliott Hughesd67b0372019-04-15 14:18:26 -070066# Arm64 assembler template for each syscall stub
Colin Crossd1973ca2014-01-21 19:50:58 -080067#
68
69arm64_call = syscall_stub_header + """\
Colin Crossd1973ca2014-01-21 19:50:58 -080070 mov x8, %(__NR_name)s
71 svc #0
72
Colin Crossd1973ca2014-01-21 19:50:58 -080073 cmn x0, #(MAX_ERRNO + 1)
74 cneg x0, x0, hi
Elliott Hughes011e1112014-09-08 15:25:01 -070075 b.hi __set_errno_internal
Colin Crossd1973ca2014-01-21 19:50:58 -080076
77 ret
78END(%(func)s)
79"""
80
81
82#
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070083# x86 assembler templates for each syscall stub
84#
85
Christopher Ferrise4bc7562014-01-06 16:39:10 -080086x86_registers = [ "ebx", "ecx", "edx", "esi", "edi", "ebp" ]
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070087
Mingwei Shibe910522015-11-12 07:02:14 +000088x86_call_prepare = """\
89
90 call __kernel_syscall
91 pushl %eax
92 .cfi_adjust_cfa_offset 4
93 .cfi_rel_offset eax, 0
94
95"""
96
Elliott Hughes0437f3f2013-10-07 23:53:13 -070097x86_call = """\
98 movl $%(__NR_name)s, %%eax
Mingwei Shibe910522015-11-12 07:02:14 +000099 call *(%%esp)
100 addl $4, %%esp
101
Elliott Hughes9aceab52013-03-12 14:57:30 -0700102 cmpl $-MAX_ERRNO, %%eax
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700103 jb 1f
104 negl %%eax
105 pushl %%eax
Elliott Hughes011e1112014-09-08 15:25:01 -0700106 call __set_errno_internal
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700107 addl $4, %%esp
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -07001081:
109"""
110
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700111x86_return = """\
112 ret
113END(%(func)s)
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700114"""
115
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700116
Elliott Hughescd6780b2013-02-07 14:07:00 -0800117#
Elliott Hughesd67b0372019-04-15 14:18:26 -0700118# x86_64 assembler template for each syscall stub
Pavel Chupinf12a18b2012-12-12 13:11:48 +0400119#
120
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700121x86_64_call = """\
122 movl $%(__NR_name)s, %%eax
Pavel Chupinf12a18b2012-12-12 13:11:48 +0400123 syscall
124 cmpq $-MAX_ERRNO, %%rax
125 jb 1f
126 negl %%eax
127 movl %%eax, %%edi
Elliott Hughes011e1112014-09-08 15:25:01 -0700128 call __set_errno_internal
Pavel Chupinf12a18b2012-12-12 13:11:48 +04001291:
130 ret
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700131END(%(func)s)
Pavel Chupinf12a18b2012-12-12 13:11:48 +0400132"""
133
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800134
David 'Digit' Turner95d751f2010-12-16 16:47:14 +0100135def param_uses_64bits(param):
136 """Returns True iff a syscall parameter description corresponds
137 to a 64-bit type."""
138 param = param.strip()
139 # First, check that the param type begins with one of the known
140 # 64-bit types.
141 if not ( \
142 param.startswith("int64_t") or param.startswith("uint64_t") or \
143 param.startswith("loff_t") or param.startswith("off64_t") or \
144 param.startswith("long long") or param.startswith("unsigned long long") or
145 param.startswith("signed long long") ):
146 return False
147
148 # Second, check that there is no pointer type here
149 if param.find("*") >= 0:
150 return False
151
152 # Ok
153 return True
154
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700155
David 'Digit' Turner95d751f2010-12-16 16:47:14 +0100156def count_arm_param_registers(params):
157 """This function is used to count the number of register used
Elliott Hughescd6780b2013-02-07 14:07:00 -0800158 to pass parameters when invoking an ARM system call.
David 'Digit' Turner95d751f2010-12-16 16:47:14 +0100159 This is because the ARM EABI mandates that 64-bit quantities
160 must be passed in an even+odd register pair. So, for example,
161 something like:
162
163 foo(int fd, off64_t pos)
164
165 would actually need 4 registers:
166 r0 -> int
167 r1 -> unused
168 r2-r3 -> pos
169 """
170 count = 0
171 for param in params:
172 if param_uses_64bits(param):
173 if (count & 1) != 0:
174 count += 1
175 count += 2
176 else:
177 count += 1
178 return count
179
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700180
David 'Digit' Turner95d751f2010-12-16 16:47:14 +0100181def count_generic_param_registers(params):
182 count = 0
183 for param in params:
184 if param_uses_64bits(param):
185 count += 2
186 else:
187 count += 1
188 return count
189
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700190
Pavel Chupinf12a18b2012-12-12 13:11:48 +0400191def count_generic_param_registers64(params):
192 count = 0
193 for param in params:
194 count += 1
195 return count
196
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700197
Elliott Hughescda62092013-03-22 13:50:44 -0700198# This lets us support regular system calls like __NR_write and also weird
199# ones like __ARM_NR_cacheflush, where the NR doesn't come at the start.
200def make__NR_name(name):
Christopher Ferris01bd32e2014-08-05 12:19:27 -0700201 if name.startswith("__ARM_NR_"):
Elliott Hughescda62092013-03-22 13:50:44 -0700202 return name
203 else:
204 return "__NR_%s" % (name)
205
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700206
Elliott Hughesfff6e272013-10-24 17:03:20 -0700207def add_footer(pointer_length, stub, syscall):
208 # Add any aliases for this syscall.
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700209 aliases = syscall["aliases"]
210 for alias in aliases:
Christopher Ferrisfa5faa02015-03-24 16:50:46 -0700211 stub += "\nALIAS_SYMBOL(%s, %s)\n" % (alias, syscall["func"])
Elliott Hughesfff6e272013-10-24 17:03:20 -0700212
Nick Kralevich00490ae2015-02-03 11:27:25 -0800213 # Use hidden visibility on LP64 for any functions beginning with underscores.
Elliott Hughes50080a22019-06-19 12:47:53 -0700214 if pointer_length == 64 and syscall["func"].startswith("__"):
Elliott Hughesd465eb42014-02-19 18:59:19 -0800215 stub += '.hidden ' + syscall["func"] + '\n'
Elliott Hughesfff6e272013-10-24 17:03:20 -0700216
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700217 return stub
218
219
220def arm_eabi_genstub(syscall):
221 num_regs = count_arm_param_registers(syscall["params"])
222 if num_regs > 4:
223 return arm_eabi_call_long % syscall
224 return arm_eabi_call_default % syscall
225
226
Colin Crossd1973ca2014-01-21 19:50:58 -0800227def arm64_genstub(syscall):
228 return arm64_call % syscall
229
230
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700231def x86_genstub(syscall):
232 result = syscall_stub_header % syscall
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700233
234 numparams = count_generic_param_registers(syscall["params"])
Mingwei Shibe910522015-11-12 07:02:14 +0000235 stack_bias = numparams*4 + 8
Christopher Ferrise4bc7562014-01-06 16:39:10 -0800236 offset = 0
237 mov_result = ""
Christopher Ferris15b91e92014-05-29 18:17:09 -0700238 first_push = True
Christopher Ferrise4bc7562014-01-06 16:39:10 -0800239 for register in x86_registers[:numparams]:
240 result += " pushl %%%s\n" % register
Christopher Ferris15b91e92014-05-29 18:17:09 -0700241 if first_push:
242 result += " .cfi_def_cfa_offset 8\n"
243 result += " .cfi_rel_offset %s, 0\n" % register
244 first_push = False
245 else:
246 result += " .cfi_adjust_cfa_offset 4\n"
247 result += " .cfi_rel_offset %s, 0\n" % register
Christopher Ferrise4bc7562014-01-06 16:39:10 -0800248 mov_result += " mov %d(%%esp), %%%s\n" % (stack_bias+offset, register)
Christopher Ferrise4bc7562014-01-06 16:39:10 -0800249 offset += 4
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700250
Mingwei Shibe910522015-11-12 07:02:14 +0000251 result += x86_call_prepare
Christopher Ferris15b91e92014-05-29 18:17:09 -0700252 result += mov_result
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700253 result += x86_call % syscall
254
Christopher Ferrise4bc7562014-01-06 16:39:10 -0800255 for register in reversed(x86_registers[:numparams]):
256 result += " popl %%%s\n" % register
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700257
258 result += x86_return % syscall
259 return result
260
Serban Constantinescufeaa89a2013-10-07 16:49:09 +0100261
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700262def x86_genstub_socketcall(syscall):
263 # %ebx <--- Argument 1 - The call id of the needed vectored
264 # syscall (socket, bind, recv, etc)
265 # %ecx <--- Argument 2 - Pointer to the rest of the arguments
266 # from the original function called (socket())
267
268 result = syscall_stub_header % syscall
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700269
270 # save the regs we need
Christopher Ferrise4bc7562014-01-06 16:39:10 -0800271 result += " pushl %ebx\n"
Christopher Ferrise4bc7562014-01-06 16:39:10 -0800272 result += " .cfi_def_cfa_offset 8\n"
273 result += " .cfi_rel_offset ebx, 0\n"
Christopher Ferris15b91e92014-05-29 18:17:09 -0700274 result += " pushl %ecx\n"
275 result += " .cfi_adjust_cfa_offset 4\n"
276 result += " .cfi_rel_offset ecx, 0\n"
Mingwei Shibe910522015-11-12 07:02:14 +0000277 stack_bias = 16
278
279 result += x86_call_prepare
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700280
281 # set the call id (%ebx)
Christopher Ferrise4bc7562014-01-06 16:39:10 -0800282 result += " mov $%d, %%ebx\n" % syscall["socketcall_id"]
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700283
284 # set the pointer to the rest of the args into %ecx
Christopher Ferrise4bc7562014-01-06 16:39:10 -0800285 result += " mov %esp, %ecx\n"
286 result += " addl $%d, %%ecx\n" % (stack_bias)
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700287
288 # now do the syscall code itself
289 result += x86_call % syscall
290
291 # now restore the saved regs
Christopher Ferrise4bc7562014-01-06 16:39:10 -0800292 result += " popl %ecx\n"
293 result += " popl %ebx\n"
Elliott Hughes0437f3f2013-10-07 23:53:13 -0700294
295 # epilog
296 result += x86_return % syscall
297 return result
298
299
300def x86_64_genstub(syscall):
301 result = syscall_stub_header % syscall
302 num_regs = count_generic_param_registers64(syscall["params"])
303 if (num_regs > 3):
304 # rcx is used as 4th argument. Kernel wants it at r10.
305 result += " movq %rcx, %r10\n"
306
307 result += x86_64_call % syscall
308 return result
309
310
Elliott Hughesdc1fb702014-08-20 11:16:11 -0700311class SysCallsTxtParser:
312 def __init__(self):
313 self.syscalls = []
314 self.lineno = 0
315
316 def E(self, msg):
Elliott Hughesbc6999f2021-02-03 13:13:57 -0800317 print("%d: %s" % (self.lineno, msg))
Elliott Hughesdc1fb702014-08-20 11:16:11 -0700318
319 def parse_line(self, line):
320 """ parse a syscall spec line.
321
322 line processing, format is
323 return type func_name[|alias_list][:syscall_name[:socketcall_id]] ( [paramlist] ) architecture_list
324 """
325 pos_lparen = line.find('(')
326 E = self.E
327 if pos_lparen < 0:
328 E("missing left parenthesis in '%s'" % line)
329 return
330
331 pos_rparen = line.rfind(')')
332 if pos_rparen < 0 or pos_rparen <= pos_lparen:
333 E("missing or misplaced right parenthesis in '%s'" % line)
334 return
335
336 return_type = line[:pos_lparen].strip().split()
337 if len(return_type) < 2:
338 E("missing return type in '%s'" % line)
339 return
340
341 syscall_func = return_type[-1]
Elliott Hughesbc6999f2021-02-03 13:13:57 -0800342 return_type = ' '.join(return_type[:-1])
Elliott Hughesdc1fb702014-08-20 11:16:11 -0700343 socketcall_id = -1
344
345 pos_colon = syscall_func.find(':')
346 if pos_colon < 0:
347 syscall_name = syscall_func
348 else:
349 if pos_colon == 0 or pos_colon+1 >= len(syscall_func):
350 E("misplaced colon in '%s'" % line)
351 return
352
353 # now find if there is a socketcall_id for a dispatch-type syscall
354 # after the optional 2nd colon
355 pos_colon2 = syscall_func.find(':', pos_colon + 1)
356 if pos_colon2 < 0:
357 syscall_name = syscall_func[pos_colon+1:]
358 syscall_func = syscall_func[:pos_colon]
359 else:
360 if pos_colon2+1 >= len(syscall_func):
361 E("misplaced colon2 in '%s'" % line)
362 return
363 syscall_name = syscall_func[(pos_colon+1):pos_colon2]
364 socketcall_id = int(syscall_func[pos_colon2+1:])
365 syscall_func = syscall_func[:pos_colon]
366
367 alias_delim = syscall_func.find('|')
368 if alias_delim > 0:
369 alias_list = syscall_func[alias_delim+1:].strip()
370 syscall_func = syscall_func[:alias_delim]
371 alias_delim = syscall_name.find('|')
372 if alias_delim > 0:
373 syscall_name = syscall_name[:alias_delim]
Elliott Hughesbc6999f2021-02-03 13:13:57 -0800374 syscall_aliases = alias_list.split(',')
Elliott Hughesdc1fb702014-08-20 11:16:11 -0700375 else:
376 syscall_aliases = []
377
378 if pos_rparen > pos_lparen+1:
379 syscall_params = line[pos_lparen+1:pos_rparen].split(',')
Elliott Hughesbc6999f2021-02-03 13:13:57 -0800380 params = ','.join(syscall_params)
Elliott Hughesdc1fb702014-08-20 11:16:11 -0700381 else:
382 syscall_params = []
383 params = "void"
384
385 t = {
386 "name" : syscall_name,
387 "func" : syscall_func,
388 "aliases" : syscall_aliases,
389 "params" : syscall_params,
390 "decl" : "%-15s %s (%s);" % (return_type, syscall_func, params),
391 "socketcall_id" : socketcall_id
392 }
393
394 # Parse the architecture list.
395 arch_list = line[pos_rparen+1:].strip()
396 if arch_list == "all":
Elliott Hughesae03b122019-09-17 16:37:05 -0700397 for arch in SupportedArchitectures:
Elliott Hughesdc1fb702014-08-20 11:16:11 -0700398 t[arch] = True
399 else:
Elliott Hughesbc6999f2021-02-03 13:13:57 -0800400 for arch in arch_list.split(','):
Elliott Hughes2b499042020-02-13 14:21:55 -0800401 if arch == "lp32":
402 for arch in SupportedArchitectures:
403 if "64" not in arch:
404 t[arch] = True
405 elif arch == "lp64":
406 for arch in SupportedArchitectures:
407 if "64" in arch:
408 t[arch] = True
409 elif arch in SupportedArchitectures:
Elliott Hughesdc1fb702014-08-20 11:16:11 -0700410 t[arch] = True
411 else:
412 E("invalid syscall architecture '%s' in '%s'" % (arch, line))
413 return
414
415 self.syscalls.append(t)
416
Paul Lawrence7ea40902017-02-14 13:32:23 -0800417 def parse_open_file(self, fp):
418 for line in fp:
Elliott Hughesdc1fb702014-08-20 11:16:11 -0700419 self.lineno += 1
420 line = line.strip()
421 if not line: continue
422 if line[0] == '#': continue
423 self.parse_line(line)
424
Paul Lawrence7ea40902017-02-14 13:32:23 -0800425 def parse_file(self, file_path):
Paul Lawrence7ea40902017-02-14 13:32:23 -0800426 with open(file_path) as fp:
Alessio Balsini93d4f8b2017-04-11 18:27:29 +0200427 self.parse_open_file(fp)
Elliott Hughesdc1fb702014-08-20 11:16:11 -0700428
429
John Catere86e5052019-09-26 14:47:03 -0400430def main(arch, syscall_file):
Elliott Hughes782c4852019-04-16 12:31:00 -0700431 parser = SysCallsTxtParser()
John Catere86e5052019-09-26 14:47:03 -0400432 parser.parse_file(syscall_file)
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700433
Elliott Hughes782c4852019-04-16 12:31:00 -0700434 for syscall in parser.syscalls:
435 syscall["__NR_name"] = make__NR_name(syscall["name"])
Pavel Chupinf12a18b2012-12-12 13:11:48 +0400436
Rupert Shuttleworthe99df592021-04-15 06:09:04 -0400437 if "arm" in syscall:
Elliott Hughes782c4852019-04-16 12:31:00 -0700438 syscall["asm-arm"] = add_footer(32, arm_eabi_genstub(syscall), syscall)
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700439
Rupert Shuttleworthe99df592021-04-15 06:09:04 -0400440 if "arm64" in syscall:
Elliott Hughes782c4852019-04-16 12:31:00 -0700441 syscall["asm-arm64"] = add_footer(64, arm64_genstub(syscall), syscall)
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700442
Rupert Shuttleworthe99df592021-04-15 06:09:04 -0400443 if "x86" in syscall:
Elliott Hughes782c4852019-04-16 12:31:00 -0700444 if syscall["socketcall_id"] >= 0:
445 syscall["asm-x86"] = add_footer(32, x86_genstub_socketcall(syscall), syscall)
446 else:
447 syscall["asm-x86"] = add_footer(32, x86_genstub(syscall), syscall)
448 elif syscall["socketcall_id"] >= 0:
449 E("socketcall_id for dispatch syscalls is only supported for x86 in '%s'" % t)
450 return
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700451
Rupert Shuttleworthe99df592021-04-15 06:09:04 -0400452 if "x86_64" in syscall:
Elliott Hughes782c4852019-04-16 12:31:00 -0700453 syscall["asm-x86_64"] = add_footer(64, x86_64_genstub(syscall), syscall)
The Android Open Source Project4e468ed2008-12-17 18:03:48 -0800454
Elliott Hughes782c4852019-04-16 12:31:00 -0700455 print("/* Generated by gensyscalls.py. Do not edit. */\n")
456 print("#include <private/bionic_asm.h>\n")
457 for syscall in parser.syscalls:
Rupert Shuttleworthe99df592021-04-15 06:09:04 -0400458 if ("asm-%s" % arch) in syscall:
Elliott Hughes782c4852019-04-16 12:31:00 -0700459 print(syscall["asm-%s" % arch])
Chris Dearman50432122014-02-05 16:59:23 -0800460
Tamas Petz19d66e62019-12-03 17:18:43 +0100461 if arch == 'arm64':
462 print('\nNOTE_GNU_PROPERTY()\n')
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700463
Paul Lawrenceeabc3522016-11-11 11:33:42 -0800464if __name__ == "__main__":
John Catere86e5052019-09-26 14:47:03 -0400465 if len(sys.argv) < 2:
Elliott Hughesbc6999f2021-02-03 13:13:57 -0800466 print("Usage: gensyscalls.py ARCH SOURCE_FILE")
John Catere86e5052019-09-26 14:47:03 -0400467 sys.exit(1)
468
469 arch = sys.argv[1]
470 syscall_file = sys.argv[2]
471 main(arch, syscall_file)