syscall_error.S 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, write to the Free
  15. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  16. 02111-1307 USA. */
  17. #include <sys/asm.h>
  18. #include <sysdep.h>
  19. #include <bits/errno.h>
  20. #ifdef _LIBC_REENTRANT
  21. LOCALSZ= 3
  22. FRAMESZ= (((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK
  23. RAOFF= FRAMESZ-(1*SZREG)
  24. GPOFF= FRAMESZ-(2*SZREG)
  25. V0OFF= FRAMESZ-(3*SZREG)
  26. ENTRY(__syscall_error)
  27. #ifdef __PIC__
  28. .set noat
  29. SETUP_GPX (AT)
  30. .set at
  31. #endif
  32. PTR_SUBU sp, FRAMESZ
  33. .set noat
  34. SETUP_GPX64(GPOFF,AT)
  35. .set at
  36. #ifdef __PIC__
  37. SAVE_GP(GPOFF)
  38. #endif
  39. REG_S a0, V0OFF(sp)
  40. REG_S ra, RAOFF(sp)
  41. /* Find our per-thread errno address */
  42. jal __errno_location
  43. /* Store the error value. */
  44. REG_L t0, V0OFF(sp)
  45. sw t0, 0(v0)
  46. /* And just kick back a -1. */
  47. REG_L ra, RAOFF(sp)
  48. RESTORE_GP64
  49. PTR_ADDU sp, FRAMESZ
  50. li v0, -1
  51. j ra
  52. END(__syscall_error)
  53. #else /* __LIBC_REENTRANT */
  54. ENTRY(__syscall_error)
  55. #ifdef __PIC__
  56. .set noat
  57. SETUP_GPX (AT)
  58. .set at
  59. #endif
  60. SETUP_GPX64 (t9, AT)
  61. /* Store it in errno... */
  62. sw v0, errno
  63. /* And just kick back a -1. */
  64. li v0, -1
  65. RESTORE_GP64
  66. j ra
  67. END(__syscall_error)
  68. #endif /* _LIBC_REENTRANT*/