__syscall_rt_sigaction.S 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. #include <features.h>
  17. #include <sys/syscall.h>
  18. #include <sys/regdef.h>
  19. /* On Alpha we desparately want to avoid having to issue an imb. Ordinarily
  20. the kernel would have to issue one after setting up the signal return
  21. stack, but the Linux rt_sigaction syscall is prepared to accept a pointer
  22. to the sigreturn syscall, instead of inlining it on the stack.
  23. This just about halves signal delivery time. */
  24. .text
  25. .globl __syscall_rt_sigaction
  26. .align 4
  27. .ent __syscall_rt_sigaction, 0
  28. __syscall_rt_sigaction:
  29. .frame sp,0,ra,0
  30. ldgp gp,0(pv)
  31. .prologue 1
  32. beq a1, 0f
  33. ldl t0, 8(a1) # sa_flags
  34. /* The unwinder will subtract one from the return address when
  35. attempting to find the call instruction that led us here.
  36. Since we didn't get here via a normal call, if we do nothing
  37. we would pick up the wrong symbol and the wrong FDE. Account
  38. for this by adding a nop to the start of the function and
  39. then skipping it here by adding 4. */
  40. ldah a4, __syscall_sigreturn+4(gp) !gprelhigh
  41. ldah t1, __syscall_rt_sigreturn+4(gp) !gprelhigh
  42. lda a4, __syscall_sigreturn+4(a4) !gprellow
  43. lda t1, __syscall_rt_sigreturn+4(t1) !gprellow
  44. and t0, 0x40, t0 # SA_SIGINFO
  45. cmovne t0, t1, a4
  46. 0: ldi v0, __NR_rt_sigaction
  47. callsys
  48. bne a3, $error
  49. ret
  50. $error:
  51. jmp zero,__syscall_error
  52. .end __syscall_rt_sigaction
  53. __syscall_sigreturn:
  54. nop
  55. mov sp, a0
  56. ldi v0, __NR_sigreturn
  57. callsys
  58. .size __syscall_sigreturn, .-__syscall_sigreturn
  59. .type __syscall_sigreturn, @function
  60. __syscall_rt_sigreturn:
  61. nop
  62. mov sp,a0
  63. ldi v0,__NR_rt_sigreturn
  64. callsys
  65. .size __syscall_rt_sigreturn, .-__syscall_rt_sigreturn
  66. .type __syscall_rt_sigreturn, @function