diff options
Diffstat (limited to 'sysdeps/unix/alpha')
-rw-r--r-- | sysdeps/unix/alpha/sysdep.S | 39 | ||||
-rw-r--r-- | sysdeps/unix/alpha/sysdep.h | 50 |
2 files changed, 72 insertions, 17 deletions
diff --git a/sysdeps/unix/alpha/sysdep.S b/sysdeps/unix/alpha/sysdep.S new file mode 100644 index 0000000000..3e7666ff61 --- /dev/null +++ b/sysdeps/unix/alpha/sysdep.S @@ -0,0 +1,39 @@ +/* Copyright (C) 1993 Free Software Foundation, Inc. + Contributed by Brendan Kehoe (brendan@zen.org). + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <sysdep.h> +#define _ERRNO_H +#include <errnos.h> + + .comm errno, 4 +#ifdef __ELF__ + .type errno, @object +#endif + +LEAF(__syscall_error, 0) + .prologue 1 + + /* Store return value in errno... */ + ldgp gp, 0(t12) + stl v0, errno + + /* And just kick back a -1. */ + ldi v0, -1 + ret + + END(__syscall_error) diff --git a/sysdeps/unix/alpha/sysdep.h b/sysdeps/unix/alpha/sysdep.h index 6fed4a6adf..4b3f9aa5d8 100644 --- a/sysdeps/unix/alpha/sysdep.h +++ b/sysdeps/unix/alpha/sysdep.h @@ -58,25 +58,27 @@ Cambridge, MA 02139, USA. */ .frame sp, 0, ra #endif -/* Note that while it's better structurally, going back to set errno - can make things confusing if you're debugging---it looks like it's jumping - backwards into the previous fn. */ +/* Mark the end of function SYM. */ +#undef END +#define END(sym) .end sym + +/* Note that PSEUDO/PSEUDO_END use label number 1996---do not use a + label of that number between those two macros! */ + #ifdef __STDC__ #define PSEUDO(name, syscall_name, args) \ .globl name; \ .align 3; \ .ent name,0; \ \ -1: br gp, 2f; \ -2: ldgp gp, 0(gp); \ - jmp zero, syscall_error; \ - \ name##: \ - ldi v0, SYS_ify(syscall_name); \ + .frame sp, 0, ra \ + .prologue 1; /* yes, we do use gp */ \ + ldiq v0, SYS_ify(syscall_name); \ .set noat; \ call_pal PAL_callsys; \ .set at; \ - bne a3, 1b; \ + bne a3, 1996f; \ 3: #else #define PSEUDO(name, syscall_name, args) \ @@ -84,21 +86,35 @@ name##: \ .align 3; \ .ent name,0; \ \ -1: br gp, 2f; \ -2: ldgp gp, 0(gp); \ - jmp zero, syscall_error; \ - \ name/**/: \ - ldi v0, SYS_ify(syscall_name); \ + .frame sp, 0, ra \ + .prologue 1; /* yes, we do use gp */ \ + ldiq v0, SYS_ify(syscall_name); \ .set noat; \ call_pal PAL_callsys; \ .set at; \ - bne a3, 1b; \ + bne a3, 1996f; \ 3: #endif -#undef END -#define END(sym) .end sym +#undef PSEUDO_END + +#ifdef PIC +/* When building a shared library, we can use a branch since the text + section of the library is much smaller than 4MB. If we ever break + this assumption, the linker will tell us. */ +# define PSEUDO_END(sym) \ +1996: \ + br zero, __syscall_error; \ + END(sym) +#else +# define PSEUDO_END(sym) \ +1996: \ + br gp, 2f; \ +2: ldgp gp, 0(gp); \ + jmp zero, __syscall_error; \ + END(sym) +#endif #define r0 v0 #define r1 a4 |