syscall_error.S 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 __UCLIBC_HAS_THREADS__
  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 v0, 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 /* __UCLIBC_HAS_THREADS__ */
  54. ENTRY(__syscall_error)
  55. #ifdef __PIC__
  56. SETUP_GPX (AT)
  57. #endif
  58. SETUP_GPX64 (t9, AT)
  59. /* Store it in errno... */
  60. sw v0, errno
  61. /* And just kick back a -1. */
  62. li v0, -1
  63. RESTORE_GP64
  64. j ra
  65. END(__syscall_error)
  66. #endif /* __UCLIBC_HAS_THREADS__ */