From: Andreas Jaeger Date: Fri, 16 Sep 2005 12:20:48 +0000 (+0000) Subject: 2005-09-16 Maciej W. Rozycki X-Git-Tag: upstream/2.20~3636^2~1028 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ea78d8fa650ea6cc0d911d99bbd56a44e85296d9;p=platform%2Fupstream%2Flinaro-glibc.git 2005-09-16 Maciej W. Rozycki [BZ #933] * sysdeps/unix/sysv/linux/mips/brk.c (__brk): Load the number of the syscall immediately before invocation. * sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S (__ioctl): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/syscall.S (syscall): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S (__ioctl): Use macros to handle GP. * sysdeps/unix/sysv/linux/mips/mips64/syscall.S (syscall): Likewise. Update inaccurate comments. --- diff --git a/sysdeps/unix/sysv/linux/mips/brk.c b/sysdeps/unix/sysv/linux/mips/brk.c index 4be88a9..5c31bec 100644 --- a/sysdeps/unix/sysv/linux/mips/brk.c +++ b/sysdeps/unix/sysv/linux/mips/brk.c @@ -1,5 +1,5 @@ /* brk system call for Linux/MIPS. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -37,9 +37,10 @@ __brk (void *addr) register long int res __asm__ ("$2"); asm ("move\t$4,%2\n\t" + "li\t%0,%1\n\t" "syscall" /* Perform the system call. */ : "=r" (res) - : "0" (SYS_ify (brk)), "r" (addr) + : "I" (SYS_ify (brk)), "r" (addr) : "$4", "$7"); newbrk = (void *) res; } diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S b/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S index 7b14089..e4b4f00 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S @@ -1,4 +1,4 @@ -/* Copyright 2003 Free Software Foundation, Inc. +/* Copyright 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,16 +25,16 @@ .text ENTRY (__ioctl) + sll a1, a1, 0 li v0, __NR_ioctl - sll a1,a1,0 syscall /* Do the system call. */ bne a3, zero, L(error) ret L(error): - .cpsetup t9, a0, __ioctl - PTR_LA t9,__syscall_error - .cprestore + SETUP_GP64 (a0, __ioctl) + PTR_LA t9, __syscall_error + RESTORE_GP64 jr t9 PSEUDO_END (__ioctl) diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscall.S b/sysdeps/unix/sysv/linux/mips/mips64/syscall.S index ea5bf49..3c6aaac 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/syscall.S +++ b/sysdeps/unix/sysv/linux/mips/mips64/syscall.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,17 +20,20 @@ #include -/* Please consult the file sysdeps/unix/sysv/linux/x86-64/sysdep.h for - more information about the value -4095 used below. */ +/* Usage: + long syscall (syscall_number, arg1, arg2, arg3, arg4, arg5, arg6, arg7) -/* Usage: long syscall (syscall_number, arg1, arg2, arg3, arg4, arg5) - We need to do some arg shifting, the syscall_number will be in - rax. */ + We need to do some arg shifting, syscall_number will be in v0. */ .text -ENTRY (syscall) - move v0, a0 /* Syscall number -> v0 */ +NESTED (syscall, SZREG, ra) + .mask 0x00010000, -SZREG + .fmask 0x00000000, 0 + PTR_ADDIU sp, -SZREG + REG_S s0, (sp) + + move s0, a0 move a0, a1 /* shift arg1 - arg7. */ move a1, a2 move a2, a3 @@ -39,15 +42,19 @@ ENTRY (syscall) move a5, a6 move a6, a7 + move v0, s0 /* Syscall number -> v0 */ syscall /* Do the system call. */ + + REG_L s0, (sp) + PTR_ADDIU sp, SZREG bne a3, zero, L(error) ret L(error): - .cpsetup t9, a0, syscall - PTR_LA t9,__syscall_error - .cprestore + SETUP_GP64 (a0, syscall) + PTR_LA t9, __syscall_error + RESTORE_GP64 jr t9 -PSEUDO_END (syscall) +END (syscall)