__syscall_rt_sigaction.S 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* Copyright (C) 1998, 2003, 2004 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. Contributed by Richard Henderson <rth@cygnus.com>, 1998
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #include <features.h>
  16. #include <sys/syscall.h>
  17. #include <sys/regdef.h>
  18. /* On Alpha we desparately want to avoid having to issue an imb. Ordinarily
  19. the kernel would have to issue one after setting up the signal return
  20. stack, but the Linux rt_sigaction syscall is prepared to accept a pointer
  21. to the sigreturn syscall, instead of inlining it on the stack.
  22. This just about halves signal delivery time. */
  23. .text
  24. .globl __syscall_rt_sigaction
  25. #ifndef __UCLIBC_HAS_THREADS_NATIVE__
  26. .hidden __syscall_rt_sigaction
  27. #endif
  28. .align 4
  29. .ent __syscall_rt_sigaction, 0
  30. __syscall_rt_sigaction:
  31. .frame sp,0,ra,0
  32. ldgp gp,0(pv)
  33. .prologue 1
  34. beq a1, 0f
  35. ldl t0, 8(a1) # sa_flags
  36. /* The unwinder will subtract one from the return address when
  37. attempting to find the call instruction that led us here.
  38. Since we didn't get here via a normal call, if we do nothing
  39. we would pick up the wrong symbol and the wrong FDE. Account
  40. for this by adding a nop to the start of the function and
  41. then skipping it here by adding 4. */
  42. ldah a4, __syscall_sigreturn+4(gp) !gprelhigh
  43. ldah t1, __syscall_rt_sigreturn+4(gp) !gprelhigh
  44. lda a4, __syscall_sigreturn+4(a4) !gprellow
  45. lda t1, __syscall_rt_sigreturn+4(t1) !gprellow
  46. and t0, 0x40, t0 # SA_SIGINFO
  47. cmovne t0, t1, a4
  48. 0: ldi v0, __NR_rt_sigaction
  49. callsys
  50. bne a3, $error
  51. ret
  52. $error:
  53. jmp zero,__syscall_error
  54. .end __syscall_rt_sigaction
  55. __syscall_sigreturn:
  56. nop
  57. mov sp, a0
  58. ldi v0, __NR_sigreturn
  59. callsys
  60. .size __syscall_sigreturn, .-__syscall_sigreturn
  61. .type __syscall_sigreturn, @function
  62. __syscall_rt_sigreturn:
  63. nop
  64. mov sp,a0
  65. ldi v0,__NR_rt_sigreturn
  66. callsys
  67. .size __syscall_rt_sigreturn, .-__syscall_rt_sigreturn
  68. .type __syscall_rt_sigreturn, @function