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.
9 #include <asm/unistd.h>
10 #include <asm/asm_offsets.h>
14 Should these be named "_sigtramp" or something?
18 .org __kernel_vsyscall+32
19 .globl __kernel_sigreturn
20 .type __kernel_sigreturn,@function
23 popl %eax /* XXX does this mean it needs unwind info? */
24 movl $__NR_sigreturn, %eax
27 .size __kernel_sigreturn,.-.LSTART_sigreturn
30 .globl __kernel_rt_sigreturn
31 .type __kernel_rt_sigreturn,@function
32 __kernel_rt_sigreturn:
34 movl $__NR_rt_sigreturn, %eax
37 .size __kernel_rt_sigreturn,.-.LSTART_rt_sigreturn
40 .section .eh_frame,"a",@progbits
42 .long .LENDCIEDLSI1-.LSTARTCIEDLSI1
45 .byte 1 /* Version number */
46 .string "zR" /* NUL-terminated augmentation string */
47 .uleb128 1 /* Code alignment factor */
48 .sleb128 -4 /* Data alignment factor */
49 .byte 8 /* Return address register column */
50 .uleb128 1 /* Augmentation value length */
51 .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
52 .byte 0 /* DW_CFA_nop */
55 .long .LENDFDEDLSI1-.LSTARTFDEDLSI1 /* Length FDE */
57 .long .LSTARTFDEDLSI1-.LSTARTFRAMEDLSI1 /* CIE pointer */
58 /* HACK: The dwarf2 unwind routines will subtract 1 from the
59 return address to get an address in the middle of the
60 presumed call instruction. Since we didn't get here via
61 a call, we need to include the nop before the real start
63 .long .LSTART_sigreturn-1-. /* PC-relative start address */
64 .long .LEND_sigreturn-.LSTART_sigreturn+1
65 .uleb128 0 /* Augmentation */
66 /* What follows are the instructions for the table generation.
67 We record the locations of each register saved. This is
68 complicated by the fact that the "CFA" is always assumed to
69 be the value of the stack pointer in the caller. This means
70 that we must define the CFA of this body of code to be the
71 saved value of the stack pointer in the sigcontext. Which
72 also means that there is no fixed relation to the other
73 saved registers, which means that we must use DW_CFA_expression
74 to compute their addresses. It also means that when we
75 adjust the stack with the popl, we have to do it all over again. */
77 #define do_cfa_expr(offset) \
78 .byte 0x0f; /* DW_CFA_def_cfa_expression */ \
79 .uleb128 1f-0f; /* length */ \
80 0: .byte 0x74; /* DW_OP_breg4 */ \
81 .sleb128 offset; /* offset */ \
82 .byte 0x06; /* DW_OP_deref */ \
85 #define do_expr(regno, offset) \
86 .byte 0x10; /* DW_CFA_expression */ \
87 .uleb128 regno; /* regno */ \
88 .uleb128 1f-0f; /* length */ \
89 0: .byte 0x74; /* DW_OP_breg4 */ \
90 .sleb128 offset; /* offset */ \
93 do_cfa_expr(SIGCONTEXT_esp+4)
94 do_expr(0, SIGCONTEXT_eax+4)
95 do_expr(1, SIGCONTEXT_ecx+4)
96 do_expr(2, SIGCONTEXT_edx+4)
97 do_expr(3, SIGCONTEXT_ebx+4)
98 do_expr(5, SIGCONTEXT_ebp+4)
99 do_expr(6, SIGCONTEXT_esi+4)
100 do_expr(7, SIGCONTEXT_edi+4)
101 do_expr(8, SIGCONTEXT_eip+4)
103 .byte 0x42 /* DW_CFA_advance_loc 2 -- nop; popl eax. */
105 do_cfa_expr(SIGCONTEXT_esp)
106 do_expr(0, SIGCONTEXT_eax)
107 do_expr(1, SIGCONTEXT_ecx)
108 do_expr(2, SIGCONTEXT_edx)
109 do_expr(3, SIGCONTEXT_ebx)
110 do_expr(5, SIGCONTEXT_ebp)
111 do_expr(6, SIGCONTEXT_esi)
112 do_expr(7, SIGCONTEXT_edi)
113 do_expr(8, SIGCONTEXT_eip)
118 .long .LENDFDEDLSI2-.LSTARTFDEDLSI2 /* Length FDE */
120 .long .LSTARTFDEDLSI2-.LSTARTFRAMEDLSI1 /* CIE pointer */
121 /* HACK: See above wrt unwind library assumptions. */
122 .long .LSTART_rt_sigreturn-1-. /* PC-relative start address */
123 .long .LEND_rt_sigreturn-.LSTART_rt_sigreturn+1
124 .uleb128 0 /* Augmentation */
125 /* What follows are the instructions for the table generation.
126 We record the locations of each register saved. This is
127 slightly less complicated than the above, since we don't
128 modify the stack pointer in the process. */
130 do_cfa_expr(RT_SIGFRAME_sigcontext-4 + SIGCONTEXT_esp)
131 do_expr(0, RT_SIGFRAME_sigcontext-4 + SIGCONTEXT_eax)
132 do_expr(1, RT_SIGFRAME_sigcontext-4 + SIGCONTEXT_ecx)
133 do_expr(2, RT_SIGFRAME_sigcontext-4 + SIGCONTEXT_edx)
134 do_expr(3, RT_SIGFRAME_sigcontext-4 + SIGCONTEXT_ebx)
135 do_expr(5, RT_SIGFRAME_sigcontext-4 + SIGCONTEXT_ebp)
136 do_expr(6, RT_SIGFRAME_sigcontext-4 + SIGCONTEXT_esi)
137 do_expr(7, RT_SIGFRAME_sigcontext-4 + SIGCONTEXT_edi)
138 do_expr(8, RT_SIGFRAME_sigcontext-4 + SIGCONTEXT_eip)