[MIPS64] Add syscall related files

Change-Id: I2f5d05df0e767538a6fe467ca0a2386325f8b71f
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Raghu Gandham <raghu.gandham@imgtec.com>
Signed-off-by: Duane Sand <duane.sand@imgtec.com>
diff --git a/libc/tools/bionic_utils.py b/libc/tools/bionic_utils.py
index 88ddd55..def04a6 100644
--- a/libc/tools/bionic_utils.py
+++ b/libc/tools/bionic_utils.py
@@ -2,7 +2,7 @@
 
 import sys, os, commands, string
 
-all_arches = [ "arm", "arm64", "mips", "x86", "x86_64" ]
+all_arches = [ "arm", "arm64", "mips", "mips64", "x86", "x86_64" ]
 
 # basic debugging trace support
 # call D_setlevel to set the verbosity level
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index cea3508..54b8dbc 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -145,6 +145,44 @@
 
 
 #
+# MIPS64 assembler templates for each syscall stub
+#
+
+mips64_call = "/* " + warning + " */\n" + \
+"""
+#include <asm/unistd.h>
+#include <machine/asm.h>
+#include <machine/regdef.h>
+    .text
+    .globl %(func)s
+    .align 4
+    .ent %(func)s
+
+%(func)s:
+    .set push
+    .set noreorder
+    li v0, %(__NR_name)s
+    syscall
+    bnez a3, 1f
+    move a0, v0
+    j ra
+    nop
+1:
+    move t0, ra
+    bal     2f
+    nop
+2:
+    .cpsetup ra, t1, 2b
+    LA t9,__set_errno
+    .cpreturn
+    j t9
+    move ra, t0
+    .set pop
+    .end %(func)s
+"""
+
+
+#
 # x86 assembler templates for each syscall stub
 #
 
@@ -288,6 +326,10 @@
     return mips_call % syscall
 
 
+def mips64_genstub(syscall):
+    return mips64_call % syscall
+
+
 def x86_genstub(syscall):
     result     = syscall_stub_header % syscall
 
@@ -396,6 +438,9 @@
             if syscall.has_key("mips"):
                 syscall["asm-mips"] = add_footer(32, mips_genstub(syscall), syscall)
 
+            if syscall.has_key("mips64"):
+                syscall["asm-mips64"] = add_footer(64, mips64_genstub(syscall), syscall)
+
             if syscall.has_key("x86_64"):
                 syscall["asm-x86_64"] = add_footer(64, x86_64_genstub(syscall), syscall)