sysdep.S 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. Boston, MA 02111-1307, USA. */
  15. #include <features.h>
  16. #include "sysdep.h"
  17. /* Make space for the errno variable. */
  18. .globl C_SYMBOL_NAME(errno)
  19. .type C_SYMBOL_NAME(errno),@object
  20. .lcomm C_SYMBOL_NAME(errno),4
  21. .weak errno
  22. errno = _errno
  23. /* The syscall stubs jump here when they detect an error, bot for PIC and
  24. non-PIC. */
  25. .syntax no_register_prefix
  26. ENTRY (__syscall_error)
  27. neg.d r10,r10
  28. #ifdef __UCLIBC_HAS_THREADS__
  29. subq 4,sp
  30. move.d r10,[sp]
  31. subq 4,sp
  32. move srp,[sp]
  33. /* Note that __syscall_error is only visible within this library,
  34. and no-one passes it on as a pointer, so can assume that R0 (GOT
  35. pointer) is correctly set up. */
  36. PLTCALL (HIDDEN_JUMPTARGET(__errno_location))
  37. move [sp+],srp
  38. move.d [sp+],r11
  39. move.d r11,[r10]
  40. #else /* not __UCLIBC_HAS_THREADS__ */
  41. #ifdef __arch_v32
  42. # ifdef __PIC__
  43. addo.d C_SYMBOL_NAME(errno:GOT),r0,acr
  44. move.d [acr],r9
  45. move.d r10,[r9]
  46. # else /* not __PIC__ */
  47. lapc C_SYMBOL_NAME(errno),acr
  48. move.d r10,[r9]
  49. # endif /* not __PIC__ */
  50. #else /* not __arch_v32 */
  51. # ifdef __PIC__
  52. move.d [r0+C_SYMBOL_NAME(errno:GOT)],r9
  53. move.d r10,[r9]
  54. # else
  55. move.d r10,[C_SYMBOL_NAME(errno)]
  56. # endif
  57. #endif /* not __arch_v32 */
  58. #endif /* __UCLIBC_HAS_THREADS__ */
  59. #ifdef __PIC__
  60. /* PIC callers are supposed to have R0 on stack, ready for us to restore.
  61. Callers are only allowed from within this DSO, so the GOT in r0 is the
  62. one we want to use.
  63. (Don't use "ret" - it's a macro). */
  64. moveq -1,r10
  65. Ret
  66. move.d [sp+],r0
  67. #else
  68. Ret
  69. moveq -1,r10
  70. #endif
  71. END (__syscall_error)