diff options
Diffstat (limited to 'lib/open.c')
-rw-r--r-- | lib/open.c | 16 |
1 files changed, 16 insertions, 0 deletions
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; |