sigreturn.S 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * Common code for the sigreturn entry points in vDSO images.
  3. * So far this code is the same for both int80 and sysenter versions.
  4. * This file is #include'd by int80.S et al to define them first thing.
  5. * The kernel assumes that the addresses of these routines are constant
  6. * for all vDSO implementations.
  7. */
  8. #include <linux/linkage.h>
  9. #include <asm/unistd_32.h>
  10. #include <asm/asm-offsets.h>
  11. #ifndef SYSCALL_ENTER_KERNEL
  12. #define SYSCALL_ENTER_KERNEL int $0x80
  13. #endif
  14. .text
  15. .globl __kernel_sigreturn
  16. .type __kernel_sigreturn,@function
  17. ALIGN
  18. __kernel_sigreturn:
  19. .LSTART_sigreturn:
  20. popl %eax /* XXX does this mean it needs unwind info? */
  21. movl $__NR_sigreturn, %eax
  22. SYSCALL_ENTER_KERNEL
  23. .LEND_sigreturn:
  24. nop
  25. .size __kernel_sigreturn,.-.LSTART_sigreturn
  26. .globl __kernel_rt_sigreturn
  27. .type __kernel_rt_sigreturn,@function
  28. ALIGN
  29. __kernel_rt_sigreturn:
  30. .LSTART_rt_sigreturn:
  31. movl $__NR_rt_sigreturn, %eax
  32. SYSCALL_ENTER_KERNEL
  33. .LEND_rt_sigreturn:
  34. nop
  35. .size __kernel_rt_sigreturn,.-.LSTART_rt_sigreturn
  36. .previous
  37. .section .eh_frame,"a",@progbits
  38. .LSTARTFRAMEDLSI1:
  39. .long .LENDCIEDLSI1-.LSTARTCIEDLSI1
  40. .LSTARTCIEDLSI1:
  41. .long 0 /* CIE ID */
  42. .byte 1 /* Version number */
  43. .string "zRS" /* NUL-terminated augmentation string */
  44. .uleb128 1 /* Code alignment factor */
  45. .sleb128 -4 /* Data alignment factor */
  46. .byte 8 /* Return address register column */
  47. .uleb128 1 /* Augmentation value length */
  48. .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
  49. .byte 0 /* DW_CFA_nop */
  50. .align 4
  51. .LENDCIEDLSI1:
  52. .long .LENDFDEDLSI1-.LSTARTFDEDLSI1 /* Length FDE */
  53. .LSTARTFDEDLSI1:
  54. .long .LSTARTFDEDLSI1-.LSTARTFRAMEDLSI1 /* CIE pointer */
  55. /* HACK: The dwarf2 unwind routines will subtract 1 from the
  56. return address to get an address in the middle of the
  57. presumed call instruction. Since we didn't get here via
  58. a call, we need to include the nop before the real start
  59. to make up for it. */
  60. .long .LSTART_sigreturn-1-. /* PC-relative start address */
  61. .long .LEND_sigreturn-.LSTART_sigreturn+1
  62. .uleb128 0 /* Augmentation */
  63. /* What follows are the instructions for the table generation.
  64. We record the locations of each register saved. This is
  65. complicated by the fact that the "CFA" is always assumed to
  66. be the value of the stack pointer in the caller. This means
  67. that we must define the CFA of this body of code to be the
  68. saved value of the stack pointer in the sigcontext. Which
  69. also means that there is no fixed relation to the other
  70. saved registers, which means that we must use DW_CFA_expression
  71. to compute their addresses. It also means that when we
  72. adjust the stack with the popl, we have to do it all over again. */
  73. #define do_cfa_expr(offset) \
  74. .byte 0x0f; /* DW_CFA_def_cfa_expression */ \
  75. .uleb128 1f-0f; /* length */ \
  76. 0: .byte 0x74; /* DW_OP_breg4 */ \
  77. .sleb128 offset; /* offset */ \
  78. .byte 0x06; /* DW_OP_deref */ \
  79. 1:
  80. #define do_expr(regno, offset) \
  81. .byte 0x10; /* DW_CFA_expression */ \
  82. .uleb128 regno; /* regno */ \
  83. .uleb128 1f-0f; /* length */ \
  84. 0: .byte 0x74; /* DW_OP_breg4 */ \
  85. .sleb128 offset; /* offset */ \
  86. 1:
  87. do_cfa_expr(IA32_SIGCONTEXT_sp+4)
  88. do_expr(0, IA32_SIGCONTEXT_ax+4)
  89. do_expr(1, IA32_SIGCONTEXT_cx+4)
  90. do_expr(2, IA32_SIGCONTEXT_dx+4)
  91. do_expr(3, IA32_SIGCONTEXT_bx+4)
  92. do_expr(5, IA32_SIGCONTEXT_bp+4)
  93. do_expr(6, IA32_SIGCONTEXT_si+4)
  94. do_expr(7, IA32_SIGCONTEXT_di+4)
  95. do_expr(8, IA32_SIGCONTEXT_ip+4)
  96. .byte 0x42 /* DW_CFA_advance_loc 2 -- nop; popl eax. */
  97. do_cfa_expr(IA32_SIGCONTEXT_sp)
  98. do_expr(0, IA32_SIGCONTEXT_ax)
  99. do_expr(1, IA32_SIGCONTEXT_cx)
  100. do_expr(2, IA32_SIGCONTEXT_dx)
  101. do_expr(3, IA32_SIGCONTEXT_bx)
  102. do_expr(5, IA32_SIGCONTEXT_bp)
  103. do_expr(6, IA32_SIGCONTEXT_si)
  104. do_expr(7, IA32_SIGCONTEXT_di)
  105. do_expr(8, IA32_SIGCONTEXT_ip)
  106. .align 4
  107. .LENDFDEDLSI1:
  108. .long .LENDFDEDLSI2-.LSTARTFDEDLSI2 /* Length FDE */
  109. .LSTARTFDEDLSI2:
  110. .long .LSTARTFDEDLSI2-.LSTARTFRAMEDLSI1 /* CIE pointer */
  111. /* HACK: See above wrt unwind library assumptions. */
  112. .long .LSTART_rt_sigreturn-1-. /* PC-relative start address */
  113. .long .LEND_rt_sigreturn-.LSTART_rt_sigreturn+1
  114. .uleb128 0 /* Augmentation */
  115. /* What follows are the instructions for the table generation.
  116. We record the locations of each register saved. This is
  117. slightly less complicated than the above, since we don't
  118. modify the stack pointer in the process. */
  119. do_cfa_expr(IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_sp)
  120. do_expr(0, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ax)
  121. do_expr(1, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_cx)
  122. do_expr(2, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_dx)
  123. do_expr(3, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_bx)
  124. do_expr(5, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_bp)
  125. do_expr(6, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_si)
  126. do_expr(7, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_di)
  127. do_expr(8, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ip)
  128. .align 4
  129. .LENDFDEDLSI2:
  130. .previous