sysdep.S 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* Copyright (C) 2001, 2003 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public License as
  5. published by the Free Software Foundation; either version 2 of the
  6. License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public
  12. License along with the GNU C Library; see the file COPYING.LIB. If not,
  13. see <http://www.gnu.org/licenses/>. */
  14. #include <features.h>
  15. #include "sysdep.h"
  16. /* The syscall stubs jump here when they detect an error, bot for PIC and
  17. non-PIC. */
  18. .syntax no_register_prefix
  19. ENTRY (__syscall_error)
  20. neg.d r10,r10
  21. #ifdef __UCLIBC_HAS_THREADS__
  22. subq 4,sp
  23. move.d r10,[sp]
  24. subq 4,sp
  25. move srp,[sp]
  26. /* Note that __syscall_error is only visible within this library,
  27. and no-one passes it on as a pointer, so can assume that R0 (GOT
  28. pointer) is correctly set up. */
  29. PLTCALL (__errno_location)
  30. move [sp+],srp
  31. move.d [sp+],r11
  32. move.d r11,[r10]
  33. #else /* not __UCLIBC_HAS_THREADS__ */
  34. #ifdef __arch_v32
  35. # ifdef __PIC__
  36. addo.d C_SYMBOL_NAME(errno:GOT),r0,acr
  37. move.d [acr],r9
  38. move.d r10,[r9]
  39. # else /* not __PIC__ */
  40. lapc C_SYMBOL_NAME(errno),acr
  41. move.d r10,[r9]
  42. # endif /* not __PIC__ */
  43. #else /* not __arch_v32 */
  44. # ifdef __PIC__
  45. move.d [r0+C_SYMBOL_NAME(errno:GOT)],r9
  46. move.d r10,[r9]
  47. # else
  48. move.d r10,[C_SYMBOL_NAME(errno)]
  49. # endif
  50. #endif /* not __arch_v32 */
  51. #endif /* __UCLIBC_HAS_THREADS__ */
  52. #ifdef __PIC__
  53. /* PIC callers are supposed to have R0 on stack, ready for us to restore.
  54. Callers are only allowed from within this DSO, so the GOT in r0 is the
  55. one we want to use.
  56. (Don't use "ret" - it's a macro). */
  57. moveq -1,r10
  58. Ret
  59. move.d [sp+],r0
  60. #else
  61. Ret
  62. moveq -1,r10
  63. #endif
  64. END (__syscall_error)