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