1/* Copyright (C) 1992, 1993, 1994, 1997, 1998, 1999, 2000, 2002, 2003 2 Free Software Foundation, Inc. 3 This file is part of the GNU C Library. 4 Contributed by Brendan Kehoe (brendan@zen.org). 5 6 The GNU C Library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public 8 License as published by the Free Software Foundation; either 9 version 2.1 of the License, or (at your option) any later version. 10 11 The GNU C Library is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Lesser General Public License for more details. 15 16 You should have received a copy of the GNU Lesser General Public 17 License along with the GNU C Library; if not, see 18 <http://www.gnu.org/licenses/>. */ 19 20#include <sys/asm.h> 21#include <sysdep.h> 22#include <bits/errno.h> 23 24#ifdef _LIBC_REENTRANT 25 26LOCALSZ= 3 27FRAMESZ= (((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK 28RAOFF= FRAMESZ-(1*SZREG) 29GPOFF= FRAMESZ-(2*SZREG) 30V0OFF= FRAMESZ-(3*SZREG) 31 32ENTRY(__syscall_error) 33#ifdef __PIC__ 34 .set noat 35 SETUP_GPX (AT) 36 .set at 37#endif 38 PTR_SUBU sp, FRAMESZ 39 .set noat 40 SETUP_GPX64(GPOFF,AT) 41 .set at 42#ifdef __PIC__ 43 SAVE_GP(GPOFF) 44#endif 45 REG_S a0, V0OFF(sp) 46 REG_S ra, RAOFF(sp) 47 48 /* Find our per-thread errno address */ 49 jal __errno_location 50 51 /* Store the error value. */ 52 REG_L t0, V0OFF(sp) 53 sw t0, 0(v0) 54 55 /* And just kick back a -1. */ 56 REG_L ra, RAOFF(sp) 57 RESTORE_GP64 58 PTR_ADDU sp, FRAMESZ 59 li v0, -1 60 j ra 61 END(__syscall_error) 62 63#else /* __LIBC_REENTRANT */ 64 65 66ENTRY(__syscall_error) 67#ifdef __PIC__ 68 .set noat 69 SETUP_GPX (AT) 70 .set at 71#endif 72 SETUP_GPX64 (t9, AT) 73 74 /* Store it in errno... */ 75 sw v0, errno 76 77 /* And just kick back a -1. */ 78 li v0, -1 79 80 RESTORE_GP64 81 j ra 82 END(__syscall_error) 83#endif /* _LIBC_REENTRANT*/ 84