sysdep.S 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 <sysdep.h>
  16. /* Make space for the errno variable. */
  17. .globl C_SYMBOL_NAME(errno)
  18. .type C_SYMBOL_NAME(errno),@object
  19. .lcomm C_SYMBOL_NAME(errno),4
  20. errno = _errno
  21. /* weak_alias (errno, _errno) */
  22. /* The syscall stubs jump here when they detect an error, bot for PIC and
  23. non-PIC. */
  24. .syntax no_register_prefix
  25. ENTRY (__syscall_error)
  26. neg.d r10,r10
  27. #ifdef __UCLIBC_HAS_THREADS__
  28. push r10
  29. push srp
  30. /* Note that __syscall_error is only visible within this library,
  31. and no-one passes it on as a pointer, so can assume that R0 (GOT
  32. pointer) is correctly set up. */
  33. PLTCALL (__errno_location)
  34. pop srp
  35. pop r11
  36. move.d r11,[r10]
  37. #else /* not __UCLIBC_HAS_THREADS__ */
  38. # ifdef __PIC__
  39. move.d [r0+C_SYMBOL_NAME(errno:GOT)],r9
  40. move.d r10,[r9]
  41. # else
  42. move.d r10,[C_SYMBOL_NAME(errno)]
  43. # endif
  44. #endif /* __UCLIBC_HAS_THREADS__ */
  45. #ifdef __PIC__
  46. /* PIC callers are supposed to have R0 on stack, ready for us to restore.
  47. Callers are only allowed from within this DSO, so the GOT in r0 is the
  48. one we want to use.
  49. (Don't use "ret" - it's a macro). */
  50. moveq -1,r10
  51. Ret
  52. pop r0
  53. #else
  54. Ret
  55. moveq -1,r10
  56. #endif
  57. END (__syscall_error)