remove obsolete SuperH support

We don't have a toolchain anymore, we don't have working original
kernel headers, and nobody is maintaining this so there is really
no point in keeping this here. Details of the patch:

- removed code paths from Android.mk files related to the SuperH
  architecture ("sh")

- removed libc/arch-sh, linker/arch-sh, libc/kernel/arch-sh

- simplified libc/SYSCALLS.TXT

- simplified the scripts in libc/tools/ and libc/kernel/tools

Change-Id: I26b0e1422bdc347489e4573e2fbec0e402f75560

Signed-off-by: David 'Digit' Turner <digit@android.com>
diff --git a/libc/tools/bionic_utils.py b/libc/tools/bionic_utils.py
index e7c8c2d..0bc947b 100644
--- a/libc/tools/bionic_utils.py
+++ b/libc/tools/bionic_utils.py
@@ -240,7 +240,6 @@
         if number == "stub":
             syscall_id  = -1
             syscall_id2 = -1
-            syscall_id3 = -1
         else:
             try:
                 if number[0] == '#':
@@ -248,12 +247,8 @@
                 numbers = string.split(number,',')
                 syscall_id  = int(numbers[0])
                 syscall_id2 = syscall_id
-                syscall_id3 = syscall_id
                 if len(numbers) > 1:
                     syscall_id2 = int(numbers[1])
-                    syscall_id3 = syscall_id2
-                if len(numbers) > 2:
-                    syscall_id3 = int(numbers[2])
             except:
                 E("invalid syscall number in '%s'" % line)
                 return
@@ -261,13 +256,12 @@
 		global verbose
         if verbose >= 2:
             if call_id < 0:
-                print "%s: %d,%d,%d" % (syscall_name, syscall_id, syscall_id2, syscall_id3)
+                print "%s: %d,%d" % (syscall_name, syscall_id, syscall_id2)
             else:
-                print "%s(%d): %d,%d,%d" % (syscall_name, call_id, syscall_id, syscall_id2, syscall_id3)
+                print "%s(%d): %d,%d" % (syscall_name, call_id, syscall_id, syscall_id2)
 
         t = { "id"     : syscall_id,
               "id2"    : syscall_id2,
-              "id3"    : syscall_id3,
               "cid"    : call_id,
               "name"   : syscall_name,
               "func"   : syscall_func,
diff --git a/libc/tools/checksyscalls.py b/libc/tools/checksyscalls.py
index 1b922a3..2c563d7 100755
--- a/libc/tools/checksyscalls.py
+++ b/libc/tools/checksyscalls.py
@@ -118,7 +118,6 @@
 
 arm_dict = {}
 x86_dict = {}
-superh_dict = {}
 
 # remove trailing slash from the linux_root, if any
 if linux_root[-1] == '/':
@@ -142,15 +141,8 @@
         print "maybe using a different set of kernel headers might help."
         sys.exit(1)
 
-superh_unistd = find_arch_header(linux_root, "sh", "unistd_32.h")
-if not superh_unistd:
-    print "WEIRD: Could not locate the SuperH unistd.h kernel header file,"
-    print "maybe using a different set of kernel headers might help."
-    sys.exit(1)
-
 process_header( arm_unistd, arm_dict )
 process_header( x86_unistd, x86_dict )
-process_header( superh_unistd, superh_dict )
 
 # now perform the comparison
 errors = 0
@@ -174,7 +166,6 @@
 
 errors += check_syscalls("arm", "id", arm_dict)
 errors += check_syscalls("x86", "id2", x86_dict)
-errors += check_syscalls("superh", "id3", superh_dict)
 
 if errors == 0:
     print "congratulations, everything's fine !!"
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index c188e04..bed9445 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -31,7 +31,7 @@
 bionic_temp = "/tmp/bionic_gensyscalls/"
 
 # all architectures, update as you see fit
-all_archs = [ "arm", "x86", "sh" ]
+all_archs = [ "arm", "x86" ]
 
 def make_dir( path ):
     if not os.path.exists(path):
@@ -183,63 +183,6 @@
     .fnend
 """
 
-# SuperH assembler templates for each syscall stub
-#
-superh_header = """/* autogenerated by gensyscalls.py */
-#include <sys/linux-syscalls.h>
-
-    .text
-    .type %(fname)s, @function
-    .globl %(fname)s
-    .align 4
-
-%(fname)s:
-"""
-
-superh_call_default = """
-    /* invoke trap */
-    mov.l   0f, r3  /* trap num */
-    trapa   #(%(numargs)s + 0x10)
-
-    /* check return value */
-    cmp/pz  r0
-    bt      %(idname)s_end
-
-    /* keep error number */
-    sts.l   pr, @-r15
-    mov.l   1f, r1
-    jsr     @r1
-    mov     r0, r4
-    lds.l   @r15+, pr
-
-%(idname)s_end:
-    rts
-    nop
-
-    .align  2
-0:  .long   %(idname)s
-1:  .long   __set_syscall_errno
-"""
-
-superh_5args_header = """
-    /* get ready for additonal arg */
-    mov.l   @r15, r0
-"""
-
-superh_6args_header = """
-    /* get ready for additonal arg */
-    mov.l   @r15, r0
-    mov.l   @(4, r15), r1
-"""
-
-superh_7args_header = """
-    /* get ready for additonal arg */
-    mov.l   @r15, r0
-    mov.l   @(4, r15), r1
-    mov.l   @(8, r15), r2
-"""
-
-
 def param_uses_64bits(param):
     """Returns True iff a syscall parameter description corresponds
        to a 64-bit type."""
@@ -437,10 +380,6 @@
                 E("cid for dispatch syscalls is only supported for x86 in "
                   "'%s'" % syscall_name)
                 return
-            if t["id3"] >= 0:
-                num_regs = count_generic_param_registers(syscall_params)
-                t["asm-sh"] = self.superh_genstub(syscall_func,num_regs,"__NR_"+syscall_name)
-
 
 
     def gen_NR_syscall(self,fp,name,id):
@@ -490,20 +429,6 @@
                 gen_syscalls[sc_name] = True
         fp.write( "#endif\n" );
 
-        # all superh-specific syscalls
-        fp.write( "\n#if defined(__SH3__) || defined(__SH4__) \n" );
-        for sc in self.syscalls:
-            sc_id  = sc["id"]
-            sc_id2 = sc["id2"]
-            sc_id3 = sc["id3"]
-            sc_name = sc["name"]
-            if sc_id2 != sc_id3 and sc_id3 >= 0:
-                self.gen_NR_syscall( fp, sc_name, sc_id3 )
-            else:
-                if sc_id != sc_id2 and sc_id2 >= 0:
-                    self.gen_NR_syscall( fp, sc_name, sc_id2 )
-        fp.write( "#endif\n" );
-
         fp.write( "\n#endif\n" )
         fp.write( "\n#endif /* _BIONIC_LINUX_SYSCALLS_H_ */\n" );
         fp.close()
@@ -537,7 +462,6 @@
         arch_test = {
             "arm": lambda x: x.has_key("asm-arm") or x.has_key("asm-thumb"),
             "x86": lambda x: x.has_key("asm-x86"),
-            "sh": lambda x: x.has_key("asm-sh")
         }
 
         for sc in self.syscalls:
@@ -574,14 +498,6 @@
                 fp.close()
                 self.new_stubs.append( fname )
 
-            if sc.has_key("asm-sh"):
-                fname = "arch-sh/syscalls/%s.S" % sc["func"]
-                D2( ">>> generating "+fname )
-                fp = create_file( fname )
-                fp.write(sc["asm-sh"])
-                fp.close()
-                self.new_stubs.append( fname )
-
 
     def  regenerate(self):
         D( "scanning for existing architecture-specific stub files" )