Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1069)

Side by Side Diff: src/trusted/service_runtime/nacl_syscall_handlers_gen.py

Issue 12209042: Ensure syscall functions are consistently prefixed with "NaClSys" (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 ('NACL_sys_lseek', 'NaClSysLseek', 110 ('NACL_sys_lseek', 'NaClSysLseek',
111 ['int d', 'nacl_abi_off_t *offp', 'int whence']), 111 ['int d', 'nacl_abi_off_t *offp', 'int whence']),
112 ('NACL_sys_ioctl', 'NaClSysIoctl', 112 ('NACL_sys_ioctl', 'NaClSysIoctl',
113 ['int d', 'int request', 'void *arg']), 113 ['int d', 'int request', 'void *arg']),
114 ('NACL_sys_fstat', 'NaClSysFstat', 114 ('NACL_sys_fstat', 'NaClSysFstat',
115 ['int d', 'struct nacl_abi_stat *nasp']), 115 ['int d', 'struct nacl_abi_stat *nasp']),
116 ('NACL_sys_stat', 'NaClSysStat', 116 ('NACL_sys_stat', 'NaClSysStat',
117 ['const char *path', 'struct nacl_abi_stat *nasp']), 117 ['const char *path', 'struct nacl_abi_stat *nasp']),
118 ('NACL_sys_getdents', 'NaClSysGetdents', 118 ('NACL_sys_getdents', 'NaClSysGetdents',
119 ['int d', 'void *buf', 'size_t count']), 119 ['int d', 'void *buf', 'size_t count']),
120 ('NACL_sys_sysbrk', 'NaClSetBreak', ['uintptr_t new_break']), 120 ('NACL_sys_brk', 'NaClSysBrk', ['uintptr_t new_break']),
121 ('NACL_sys_mmap', 'NaClSysMmap', 121 ('NACL_sys_mmap', 'NaClSysMmap',
122 ['void *start', 'size_t length', 'int prot', 122 ['void *start', 'size_t length', 'int prot',
123 'int flags', 'int d', 'nacl_abi_off_t *offp']), 123 'int flags', 'int d', 'nacl_abi_off_t *offp']),
124 ('NACL_sys_mprotect', 'NaClSysMprotect', 124 ('NACL_sys_mprotect', 'NaClSysMprotect',
125 ['uint32_t start', 'size_t length', 'int prot']), 125 ['uint32_t start', 'size_t length', 'int prot']),
126 ('NACL_sys_munmap', 'NaClSysMunmap', ['void *start', 'size_t length']), 126 ('NACL_sys_munmap', 'NaClSysMunmap', ['void *start', 'size_t length']),
127 ('NACL_sys_exit', 'NaClSysExit', ['int status']), 127 ('NACL_sys_exit', 'NaClSysExit', ['int status']),
128 ('NACL_sys_getpid', 'NaClSysGetpid', []), 128 ('NACL_sys_getpid', 'NaClSysGetpid', []),
129 ('NACL_sys_thread_exit', 'NaClSysThreadExit', 129 ('NACL_sys_thread_exit', 'NaClSysThreadExit',
130 ['int32_t *stack_flag']), 130 ['int32_t *stack_flag']),
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 'struct nacl_abi_timespec *ts']), 172 'struct nacl_abi_timespec *ts']),
173 ('NACL_sys_imc_socketpair', 'NaClSysImcSocketPair', 173 ('NACL_sys_imc_socketpair', 'NaClSysImcSocketPair',
174 ['uint32_t descs_out']), 174 ['uint32_t descs_out']),
175 ('NACL_sys_sem_create', 'NaClSysSemCreate', ['int32_t init_value']), 175 ('NACL_sys_sem_create', 'NaClSysSemCreate', ['int32_t init_value']),
176 ('NACL_sys_sem_wait', 'NaClSysSemWait', ['int32_t sem_handle']), 176 ('NACL_sys_sem_wait', 'NaClSysSemWait', ['int32_t sem_handle']),
177 ('NACL_sys_sem_post', 'NaClSysSemPost', ['int32_t sem_handle']), 177 ('NACL_sys_sem_post', 'NaClSysSemPost', ['int32_t sem_handle']),
178 ('NACL_sys_sem_get_value', 'NaClSysSemGetValue', 178 ('NACL_sys_sem_get_value', 'NaClSysSemGetValue',
179 ['int32_t sem_handle']), 179 ['int32_t sem_handle']),
180 ('NACL_sys_sched_yield', 'NaClSysSchedYield', []), 180 ('NACL_sys_sched_yield', 'NaClSysSchedYield', []),
181 ('NACL_sys_sysconf', 'NaClSysSysconf', ['int32_t name', 'int32_t *result']), 181 ('NACL_sys_sysconf', 'NaClSysSysconf', ['int32_t name', 'int32_t *result']),
182 ('NACL_sys_dyncode_create', 'NaClTextSysDyncodeCreate', 182 ('NACL_sys_dyncode_create', 'NaClSysDyncodeCreate',
183 ['uint32_t dest', 'uint32_t src', 'uint32_t size']), 183 ['uint32_t dest', 'uint32_t src', 'uint32_t size']),
184 ('NACL_sys_dyncode_modify', 'NaClTextSysDyncodeModify', 184 ('NACL_sys_dyncode_modify', 'NaClSysDyncodeModify',
185 ['uint32_t dest', 'uint32_t src', 'uint32_t size']), 185 ['uint32_t dest', 'uint32_t src', 'uint32_t size']),
186 ('NACL_sys_dyncode_delete', 'NaClTextSysDyncodeDelete', 186 ('NACL_sys_dyncode_delete', 'NaClSysDyncodeDelete',
187 ['uint32_t dest', 'uint32_t size']), 187 ['uint32_t dest', 'uint32_t size']),
188 ('NACL_sys_second_tls_set', 'NaClSysSecondTlsSet', 188 ('NACL_sys_second_tls_set', 'NaClSysSecondTlsSet',
189 ['uint32_t new_value']), 189 ['uint32_t new_value']),
190 ('NACL_sys_second_tls_get', 'NaClSysSecondTlsGet', []), 190 ('NACL_sys_second_tls_get', 'NaClSysSecondTlsGet', []),
191 ('NACL_sys_exception_handler', 'NaClSysExceptionHandler', 191 ('NACL_sys_exception_handler', 'NaClSysExceptionHandler',
192 ['uint32_t handler_addr', 'uint32_t old_handler']), 192 ['uint32_t handler_addr', 'uint32_t old_handler']),
193 ('NACL_sys_exception_stack', 'NaClSysExceptionStack', 193 ('NACL_sys_exception_stack', 'NaClSysExceptionStack',
194 ['uint32_t stack_addr', 'uint32_t stack_size']), 194 ['uint32_t stack_addr', 'uint32_t stack_size']),
195 ('NACL_sys_exception_clear_flag', 'NaClSysExceptionClearFlag', []), 195 ('NACL_sys_exception_clear_flag', 'NaClSysExceptionClearFlag', []),
196 ('NACL_sys_test_infoleak', 'NaClSysTestInfoLeak', []), 196 ('NACL_sys_test_infoleak', 'NaClSysTestInfoLeak', []),
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 subarch = val 322 subarch = val
323 else: 323 else:
324 raise Exception('Unknown option: %s' % opt) 324 raise Exception('Unknown option: %s' % opt)
325 325
326 if subarch != '': 326 if subarch != '':
327 arch = arch + '-' + subarch 327 arch = arch + '-' + subarch
328 328
329 if not ARG_REGISTERS.has_key(arch): 329 if not ARG_REGISTERS.has_key(arch):
330 raise Exception() 330 raise Exception()
331 331
332 # Check naming consistency.
333 for syscall_number, func_name, alist in SYSCALL_LIST:
334 assert syscall_number.startswith('NACL_sys_'), syscall_number
335 name1 = syscall_number[len('NACL_sys_'):].replace('_', '')
336 assert func_name.startswith('NaClSys'), func_name
337 name2 = func_name[len('NaClSys'):].lower()
338 assert name1 == name2, '%r != %r' % (name1, name2)
339
332 data = input_src.read() 340 data = input_src.read()
333 protos = SYSCALL_LIST 341 protos = SYSCALL_LIST
334 print >>output_dst, data 342 print >>output_dst, data
335 PrintImplSkel(arch, protos, output_dst) 343 PrintImplSkel(arch, protos, output_dst)
336 PrintSyscallTableInitializer(protos, output_dst) 344 PrintSyscallTableInitializer(protos, output_dst)
337 345
338 return 0 346 return 0
339 347
340 348
341 if __name__ == '__main__': 349 if __name__ == '__main__':
342 sys.exit(main(sys.argv)) 350 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « src/trusted/service_runtime/nacl_syscall_common.c ('k') | src/trusted/service_runtime/nacl_text.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698