syscall_error.S 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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, see
  15. <http://www.gnu.org/licenses/>. */
  16. #include <sys/asm.h>
  17. #include <sysdep.h>
  18. #include <bits/errno.h>
  19. #ifdef _LIBC_REENTRANT
  20. LOCALSZ= 3
  21. FRAMESZ= (((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK
  22. RAOFF= FRAMESZ-(1*SZREG)
  23. GPOFF= FRAMESZ-(2*SZREG)
  24. V0OFF= FRAMESZ-(3*SZREG)
  25. ENTRY(__syscall_error)
  26. #ifdef __PIC__
  27. .set noat
  28. SETUP_GPX (AT)
  29. .set at
  30. #endif
  31. PTR_SUBU sp, FRAMESZ
  32. .set noat
  33. SETUP_GPX64(GPOFF,AT)
  34. .set at
  35. #ifdef __PIC__
  36. SAVE_GP(GPOFF)
  37. #endif
  38. REG_S a0, V0OFF(sp)
  39. REG_S ra, RAOFF(sp)
  40. /* Find our per-thread errno address */
  41. jal __errno_location
  42. /* Store the error value. */
  43. REG_L t0, V0OFF(sp)
  44. sw t0, 0(v0)
  45. /* And just kick back a -1. */
  46. REG_L ra, RAOFF(sp)
  47. RESTORE_GP64
  48. PTR_ADDU sp, FRAMESZ
  49. li v0, -1
  50. j ra
  51. END(__syscall_error)
  52. #else /* __LIBC_REENTRANT */
  53. ENTRY(__syscall_error)
  54. #ifdef __PIC__
  55. .set noat
  56. SETUP_GPX (AT)
  57. .set at
  58. #endif
  59. SETUP_GPX64 (t9, AT)
  60. /* Store it in errno... */
  61. sw v0, errno
  62. /* And just kick back a -1. */
  63. li v0, -1
  64. RESTORE_GP64
  65. j ra
  66. END(__syscall_error)
  67. #endif /* _LIBC_REENTRANT*/