vsyscall-sigreturn.S 4.8 KB

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