| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 # | 5 # |
| 6 # This script produces wrapped versions of syscall implementation | 6 # This script produces wrapped versions of syscall implementation |
| 7 # functions. The wrappers extract syscall arguments from where the | 7 # functions. The wrappers extract syscall arguments from where the |
| 8 # syscall trampoline saves them. | 8 # syscall trampoline saves them. |
| 9 # | 9 # |
| 10 # Note that NaCl modules are always ILP32 and compiled with a | 10 # Note that NaCl modules are always ILP32 and compiled with a |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 */ | 31 */ |
| 32 | 32 |
| 33 #include "native_client/src/trusted/service_runtime/nacl_syscall_common.h" | 33 #include "native_client/src/trusted/service_runtime/nacl_syscall_common.h" |
| 34 #include "native_client/src/trusted/service_runtime/sys_exception.h" | 34 #include "native_client/src/trusted/service_runtime/sys_exception.h" |
| 35 #include "native_client/src/trusted/service_runtime/sys_fdio.h" | 35 #include "native_client/src/trusted/service_runtime/sys_fdio.h" |
| 36 #include "native_client/src/trusted/service_runtime/sys_filename.h" | 36 #include "native_client/src/trusted/service_runtime/sys_filename.h" |
| 37 #include "native_client/src/trusted/service_runtime/sys_imc.h" | 37 #include "native_client/src/trusted/service_runtime/sys_imc.h" |
| 38 #include "native_client/src/trusted/service_runtime/sys_list_mappings.h" | 38 #include "native_client/src/trusted/service_runtime/sys_list_mappings.h" |
| 39 #include "native_client/src/trusted/service_runtime/sys_memory.h" | 39 #include "native_client/src/trusted/service_runtime/sys_memory.h" |
| 40 #include "native_client/src/trusted/service_runtime/sys_parallel_io.h" | 40 #include "native_client/src/trusted/service_runtime/sys_parallel_io.h" |
| 41 #include "native_client/src/trusted/service_runtime/sys_random.h" |
| 41 | 42 |
| 42 """ | 43 """ |
| 43 | 44 |
| 44 | 45 |
| 45 TABLE_INITIALIZER = """\ | 46 TABLE_INITIALIZER = """\ |
| 46 | 47 |
| 47 /* auto generated */ | 48 /* auto generated */ |
| 48 | 49 |
| 49 void NaClSyscallTableInit() { | 50 void NaClSyscallTableInit() { |
| 50 int i; | 51 int i; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 ['uint32_t handler_addr', 'uint32_t old_handler']), | 208 ['uint32_t handler_addr', 'uint32_t old_handler']), |
| 208 ('NACL_sys_exception_stack', 'NaClSysExceptionStack', | 209 ('NACL_sys_exception_stack', 'NaClSysExceptionStack', |
| 209 ['uint32_t stack_addr', 'uint32_t stack_size']), | 210 ['uint32_t stack_addr', 'uint32_t stack_size']), |
| 210 ('NACL_sys_exception_clear_flag', 'NaClSysExceptionClearFlag', []), | 211 ('NACL_sys_exception_clear_flag', 'NaClSysExceptionClearFlag', []), |
| 211 ('NACL_sys_test_infoleak', 'NaClSysTestInfoLeak', []), | 212 ('NACL_sys_test_infoleak', 'NaClSysTestInfoLeak', []), |
| 212 ('NACL_sys_test_crash', 'NaClSysTestCrash', ['int crash_type']), | 213 ('NACL_sys_test_crash', 'NaClSysTestCrash', ['int crash_type']), |
| 213 ('NACL_sys_futex_wait_abs', 'NaClSysFutexWaitAbs', | 214 ('NACL_sys_futex_wait_abs', 'NaClSysFutexWaitAbs', |
| 214 ['uint32_t addr', 'uint32_t value', 'uint32_t abstime_ptr']), | 215 ['uint32_t addr', 'uint32_t value', 'uint32_t abstime_ptr']), |
| 215 ('NACL_sys_futex_wake', 'NaClSysFutexWake', | 216 ('NACL_sys_futex_wake', 'NaClSysFutexWake', |
| 216 ['uint32_t addr', 'uint32_t nwake']), | 217 ['uint32_t addr', 'uint32_t nwake']), |
| 218 ('NACL_sys_get_random_bytes', 'NaClSysGetRandomBytes', |
| 219 ['uint32_t buf_addr', 'uint32_t buf_size']), |
| 217 ] | 220 ] |
| 218 | 221 |
| 219 | 222 |
| 220 # Syscall arguments MUST be declared in a simple-to-parse manner! | 223 # Syscall arguments MUST be declared in a simple-to-parse manner! |
| 221 # They must match the following regexp: | 224 # They must match the following regexp: |
| 222 | 225 |
| 223 ARG_RE = r'\s*((\w+\s+)+\**)\s*(\w+)' | 226 ARG_RE = r'\s*((\w+\s+)+\**)\s*(\w+)' |
| 224 | 227 |
| 225 # where matchobj.group(1) is the type, and matchobj.group(3) is the | 228 # where matchobj.group(1) is the type, and matchobj.group(3) is the |
| 226 # identifer. | 229 # identifer. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 protos = SYSCALL_LIST | 353 protos = SYSCALL_LIST |
| 351 print >>output_dst, data | 354 print >>output_dst, data |
| 352 PrintImplSkel(arch, protos, output_dst) | 355 PrintImplSkel(arch, protos, output_dst) |
| 353 PrintSyscallTableInitializer(protos, output_dst) | 356 PrintSyscallTableInitializer(protos, output_dst) |
| 354 | 357 |
| 355 return 0 | 358 return 0 |
| 356 | 359 |
| 357 | 360 |
| 358 if __name__ == '__main__': | 361 if __name__ == '__main__': |
| 359 sys.exit(main(sys.argv)) | 362 sys.exit(main(sys.argv)) |
| OLD | NEW |