From ea78d8fa650ea6cc0d911d99bbd56a44e85296d9 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Fri, 16 Sep 2005 12:20:48 +0000 Subject: [PATCH] 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. --- sysdeps/unix/sysv/linux/mips/brk.c | 5 +-- .../unix/sysv/linux/mips/mips64/n64/ioctl.S | 10 +++--- sysdeps/unix/sysv/linux/mips/mips64/syscall.S | 31 ++++++++++++------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/sysdeps/unix/sysv/linux/mips/brk.c b/sysdeps/unix/sysv/linux/mips/brk.c index 4be88a9c5f..5c31bec5ee 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 7b14089bcb..e4b4f00a8c 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 ea5bf491d6..3c6aaac810 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)