summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1994-12-01 08:00:00 +0000
committer <ralf@linux-mips.org>1994-12-01 08:00:00 +0000
commit90ecc248e200fee448001248dde0ca540dd3ef64 (patch)
treea3fe89494ce63b4835f0f9cf5c45e74cde88252b /lib
parent1513ff9b7899ab588401c89db0e99903dbf5f886 (diff)
Import of Linux/MIPS 1.1.68
Diffstat (limited to 'lib')
-rw-r--r--lib/_exit.c12
-rw-r--r--lib/open.c16
2 files changed, 28 insertions, 0 deletions
diff --git a/lib/_exit.c b/lib/_exit.c
index a46f1a2b6..7126235a8 100644
--- a/lib/_exit.c
+++ b/lib/_exit.c
@@ -10,9 +10,21 @@
volatile void _exit(int exit_code)
{
fake_volatile:
+#if defined (__i386__)
__asm__("movl %1,%%ebx\n\t"
"int $0x80"
: /* no outputs */
:"a" (__NR_exit),"g" (exit_code));
+#elif defined (__mips__)
+ __asm__(".set noat\n\t"
+ "move $2,%1\n\t"
+ "li $1,%0\n\t"
+ "syscall\n\t"
+ ".set at"
+ : /* no outputs */
+ : "i" (__NR_exit), "r" (exit_code)
+ : "$1","$2");
+#endif
goto fake_volatile;
}
+
diff --git a/lib/open.c b/lib/open.c
index b69d2b548..9447df993 100644
--- a/lib/open.c
+++ b/lib/open.c
@@ -14,11 +14,27 @@ int open(const char * filename, int flag, ...)
va_list arg;
va_start(arg,flag);
+#if defined (__i386__)
__asm__("movl %2,%%ebx\n\t"
"int $0x80"
:"=a" (res)
:"0" (__NR_open),"g" ((long)(filename)),"c" (flag),
"d" (va_arg(arg,int)));
+#elif defined (__mips__)
+ __asm__(".set noat\n\t"
+ "move $2,%2\n\t"
+ "move $3,%3\n\t"
+ "move $4,%4\n\t"
+ "li $1,%1\n\t"
+ "syscall\n\t"
+ ".set at"
+ :"=r" (res)
+ :"i" (__NR_open),
+ "r" ((long)(filename)),
+ "r" (flag),
+ "r" (va_arg(arg,int))
+ :"$1","$2","$3","$4");
+#endif
if (res>=0)
return res;
errno = -res;