blob: 5e519de79dcfc0f702bb36649ab9b1801ec8631d [file] [log] [blame]
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -07001#!/usr/bin/python
2#
Raghu Gandham1fa0d842012-01-27 17:51:42 -08003# this tool is used to generate the syscall assembler templates
4# to be placed into arch-{arm,x86,mips}/syscalls, as well as the content
5# of arch-{arm,x86,mips}/linux/_syscalls.h
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -07006#
7
The Android Open Source Project4e468ed2008-12-17 18:03:48 -08008import sys, os.path, glob, re, commands, filecmp, shutil
Raghu Gandham1fa0d842012-01-27 17:51:42 -08009import getpass
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070010
11from bionic_utils import *
12
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070013# get the root Bionic directory, simply this script's dirname
14#
15bionic_root = find_bionic_root()
16if not bionic_root:
17 print "could not find the Bionic root directory. aborting"
18 sys.exit(1)
19
20if bionic_root[-1] != '/':
21 bionic_root += "/"
22
23print "bionic_root is %s" % bionic_root
24
25# temp directory where we store all intermediate files
26bionic_temp = "/tmp/bionic_gensyscalls/"
27
28# all architectures, update as you see fit
Elliott Hughescd6780b2013-02-07 14:07:00 -080029all_archs = [ "arm", "mips", "x86" ]
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070030
31def make_dir( path ):
Raghu Gandham1fa0d842012-01-27 17:51:42 -080032 path = os.path.abspath(path)
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070033 if not os.path.exists(path):
34 parent = os.path.dirname(path)
35 if parent:
36 make_dir(parent)
37 os.mkdir(path)
38
39def create_file( relpath ):
40 dir = os.path.dirname( bionic_temp + relpath )
41 make_dir(dir)
42 return open( bionic_temp + relpath, "w" )
43
Elliott Hughescd6780b2013-02-07 14:07:00 -080044#
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070045# x86 assembler templates for each syscall stub
46#
47
48x86_header = """/* autogenerated by gensyscalls.py */
Elliott Hughes7582a9c2013-02-06 17:08:15 -080049#include <machine/asm.h>
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070050#include <sys/linux-syscalls.h>
51
Elliott Hughes7582a9c2013-02-06 17:08:15 -080052ENTRY(%(fname)s)
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070053"""
54
55x86_registers = [ "%ebx", "%ecx", "%edx", "%esi", "%edi", "%ebp" ]
56
57x86_call = """ movl $%(idname)s, %%eax
58 int $0x80
59 cmpl $-129, %%eax
60 jb 1f
61 negl %%eax
62 pushl %%eax
63 call __set_errno
64 addl $4, %%esp
65 orl $-1, %%eax
661:
67"""
68
69x86_return = """ ret
Elliott Hughes7582a9c2013-02-06 17:08:15 -080070END(%(fname)s)
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070071"""
72
Elliott Hughescd6780b2013-02-07 14:07:00 -080073#
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070074# ARM assembler templates for each syscall stub
75#
Elliott Hughescd6780b2013-02-07 14:07:00 -080076
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070077arm_header = """/* autogenerated by gensyscalls.py */
Kenny Rootf540c032011-02-17 10:31:30 -080078#include <machine/asm.h>
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070079#include <sys/linux-syscalls.h>
80
Kenny Rootf540c032011-02-17 10:31:30 -080081ENTRY(%(fname)s)
82"""
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070083
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070084arm_eabi_call_default = arm_header + """\
Matthieu Castetfaa0fdb2013-01-16 14:02:50 +010085 mov ip, r7
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070086 ldr r7, =%(idname)s
87 swi #0
Matthieu Castetfaa0fdb2013-01-16 14:02:50 +010088 mov r7, ip
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070089 movs r0, r0
90 bxpl lr
91 b __set_syscall_errno
Elliott Hughescd6780b2013-02-07 14:07:00 -080092END(%(fname)s)
93"""
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -070094
95arm_eabi_call_long = arm_header + """\
96 mov ip, sp
97 .save {r4, r5, r6, r7}
98 stmfd sp!, {r4, r5, r6, r7}
99 ldmfd ip, {r4, r5, r6}
100 ldr r7, =%(idname)s
101 swi #0
102 ldmfd sp!, {r4, r5, r6, r7}
103 movs r0, r0
104 bxpl lr
105 b __set_syscall_errno
Elliott Hughescd6780b2013-02-07 14:07:00 -0800106END(%(fname)s)
107"""
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700108
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700109#
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800110# mips assembler templates for each syscall stub
111#
Elliott Hughescd6780b2013-02-07 14:07:00 -0800112
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800113mips_call = """/* autogenerated by gensyscalls.py */
114#include <sys/linux-syscalls.h>
115 .text
116 .globl %(fname)s
117 .align 4
118 .ent %(fname)s
119
120%(fname)s:
121 .set noreorder
122 .cpload $t9
123 li $v0, %(idname)s
124 syscall
125 bnez $a3, 1f
126 move $a0, $v0
127 j $ra
128 nop
1291:
130 la $t9,__set_errno
131 j $t9
132 nop
133 .set reorder
134 .end %(fname)s
135"""
136
David 'Digit' Turner95d751f2010-12-16 16:47:14 +0100137def param_uses_64bits(param):
138 """Returns True iff a syscall parameter description corresponds
139 to a 64-bit type."""
140 param = param.strip()
141 # First, check that the param type begins with one of the known
142 # 64-bit types.
143 if not ( \
144 param.startswith("int64_t") or param.startswith("uint64_t") or \
145 param.startswith("loff_t") or param.startswith("off64_t") or \
146 param.startswith("long long") or param.startswith("unsigned long long") or
147 param.startswith("signed long long") ):
148 return False
149
150 # Second, check that there is no pointer type here
151 if param.find("*") >= 0:
152 return False
153
154 # Ok
155 return True
156
157def count_arm_param_registers(params):
158 """This function is used to count the number of register used
Elliott Hughescd6780b2013-02-07 14:07:00 -0800159 to pass parameters when invoking an ARM system call.
David 'Digit' Turner95d751f2010-12-16 16:47:14 +0100160 This is because the ARM EABI mandates that 64-bit quantities
161 must be passed in an even+odd register pair. So, for example,
162 something like:
163
164 foo(int fd, off64_t pos)
165
166 would actually need 4 registers:
167 r0 -> int
168 r1 -> unused
169 r2-r3 -> pos
170 """
171 count = 0
172 for param in params:
173 if param_uses_64bits(param):
174 if (count & 1) != 0:
175 count += 1
176 count += 2
177 else:
178 count += 1
179 return count
180
181def 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
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700190class State:
191 def __init__(self):
192 self.old_stubs = []
193 self.new_stubs = []
194 self.other_files = []
195 self.syscalls = []
196
The Android Open Source Project4e468ed2008-12-17 18:03:48 -0800197 def x86_genstub(self, fname, numparams, idname):
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700198 t = { "fname" : fname,
199 "idname" : idname }
200
201 result = x86_header % t
202 stack_bias = 4
203 for r in range(numparams):
204 result += " pushl " + x86_registers[r] + "\n"
205 stack_bias += 4
206
207 for r in range(numparams):
208 result += " mov %d(%%esp), %s" % (stack_bias+r*4, x86_registers[r]) + "\n"
209
210 result += x86_call % t
211
212 for r in range(numparams):
213 result += " popl " + x86_registers[numparams-r-1] + "\n"
214
Elliott Hughes7582a9c2013-02-06 17:08:15 -0800215 result += x86_return % t
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700216 return result
217
The Android Open Source Project4e468ed2008-12-17 18:03:48 -0800218 def x86_genstub_cid(self, fname, numparams, idname, cid):
219 # We'll ignore numparams here because in reality, if there is a
220 # dispatch call (like a socketcall syscall) there are actually
221 # only 2 arguments to the syscall and 2 regs we have to save:
222 # %ebx <--- Argument 1 - The call id of the needed vectored
223 # syscall (socket, bind, recv, etc)
224 # %ecx <--- Argument 2 - Pointer to the rest of the arguments
225 # from the original function called (socket())
226 t = { "fname" : fname,
227 "idname" : idname }
228
229 result = x86_header % t
230 stack_bias = 4
231
232 # save the regs we need
233 result += " pushl %ebx" + "\n"
234 stack_bias += 4
235 result += " pushl %ecx" + "\n"
236 stack_bias += 4
237
238 # set the call id (%ebx)
239 result += " mov $%d, %%ebx" % (cid) + "\n"
240
241 # set the pointer to the rest of the args into %ecx
242 result += " mov %esp, %ecx" + "\n"
243 result += " addl $%d, %%ecx" % (stack_bias) + "\n"
244
245 # now do the syscall code itself
246 result += x86_call % t
247
248 # now restore the saved regs
249 result += " popl %ecx" + "\n"
250 result += " popl %ebx" + "\n"
251
252 # epilog
Elliott Hughes7582a9c2013-02-06 17:08:15 -0800253 result += x86_return % t
The Android Open Source Project4e468ed2008-12-17 18:03:48 -0800254 return result
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700255
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700256
257 def arm_eabi_genstub(self,fname, flags, idname):
258 t = { "fname" : fname,
259 "idname" : idname }
260 if flags:
261 numargs = int(flags)
262 if numargs > 4:
263 return arm_eabi_call_long % t
264 return arm_eabi_call_default % t
265
266
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800267 def mips_genstub(self,fname, idname):
268 t = { "fname" : fname,
269 "idname" : idname }
270 return mips_call % t
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700271
272 def process_file(self,input):
273 parser = SysCallsTxtParser()
274 parser.parse_file(input)
275 self.syscalls = parser.syscalls
276 parser = None
277
278 for t in self.syscalls:
279 syscall_func = t["func"]
280 syscall_params = t["params"]
281 syscall_name = t["name"]
282
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800283 if t["common"] >= 0 or t["armid"] >= 0:
David 'Digit' Turner95d751f2010-12-16 16:47:14 +0100284 num_regs = count_arm_param_registers(syscall_params)
Elliott Hughescd6780b2013-02-07 14:07:00 -0800285 t["asm-arm"] = self.arm_eabi_genstub(syscall_func,num_regs,"__NR_"+syscall_name)
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700286
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800287 if t["common"] >= 0 or t["x86id"] >= 0:
David 'Digit' Turner95d751f2010-12-16 16:47:14 +0100288 num_regs = count_generic_param_registers(syscall_params)
The Android Open Source Project4e468ed2008-12-17 18:03:48 -0800289 if t["cid"] >= 0:
David 'Digit' Turner95d751f2010-12-16 16:47:14 +0100290 t["asm-x86"] = self.x86_genstub_cid(syscall_func, num_regs, "__NR_"+syscall_name, t["cid"])
The Android Open Source Project4e468ed2008-12-17 18:03:48 -0800291 else:
David 'Digit' Turner95d751f2010-12-16 16:47:14 +0100292 t["asm-x86"] = self.x86_genstub(syscall_func, num_regs, "__NR_"+syscall_name)
The Android Open Source Project4e468ed2008-12-17 18:03:48 -0800293 elif t["cid"] >= 0:
294 E("cid for dispatch syscalls is only supported for x86 in "
295 "'%s'" % syscall_name)
296 return
Elliott Hughescd6780b2013-02-07 14:07:00 -0800297
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800298 if t["common"] >= 0 or t["mipsid"] >= 0:
299 t["asm-mips"] = self.mips_genstub(syscall_func,"__NR_"+syscall_name)
The Android Open Source Project4e468ed2008-12-17 18:03:48 -0800300
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700301
302 def gen_NR_syscall(self,fp,name,id):
303 fp.write( "#define __NR_%-25s (__NR_SYSCALL_BASE + %d)\n" % (name,id) )
304
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800305 # now dump the content of linux-syscalls.h
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700306 def gen_linux_syscalls_h(self):
307 path = "include/sys/linux-syscalls.h"
308 D( "generating "+path )
309 fp = create_file( path )
310 fp.write( "/* auto-generated by gensyscalls.py, do not touch */\n" )
Elliott Hughes19285232012-05-09 16:34:11 -0700311 fp.write( "#ifndef _BIONIC_LINUX_SYSCALLS_H_\n" )
312 fp.write( "#define _BIONIC_LINUX_SYSCALLS_H_\n\n" )
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800313 fp.write( "#if !defined __ASM_ARM_UNISTD_H && !defined __ASM_I386_UNISTD_H && !defined __ASM_MIPS_UNISTD_H\n" )
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700314 fp.write( "#if defined __arm__ && !defined __ARM_EABI__ && !defined __thumb__\n" )
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800315 fp.write( " # define __NR_SYSCALL_BASE 0x900000\n" )
316 fp.write( "#elif defined(__mips__)\n" )
317 fp.write( " # define __NR_SYSCALL_BASE 4000\n" )
318 fp.write( "#else\n" )
319 fp.write( " # define __NR_SYSCALL_BASE 0\n" )
320 fp.write( "#endif\n\n" )
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700321
322 # first, all common syscalls
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800323 for sc in sorted(self.syscalls,key=lambda x:x["common"]):
324 sc_id = sc["common"]
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700325 sc_name = sc["name"]
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800326 if sc_id >= 0:
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700327 self.gen_NR_syscall( fp, sc_name, sc_id )
328
329 # now, all arm-specific syscalls
330 fp.write( "\n#ifdef __arm__\n" );
331 for sc in self.syscalls:
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800332 sc_id = sc["armid"]
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700333 sc_name = sc["name"]
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800334 if sc_id >= 0:
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700335 self.gen_NR_syscall( fp, sc_name, sc_id )
336 fp.write( "#endif\n" );
337
The Android Open Source Project4e468ed2008-12-17 18:03:48 -0800338 gen_syscalls = {}
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700339 # finally, all i386-specific syscalls
340 fp.write( "\n#ifdef __i386__\n" );
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800341 for sc in sorted(self.syscalls,key=lambda x:x["x86id"]):
342 sc_id = sc["x86id"]
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700343 sc_name = sc["name"]
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800344 if sc_id >= 0 and sc_name not in gen_syscalls:
345 self.gen_NR_syscall( fp, sc_name, sc_id )
The Android Open Source Project4e468ed2008-12-17 18:03:48 -0800346 gen_syscalls[sc_name] = True
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700347 fp.write( "#endif\n" );
348
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800349 # all mips-specific syscalls
350 fp.write( "\n#ifdef __mips__\n" );
351 for sc in sorted(self.syscalls,key=lambda x:x["mipsid"]):
352 sc_id = sc["mipsid"]
353 if sc_id >= 0:
354 self.gen_NR_syscall( fp, sc["name"], sc_id )
355 fp.write( "#endif\n" );
356
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700357 fp.write( "\n#endif\n" )
358 fp.write( "\n#endif /* _BIONIC_LINUX_SYSCALLS_H_ */\n" );
359 fp.close()
360 self.other_files.append( path )
361
362
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700363 # now dump the contents of syscalls.mk
The Android Open Source Project4e468ed2008-12-17 18:03:48 -0800364 def gen_arch_syscalls_mk(self, arch):
365 path = "arch-%s/syscalls.mk" % arch
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700366 D( "generating "+path )
367 fp = create_file( path )
368 fp.write( "# auto-generated by gensyscalls.py, do not touch\n" )
369 fp.write( "syscall_src := \n" )
The Android Open Source Project4e468ed2008-12-17 18:03:48 -0800370 arch_test = {
Elliott Hughescd6780b2013-02-07 14:07:00 -0800371 "arm": lambda x: x.has_key("asm-arm"),
Shin-ichiro KAWASAKIce0595d2009-09-01 19:03:06 +0900372 "x86": lambda x: x.has_key("asm-x86"),
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800373 "mips": lambda x: x.has_key("asm-mips")
The Android Open Source Project4e468ed2008-12-17 18:03:48 -0800374 }
375
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700376 for sc in self.syscalls:
The Android Open Source Project4e468ed2008-12-17 18:03:48 -0800377 if arch_test[arch](sc):
378 fp.write("syscall_src += arch-%s/syscalls/%s.S\n" %
379 (arch, sc["func"]))
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700380 fp.close()
381 self.other_files.append( path )
382
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800383
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700384 # now generate each syscall stub
385 def gen_syscall_stubs(self):
386 for sc in self.syscalls:
The Android Open Source Project4e468ed2008-12-17 18:03:48 -0800387 if sc.has_key("asm-arm") and 'arm' in all_archs:
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700388 fname = "arch-arm/syscalls/%s.S" % sc["func"]
David 'Digit' Turnerfc269312010-10-11 22:11:06 +0200389 D2( ">>> generating "+fname )
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700390 fp = create_file( fname )
391 fp.write(sc["asm-arm"])
392 fp.close()
393 self.new_stubs.append( fname )
394
The Android Open Source Project4e468ed2008-12-17 18:03:48 -0800395 if sc.has_key("asm-x86") and 'x86' in all_archs:
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700396 fname = "arch-x86/syscalls/%s.S" % sc["func"]
David 'Digit' Turnerfc269312010-10-11 22:11:06 +0200397 D2( ">>> generating "+fname )
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700398 fp = create_file( fname )
399 fp.write(sc["asm-x86"])
400 fp.close()
401 self.new_stubs.append( fname )
402
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800403 if sc.has_key("asm-mips") and 'mips' in all_archs:
404 fname = "arch-mips/syscalls/%s.S" % sc["func"]
405 D2( ">>> generating "+fname )
406 fp = create_file( fname )
407 fp.write(sc["asm-mips"])
408 fp.close()
409 self.new_stubs.append( fname )
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700410
411 def regenerate(self):
412 D( "scanning for existing architecture-specific stub files" )
413
414 bionic_root_len = len(bionic_root)
415
416 for arch in all_archs:
417 arch_path = bionic_root + "arch-" + arch
418 D( "scanning " + arch_path )
419 files = glob.glob( arch_path + "/syscalls/*.S" )
420 for f in files:
421 self.old_stubs.append( f[bionic_root_len:] )
422
423 D( "found %d stub files" % len(self.old_stubs) )
424
425 if not os.path.exists( bionic_temp ):
426 D( "creating %s" % bionic_temp )
Raghu Gandham1fa0d842012-01-27 17:51:42 -0800427 make_dir( bionic_temp )
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700428
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700429 D( "re-generating stubs and support files" )
430
431 self.gen_linux_syscalls_h()
The Android Open Source Project4e468ed2008-12-17 18:03:48 -0800432 for arch in all_archs:
433 self.gen_arch_syscalls_mk(arch)
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700434 self.gen_syscall_stubs()
435
436 D( "comparing files" )
437 adds = []
438 edits = []
439
440 for stub in self.new_stubs + self.other_files:
441 if not os.path.exists( bionic_root + stub ):
David 'Digit' Turnerfc269312010-10-11 22:11:06 +0200442 # new file, git add it
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700443 D( "new file: " + stub)
444 adds.append( bionic_root + stub )
445 shutil.copyfile( bionic_temp + stub, bionic_root + stub )
446
447 elif not filecmp.cmp( bionic_temp + stub, bionic_root + stub ):
448 D( "changed file: " + stub)
449 edits.append( stub )
450
451 deletes = []
452 for stub in self.old_stubs:
453 if not stub in self.new_stubs:
454 D( "deleted file: " + stub)
455 deletes.append( bionic_root + stub )
456
457
458 if adds:
David 'Digit' Turnerfc269312010-10-11 22:11:06 +0200459 commands.getoutput("git add " + " ".join(adds))
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700460 if deletes:
David 'Digit' Turnerfc269312010-10-11 22:11:06 +0200461 commands.getoutput("git rm " + " ".join(deletes))
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700462 if edits:
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700463 for file in edits:
464 shutil.copyfile( bionic_temp + file, bionic_root + file )
David 'Digit' Turnerfc269312010-10-11 22:11:06 +0200465 commands.getoutput("git add " +
466 " ".join((bionic_root + file) for file in edits))
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700467
David 'Digit' Turnerfc269312010-10-11 22:11:06 +0200468 commands.getoutput("git add %s%s" % (bionic_root,"SYSCALLS.TXT"))
469
470 if (not adds) and (not deletes) and (not edits):
471 D("no changes detected!")
472 else:
473 D("ready to go!!")
The Android Open Source Projecta27d2ba2008-10-21 07:00:00 -0700474
475D_setlevel(1)
476
477state = State()
478state.process_file(bionic_root+"SYSCALLS.TXT")
479state.regenerate()