]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - arch/i386/kernel/vsyscall-sigreturn.S
Linux-2.6.12-rc2
[mirror_ubuntu-bionic-kernel.git] / arch / i386 / kernel / vsyscall-sigreturn.S
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
9 #include <asm/unistd.h>
10 #include <asm/asm_offsets.h>
11
12
13 /* XXX
14 Should these be named "_sigtramp" or something?
15 */
16
17 .text
18 .org __kernel_vsyscall+32
19 .globl __kernel_sigreturn
20 .type __kernel_sigreturn,@function
21 __kernel_sigreturn:
22 .LSTART_sigreturn:
23 popl %eax /* XXX does this mean it needs unwind info? */
24 movl $__NR_sigreturn, %eax
25 int $0x80
26 .LEND_sigreturn:
27 .size __kernel_sigreturn,.-.LSTART_sigreturn
28
29 .balign 32
30 .globl __kernel_rt_sigreturn
31 .type __kernel_rt_sigreturn,@function
32 __kernel_rt_sigreturn:
33 .LSTART_rt_sigreturn:
34 movl $__NR_rt_sigreturn, %eax
35 int $0x80
36 .LEND_rt_sigreturn:
37 .size __kernel_rt_sigreturn,.-.LSTART_rt_sigreturn
38 .previous
39
40 .section .eh_frame,"a",@progbits
41 .LSTARTFRAMEDLSI1:
42 .long .LENDCIEDLSI1-.LSTARTCIEDLSI1
43 .LSTARTCIEDLSI1:
44 .long 0 /* CIE ID */
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 */
53 .align 4
54 .LENDCIEDLSI1:
55 .long .LENDFDEDLSI1-.LSTARTFDEDLSI1 /* Length FDE */
56 .LSTARTFDEDLSI1:
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
62 to make up for it. */
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. */
76
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 */ \
83 1:
84
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 */ \
91 1:
92
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)
102
103 .byte 0x42 /* DW_CFA_advance_loc 2 -- nop; popl eax. */
104
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)
114
115 .align 4
116 .LENDFDEDLSI1:
117
118 .long .LENDFDEDLSI2-.LSTARTFDEDLSI2 /* Length FDE */
119 .LSTARTFDEDLSI2:
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. */
129
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)
139
140 .align 4
141 .LENDFDEDLSI2:
142 .previous