2003-02-03 Guido Guenther * sysdeps/unix/sysv/linux/mips/sysdep.h: (SYSCALL_ERROR_HANDLER, PSEUDO, PSEUDO_END) [__PIC__]: define * sysdeps/unix/sysv/linux/mips/sysdep.h: remove $3, $25 from __SYSCALL_CLOBBERS 2003-02-03 Guido Guenther * linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h: cleaner stack layout, use SYSCALL_ERROR_HANDLER * linuxthreads/sysdeps/unix/sysv/linux/mips/Makefile: no need to pull in sysdep.S anymore, deleted. Index: sysdeps/unix/sysv/linux/mips/sysdep.h =================================================================== RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/sysdep.h,v retrieving revision 1.4 diff -u -u -r1.4 sysdep.h --- sysdeps/unix/sysv/linux/mips/sysdep.h 27 Jan 2003 20:15:03 -0000 1.4 +++ sysdeps/unix/sysv/linux/mips/sysdep.h 3 Feb 2003 21:02:04 -0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. +/* Copyright (C) 2000,01,02,03 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 @@ -35,11 +35,51 @@ #ifdef __ASSEMBLER__ -/* We don't want the label for the error handler to be visible in the symbol - table when we define it here. */ #ifdef __PIC__ -# define SYSCALL_ERROR_LABEL 99b -#endif +# define SYSCALL_ERROR_LABEL 0f + +#undef PSEUDO +#define PSEUDO(name, syscall_name, args) \ + ENTRY(name) \ + .set noreorder; \ + .cpload t9; \ + li v0, SYS_ify(syscall_name); \ + syscall; \ + .set reorder; \ + bne a3, zero, SYSCALL_ERROR_LABEL; \ + syse1: + +#undef PSEUDO_END +#define PSEUDO_END(name) \ + SYSCALL_ERROR_HANDLER; \ + END (name) + +#if defined _LIBC_REENTRANT +# define SYSCALL_ERROR_HANDLER \ +0: \ + subu sp, 32; \ + .cprestore 16; \ + sw v0, 20(sp); \ + sw ra, 24(sp); \ + jal __errno_location; \ + /* store error value */ \ + lw t0, 20(sp); \ + sw t0, 0(v0); \ + lw ra, 24(sp); \ + addiu sp, 32; \ + /* And just kick back a -1. */ \ + li v0, -1; \ + j ra +#else /* ! _LIBC_REENTRANT. */ +# define SYSCALL_ERROR_HANDLER \ +0: \ + /* Store it in errno... */ \ + sw v0, errno; \ + /* And just kick back a -1. */ \ + li v0, -1; \ + j ra +#endif /* ! _LIBC_REENTRANT */ +#endif /* PIC */ #else /* ! __ASSEMBLER__ */ @@ -68,6 +108,8 @@ #undef INTERNAL_SYSCALL #define INTERNAL_SYSCALL(name, err, nr, args...) internal_syscall##nr(name, err, args) +#define __SYSCALL_CLOBBERS "$1", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24" + #define internal_syscall0(name, err, dummy...) \ ({ \ long _sys_result; \ @@ -275,8 +317,6 @@ _sys_result; \ }) -#define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25" - -#endif /* __ASSEMBLER__ */ +#endif /* ! __ASSEMBLER__ */ #endif /* linux/mips/sysdep.h */ Index: linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h =================================================================== RCS file: /cvs/glibc/libc/linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h,v retrieving revision 1.1 diff -u -u -r1.1 sysdep-cancel.h --- linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h 27 Jan 2003 18:56:29 -0000 1.1 +++ linuxthreads/sysdeps/unix/sysv/linux/mips/sysdep-cancel.h 3 Feb 2003 20:44:03 -0000 @@ -27,9 +27,6 @@ #ifdef __PIC__ # undef PSEUDO # define PSEUDO(name, syscall_name, args) \ - .align 2; \ - 99: la t9,__syscall_error; \ - jr t9; \ ENTRY (name) \ .set noreorder; \ .cpload t9; \ @@ -44,25 +41,25 @@ ret; \ Lpseudo_cancel: \ SAVESTK_##args; \ - sw ra, 28(sp); \ - sw gp, 32(sp); \ + sw gp, 28(sp); \ + sw ra, 32(sp); \ PUSHARGS_##args; /* save syscall args */ \ CENABLE; \ - lw gp, 32(sp); \ - sw v0, 44(sp); /* save mask */ \ + lw gp, 28(sp); \ + sw v0, 36(sp); /* save mask */ \ POPARGS_##args; /* restore syscall args */ \ .set noreorder; \ li v0, SYS_ify (syscall_name); \ syscall; \ .set reorder; \ - sw v0, 36(sp); /* save syscall result */ \ - sw a3, 40(sp); /* save syscall error flag */ \ - lw a0, 44(sp); /* pass mask as arg1 */ \ + sw v0, 40(sp); /* save syscall result */ \ + sw a3, 44(sp); /* save syscall error flag */ \ + lw a0, 36(sp); /* pass mask as arg1 */ \ CDISABLE; \ - lw gp, 32(sp); \ - lw v0, 36(sp); /* restore syscall result */ \ - lw a3, 40(sp); /* restore syscall error flag */ \ - lw ra, 28(sp); /* restore return address */ \ + lw gp, 28(sp); \ + lw v0, 40(sp); /* restore syscall result */ \ + lw a3, 44(sp); /* restore syscall error flag */ \ + lw ra, 32(sp); /* restore return address */ \ RESTORESTK; \ bne a3, zero, SYSCALL_ERROR_LABEL; \ Lpseudo_end: Index: linuxthreads/sysdeps/unix/sysv/linux/mips/Makefile =================================================================== RCS file: /cvs/glibc/libc/linuxthreads/sysdeps/unix/sysv/linux/mips/Makefile,v retrieving revision 1.1 diff -u -r1.1 Makefile --- linuxthreads/sysdeps/unix/sysv/linux/mips/Makefile 27 Jan 2003 18:57:22 -0000 1.1 +++ linuxthreads/sysdeps/unix/sysv/linux/mips/Makefile 18 Mar 2003 00:45:29 -0000 @@ -1,2 +0,0 @@ -# pull in __syscall_error routine -libpthread-routines += sysdep