Remove dead code from gensyscalls.py.

Change-Id: I0df69f8fd990f829ccbfcd5123c17b523d5a4d45
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index a39b63b..5e519de 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -10,12 +10,6 @@
 
 from bionic_utils import *
 
-# set this to 1 if you want to generate thumb stubs
-gen_thumb_stubs = 0
-
-# set this to 1 if you want to generate ARM EABI stubs
-gen_eabi_stubs = 1
-
 # get the root Bionic directory, simply this script's dirname
 #
 bionic_root = find_bionic_root()
@@ -32,7 +26,7 @@
 bionic_temp = "/tmp/bionic_gensyscalls/"
 
 # all architectures, update as you see fit
-all_archs = [ "arm", "x86", "mips" ]
+all_archs = [ "arm", "mips", "x86" ]
 
 def make_dir( path ):
     path = os.path.abspath(path)
@@ -47,6 +41,7 @@
     make_dir(dir)
     return open( bionic_temp + relpath, "w" )
 
+#
 # x86 assembler templates for each syscall stub
 #
 
@@ -75,8 +70,10 @@
 END(%(fname)s)
 """
 
+#
 # ARM assembler templates for each syscall stub
 #
+
 arm_header = """/* autogenerated by gensyscalls.py */
 #include <machine/asm.h>
 #include <sys/linux-syscalls.h>
@@ -84,29 +81,6 @@
 ENTRY(%(fname)s)
 """
 
-arm_footer = """\
-END(%(fname)s)
-"""
-
-arm_call_default = arm_header + """\
-    swi   #%(idname)s
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
-""" + arm_footer
-
-arm_call_long = arm_header + """\
-    .save   {r4, r5, lr}
-    stmfd   sp!, {r4, r5, lr}
-    ldr     r4, [sp, #12]
-    ldr     r5, [sp, #16]
-    swi     # %(idname)s
-    ldmfd   sp!, {r4, r5, lr}
-    movs    r0, r0
-    bxpl    lr
-    b       __set_syscall_errno
-""" + arm_footer
-
 arm_eabi_call_default = arm_header + """\
     mov     ip, r7
     ldr     r7, =%(idname)s
@@ -115,7 +89,8 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-""" + arm_footer
+END(%(fname)s)
+"""
 
 arm_eabi_call_long = arm_header + """\
     mov     ip, sp
@@ -128,61 +103,13 @@
     movs    r0, r0
     bxpl    lr
     b       __set_syscall_errno
-""" + arm_footer
+END(%(fname)s)
+"""
 
-# ARM thumb assembler templates for each syscall stub
 #
-thumb_header = """/* autogenerated by gensyscalls.py */
-    .text
-    .type %(fname)s, #function
-    .globl %(fname)s
-    .align 4
-    .thumb_func
-    .fnstart
-
-#define  __thumb__
-#include <sys/linux-syscalls.h>
-
-
-%(fname)s:
-"""
-
-thumb_call_default = thumb_header + """\
-    .save   {r7,lr}
-    push    {r7,lr}
-    ldr     r7, =%(idname)s
-    swi     #0
-    tst     r0, r0
-    bmi     1f
-    pop     {r7,pc}
-1:
-    neg     r0, r0
-    ldr     r1, =__set_errno
-    blx     r1
-    pop     {r7,pc}
-    .fnend
-"""
-
-thumb_call_long = thumb_header + """\
-    .save  {r4,r5,r7,lr}
-    push   {r4,r5,r7,lr}
-    ldr    r4, [sp,#16]
-    ldr    r5, [sp,#20]
-    ldr    r7, =%(idname)s
-    swi    #0
-    tst    r0, r0
-    bmi    1f
-    pop    {r4,r5,r7,pc}
-1:
-    neg    r0, r0
-    ldr    r1, =__set_errno
-    blx    r1
-    pop    {r4,r5,r7,pc}
-    .fnend
-"""
-
 # mips assembler templates for each syscall stub
 #
+
 mips_call = """/* autogenerated by gensyscalls.py */
 #include <sys/linux-syscalls.h>
     .text
@@ -229,7 +156,7 @@
 
 def count_arm_param_registers(params):
     """This function is used to count the number of register used
-       to pass parameters when invoking a thumb or ARM system call.
+       to pass parameters when invoking an ARM system call.
        This is because the ARM EABI mandates that 64-bit quantities
        must be passed in an even+odd register pair. So, for example,
        something like:
@@ -326,15 +253,6 @@
         result += x86_return % t
         return result
 
-    def arm_genstub(self,fname, flags, idname):
-        t = { "fname"  : fname,
-              "idname" : idname }
-        if flags:
-            numargs = int(flags)
-            if numargs > 4:
-                return arm_call_long % t
-        return arm_call_default % t
-
 
     def arm_eabi_genstub(self,fname, flags, idname):
         t = { "fname"  : fname,
@@ -346,15 +264,6 @@
         return arm_eabi_call_default % t
 
 
-    def thumb_genstub(self,fname, flags, idname):
-        t = { "fname"  : fname,
-              "idname" : idname }
-        if flags:
-            numargs = int(flags)
-            if numargs > 4:
-                return thumb_call_long % t
-        return thumb_call_default % t
-
     def mips_genstub(self,fname, idname):
         t = { "fname"  : fname,
               "idname" : idname }
@@ -373,13 +282,7 @@
 
             if t["common"] >= 0 or t["armid"] >= 0:
                 num_regs = count_arm_param_registers(syscall_params)
-                if gen_thumb_stubs:
-                    t["asm-thumb"] = self.thumb_genstub(syscall_func,num_regs,"__NR_"+syscall_name)
-                else:
-                    if gen_eabi_stubs:
-                        t["asm-arm"]   = self.arm_eabi_genstub(syscall_func,num_regs,"__NR_"+syscall_name)
-                    else:
-                        t["asm-arm"]   = self.arm_genstub(syscall_func,num_regs,"__NR_"+syscall_name)
+                t["asm-arm"] = self.arm_eabi_genstub(syscall_func,num_regs,"__NR_"+syscall_name)
 
             if t["common"] >= 0 or t["x86id"] >= 0:
                 num_regs = count_generic_param_registers(syscall_params)
@@ -391,6 +294,7 @@
                 E("cid for dispatch syscalls is only supported for x86 in "
                   "'%s'" % syscall_name)
                 return
+
             if t["common"] >= 0 or t["mipsid"] >= 0:
                 t["asm-mips"] = self.mips_genstub(syscall_func,"__NR_"+syscall_name)
 
@@ -464,7 +368,7 @@
         fp.write( "# auto-generated by gensyscalls.py, do not touch\n" )
         fp.write( "syscall_src := \n" )
         arch_test = {
-            "arm": lambda x: x.has_key("asm-arm") or x.has_key("asm-thumb"),
+            "arm": lambda x: x.has_key("asm-arm"),
             "x86": lambda x: x.has_key("asm-x86"),
             "mips": lambda x: x.has_key("asm-mips")
         }
@@ -488,14 +392,6 @@
                 fp.close()
                 self.new_stubs.append( fname )
 
-            if sc.has_key("asm-thumb") and 'arm' in all_archs:
-                fname = "arch-arm/syscalls/%s.S" % sc["func"]
-                D2( ">>> generating "+fname )
-                fp = create_file( fname )
-                fp.write(sc["asm-thumb"])
-                fp.close()
-                self.new_stubs.append( fname )
-
             if sc.has_key("asm-x86") and 'x86' in all_archs:
                 fname = "arch-x86/syscalls/%s.S" % sc["func"]
                 D2( ">>> generating "+fname )