MIPS: The new ABI should be allowed to use r8 and r9 for syscalls.

BUG=linux-syscall-support:7
R=mseaborn@chromium.org, petarj@mips.com

Review URL: https://codereview.chromium.org/389673002

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@31 829466d3-f3f5-3ae4-62ad-de35cf9bba21
diff --git a/linux_syscall_support.h b/linux_syscall_support.h
index 4a3c757..1fe0ae8 100644
--- a/linux_syscall_support.h
+++ b/linux_syscall_support.h
@@ -2371,7 +2371,7 @@
                               *   return -EINVAL;
                               */
 #ifdef __thumb2__
-			     "push  {r7}\n"
+                             "push  {r7}\n"
 #endif
                              "cmp   %2,#0\n"
                              "it    ne\n"
@@ -2429,7 +2429,7 @@
                              "swi 0x0\n"
                            "1:\n"
 #ifdef __thumb2__
-			     "pop {r7}"
+                             "pop {r7}"
 #endif
                              : "=r" (__res)
                              : "i"(-EINVAL),
@@ -2437,7 +2437,7 @@
                                "r"(__ptid), "r"(__tls), "r"(__ctid),
                                "i"(__NR_clone), "i"(__NR_exit)
 #ifdef __thumb2__
-			     : "cc", "lr", "memory");
+                             : "cc", "lr", "memory");
 #else
                              : "cc", "r7", "lr", "memory");
 #endif
@@ -2566,14 +2566,22 @@
     #define LSS_REG(r,a) register unsigned long __r##r __asm__("$"#r) =       \
                                  (unsigned long)(a)
     #undef  LSS_BODY
+    #undef LSS_SYSCALL_CLOBBERS
+    #if _MIPS_SIM == _MIPS_SIM_ABI32
+    #define LSS_SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10",               \
+                                 "$11", "$12", "$13", "$14", "$15",           \
+                                 "$24", "$25", "hi", "lo", "memory"
+    #else
+    #define LSS_SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12",             \
+                                 "$13", "$14", "$15", "$24", "$25",           \
+                                 "hi", "lo", "memory"
+    #endif
     #define LSS_BODY(type,name,r7,...)                                        \
           register unsigned long __v0 __asm__("$2") = __NR_##name;            \
           __asm__ __volatile__ ("syscall\n"                                   \
                                 : "+r"(__v0), r7 (__r7)                       \
                                 : "0"(__v0), ##__VA_ARGS__                    \
-                                : "$8", "$9", "$10", "$11", "$12",            \
-                                  "$13", "$14", "$15", "$24", "$25",          \
-                                  "memory");                                  \
+                                : LSS_SYSCALL_CLOBBERS);                      \
           LSS_RETURN(type, __v0, __r7)
     #undef _syscall0
     #define _syscall0(type, name)                                             \