rt_sigaction.S 2.6 KB

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