sysdep.S 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* Copyright (C) 2001 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. errno = _errno
  22. /* weak_alias (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. push r10
  30. push srp
  31. /* Note that __syscall_error is only visible within this library,
  32. and no-one passes it on as a pointer, so can assume that R0 (GOT
  33. pointer) is correctly set up. */
  34. PLTCALL (__errno_location)
  35. pop srp
  36. pop r11
  37. move.d r11,[r10]
  38. #else /* not __UCLIBC_HAS_THREADS__ */
  39. # ifdef __PIC__
  40. move.d [r0+C_SYMBOL_NAME(errno:GOT)],r9
  41. move.d r10,[r9]
  42. # else
  43. move.d r10,[C_SYMBOL_NAME(errno)]
  44. # endif
  45. #endif /* __UCLIBC_HAS_THREADS__ */
  46. #ifdef __PIC__
  47. /* PIC callers are supposed to have R0 on stack, ready for us to restore.
  48. Callers are only allowed from within this DSO, so the GOT in r0 is the
  49. one we want to use.
  50. (Don't use "ret" - it's a macro). */
  51. moveq -1,r10
  52. Ret
  53. pop r0
  54. #else
  55. Ret
  56. moveq -1,r10
  57. #endif
  58. END (__syscall_error)