1 |
3 |
xianfeng |
/*
|
2 |
|
|
* Common code for the sigreturn entry points on the vsyscall page.
|
3 |
|
|
* This code uses SYSCALL_ENTER_KERNEL (either syscall or int $0x80)
|
4 |
|
|
* to enter the kernel.
|
5 |
|
|
* This file is #include'd by vsyscall-*.S to define them after the
|
6 |
|
|
* vsyscall entry point. The addresses we get for these entry points
|
7 |
|
|
* by doing ".balign 32" must match in both versions of the page.
|
8 |
|
|
*/
|
9 |
|
|
|
10 |
|
|
.code32
|
11 |
|
|
.section .text.sigreturn,"ax"
|
12 |
|
|
.balign 32
|
13 |
|
|
.globl __kernel_sigreturn
|
14 |
|
|
.type __kernel_sigreturn,@function
|
15 |
|
|
__kernel_sigreturn:
|
16 |
|
|
.LSTART_sigreturn:
|
17 |
|
|
popl %eax
|
18 |
|
|
movl $__NR_ia32_sigreturn, %eax
|
19 |
|
|
SYSCALL_ENTER_KERNEL
|
20 |
|
|
.LEND_sigreturn:
|
21 |
|
|
.size __kernel_sigreturn,.-.LSTART_sigreturn
|
22 |
|
|
|
23 |
|
|
.section .text.rtsigreturn,"ax"
|
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_ia32_rt_sigreturn, %eax
|
30 |
|
|
SYSCALL_ENTER_KERNEL
|
31 |
|
|
.LEND_rt_sigreturn:
|
32 |
|
|
.size __kernel_rt_sigreturn,.-.LSTART_rt_sigreturn
|
33 |
|
|
|
34 |
|
|
.section .eh_frame,"a",@progbits
|
35 |
|
|
.LSTARTFRAMES:
|
36 |
|
|
.long .LENDCIES-.LSTARTCIES
|
37 |
|
|
.LSTARTCIES:
|
38 |
|
|
.long 0 /* CIE ID */
|
39 |
|
|
.byte 1 /* Version number */
|
40 |
|
|
.string "zRS" /* NUL-terminated augmentation string */
|
41 |
|
|
.uleb128 1 /* Code alignment factor */
|
42 |
|
|
.sleb128 -4 /* Data alignment factor */
|
43 |
|
|
.byte 8 /* Return address register column */
|
44 |
|
|
.uleb128 1 /* Augmentation value length */
|
45 |
|
|
.byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
|
46 |
|
|
.byte 0x0c /* DW_CFA_def_cfa */
|
47 |
|
|
.uleb128 4
|
48 |
|
|
.uleb128 4
|
49 |
|
|
.byte 0x88 /* DW_CFA_offset, column 0x8 */
|
50 |
|
|
.uleb128 1
|
51 |
|
|
.align 4
|
52 |
|
|
.LENDCIES:
|
53 |
|
|
|
54 |
|
|
.long .LENDFDE2-.LSTARTFDE2 /* Length FDE */
|
55 |
|
|
.LSTARTFDE2:
|
56 |
|
|
.long .LSTARTFDE2-.LSTARTFRAMES /* CIE pointer */
|
57 |
|
|
/* HACK: The dwarf2 unwind routines will subtract 1 from the
|
58 |
|
|
return address to get an address in the middle of the
|
59 |
|
|
presumed call instruction. Since we didn't get here via
|
60 |
|
|
a call, we need to include the nop before the real start
|
61 |
|
|
to make up for it. */
|
62 |
|
|
.long .LSTART_sigreturn-1-. /* PC-relative start address */
|
63 |
|
|
.long .LEND_sigreturn-.LSTART_sigreturn+1
|
64 |
|
|
.uleb128 0 /* Augmentation length */
|
65 |
|
|
/* What follows are the instructions for the table generation.
|
66 |
|
|
We record the locations of each register saved. This is
|
67 |
|
|
complicated by the fact that the "CFA" is always assumed to
|
68 |
|
|
be the value of the stack pointer in the caller. This means
|
69 |
|
|
that we must define the CFA of this body of code to be the
|
70 |
|
|
saved value of the stack pointer in the sigcontext. Which
|
71 |
|
|
also means that there is no fixed relation to the other
|
72 |
|
|
saved registers, which means that we must use DW_CFA_expression
|
73 |
|
|
to compute their addresses. It also means that when we
|
74 |
|
|
adjust the stack with the popl, we have to do it all over again. */
|
75 |
|
|
|
76 |
|
|
#define do_cfa_expr(offset) \
|
77 |
|
|
.byte 0x0f; /* DW_CFA_def_cfa_expression */ \
|
78 |
|
|
.uleb128 1f-0f; /* length */ \
|
79 |
|
|
0: .byte 0x74; /* DW_OP_breg4 */ \
|
80 |
|
|
.sleb128 offset; /* offset */ \
|
81 |
|
|
.byte 0x06; /* DW_OP_deref */ \
|
82 |
|
|
1:
|
83 |
|
|
|
84 |
|
|
#define do_expr(regno, offset) \
|
85 |
|
|
.byte 0x10; /* DW_CFA_expression */ \
|
86 |
|
|
.uleb128 regno; /* regno */ \
|
87 |
|
|
.uleb128 1f-0f; /* length */ \
|
88 |
|
|
0: .byte 0x74; /* DW_OP_breg4 */ \
|
89 |
|
|
.sleb128 offset; /* offset */ \
|
90 |
|
|
1:
|
91 |
|
|
|
92 |
|
|
do_cfa_expr(IA32_SIGCONTEXT_esp+4)
|
93 |
|
|
do_expr(0, IA32_SIGCONTEXT_eax+4)
|
94 |
|
|
do_expr(1, IA32_SIGCONTEXT_ecx+4)
|
95 |
|
|
do_expr(2, IA32_SIGCONTEXT_edx+4)
|
96 |
|
|
do_expr(3, IA32_SIGCONTEXT_ebx+4)
|
97 |
|
|
do_expr(5, IA32_SIGCONTEXT_ebp+4)
|
98 |
|
|
do_expr(6, IA32_SIGCONTEXT_esi+4)
|
99 |
|
|
do_expr(7, IA32_SIGCONTEXT_edi+4)
|
100 |
|
|
do_expr(8, IA32_SIGCONTEXT_eip+4)
|
101 |
|
|
|
102 |
|
|
.byte 0x42 /* DW_CFA_advance_loc 2 -- nop; popl eax. */
|
103 |
|
|
|
104 |
|
|
do_cfa_expr(IA32_SIGCONTEXT_esp)
|
105 |
|
|
do_expr(0, IA32_SIGCONTEXT_eax)
|
106 |
|
|
do_expr(1, IA32_SIGCONTEXT_ecx)
|
107 |
|
|
do_expr(2, IA32_SIGCONTEXT_edx)
|
108 |
|
|
do_expr(3, IA32_SIGCONTEXT_ebx)
|
109 |
|
|
do_expr(5, IA32_SIGCONTEXT_ebp)
|
110 |
|
|
do_expr(6, IA32_SIGCONTEXT_esi)
|
111 |
|
|
do_expr(7, IA32_SIGCONTEXT_edi)
|
112 |
|
|
do_expr(8, IA32_SIGCONTEXT_eip)
|
113 |
|
|
|
114 |
|
|
.align 4
|
115 |
|
|
.LENDFDE2:
|
116 |
|
|
|
117 |
|
|
.long .LENDFDE3-.LSTARTFDE3 /* Length FDE */
|
118 |
|
|
.LSTARTFDE3:
|
119 |
|
|
.long .LSTARTFDE3-.LSTARTFRAMES /* CIE pointer */
|
120 |
|
|
/* HACK: See above wrt unwind library assumptions. */
|
121 |
|
|
.long .LSTART_rt_sigreturn-1-. /* PC-relative start address */
|
122 |
|
|
.long .LEND_rt_sigreturn-.LSTART_rt_sigreturn+1
|
123 |
|
|
.uleb128 0 /* Augmentation */
|
124 |
|
|
/* What follows are the instructions for the table generation.
|
125 |
|
|
We record the locations of each register saved. This is
|
126 |
|
|
slightly less complicated than the above, since we don't
|
127 |
|
|
modify the stack pointer in the process. */
|
128 |
|
|
|
129 |
|
|
do_cfa_expr(IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_esp)
|
130 |
|
|
do_expr(0, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_eax)
|
131 |
|
|
do_expr(1, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ecx)
|
132 |
|
|
do_expr(2, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_edx)
|
133 |
|
|
do_expr(3, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ebx)
|
134 |
|
|
do_expr(5, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ebp)
|
135 |
|
|
do_expr(6, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_esi)
|
136 |
|
|
do_expr(7, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_edi)
|
137 |
|
|
do_expr(8, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_eip)
|
138 |
|
|
|
139 |
|
|
.align 4
|
140 |
|
|
.LENDFDE3:
|
141 |
|
|
|
142 |
|
|
#include "../../x86/kernel/vsyscall-note_32.S"
|
143 |
|
|
|