Merge remote-tracking branches 'asoc/topic/cx20442' and 'asoc/topic/davinci' into...
[linux-2.6-block.git] / arch / x86 / vdso / vdso32 / sigreturn.S
CommitLineData
1da177e4 1/*
69d0627a 2 * Common code for the sigreturn entry points in vDSO images.
1da177e4 3 * So far this code is the same for both int80 and sysenter versions.
69d0627a
RM
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.
1da177e4
LT
7 */
8
69d0627a 9#include <linux/linkage.h>
00f8b1bc 10#include <asm/unistd_32.h>
86feeaa8 11#include <asm/asm-offsets.h>
1da177e4 12
00f8b1bc
RM
13#ifndef SYSCALL_ENTER_KERNEL
14#define SYSCALL_ENTER_KERNEL int $0x80
15#endif
1da177e4 16
1da177e4 17 .text
1da177e4
LT
18 .globl __kernel_sigreturn
19 .type __kernel_sigreturn,@function
e8932869 20 nop /* this guy is needed for .LSTARTFDEDLSI1 below (watch for HACK) */
69d0627a 21 ALIGN
1da177e4
LT
22__kernel_sigreturn:
23.LSTART_sigreturn:
24 popl %eax /* XXX does this mean it needs unwind info? */
25 movl $__NR_sigreturn, %eax
00f8b1bc 26 SYSCALL_ENTER_KERNEL
1da177e4 27.LEND_sigreturn:
69d0627a 28 nop
1da177e4
LT
29 .size __kernel_sigreturn,.-.LSTART_sigreturn
30
1da177e4
LT
31 .globl __kernel_rt_sigreturn
32 .type __kernel_rt_sigreturn,@function
69d0627a 33 ALIGN
1da177e4
LT
34__kernel_rt_sigreturn:
35.LSTART_rt_sigreturn:
36 movl $__NR_rt_sigreturn, %eax
00f8b1bc 37 SYSCALL_ENTER_KERNEL
1da177e4 38.LEND_rt_sigreturn:
69d0627a 39 nop
1da177e4
LT
40 .size __kernel_rt_sigreturn,.-.LSTART_rt_sigreturn
41 .previous
42
43 .section .eh_frame,"a",@progbits
44.LSTARTFRAMEDLSI1:
45 .long .LENDCIEDLSI1-.LSTARTCIEDLSI1
46.LSTARTCIEDLSI1:
47 .long 0 /* CIE ID */
48 .byte 1 /* Version number */
da2e9e1f 49 .string "zRS" /* NUL-terminated augmentation string */
1da177e4
LT
50 .uleb128 1 /* Code alignment factor */
51 .sleb128 -4 /* Data alignment factor */
52 .byte 8 /* Return address register column */
53 .uleb128 1 /* Augmentation value length */
54 .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
55 .byte 0 /* DW_CFA_nop */
56 .align 4
57.LENDCIEDLSI1:
58 .long .LENDFDEDLSI1-.LSTARTFDEDLSI1 /* Length FDE */
59.LSTARTFDEDLSI1:
60 .long .LSTARTFDEDLSI1-.LSTARTFRAMEDLSI1 /* CIE pointer */
61 /* HACK: The dwarf2 unwind routines will subtract 1 from the
62 return address to get an address in the middle of the
63 presumed call instruction. Since we didn't get here via
64 a call, we need to include the nop before the real start
65 to make up for it. */
66 .long .LSTART_sigreturn-1-. /* PC-relative start address */
67 .long .LEND_sigreturn-.LSTART_sigreturn+1
68 .uleb128 0 /* Augmentation */
69 /* What follows are the instructions for the table generation.
70 We record the locations of each register saved. This is
71 complicated by the fact that the "CFA" is always assumed to
72 be the value of the stack pointer in the caller. This means
73 that we must define the CFA of this body of code to be the
74 saved value of the stack pointer in the sigcontext. Which
0c2f51a7 75 also means that there is no fixed relation to the other
1da177e4 76 saved registers, which means that we must use DW_CFA_expression
0c2f51a7 77 to compute their addresses. It also means that when we
1da177e4
LT
78 adjust the stack with the popl, we have to do it all over again. */
79
80#define do_cfa_expr(offset) \
81 .byte 0x0f; /* DW_CFA_def_cfa_expression */ \
82 .uleb128 1f-0f; /* length */ \
830: .byte 0x74; /* DW_OP_breg4 */ \
84 .sleb128 offset; /* offset */ \
85 .byte 0x06; /* DW_OP_deref */ \
861:
87
88#define do_expr(regno, offset) \
89 .byte 0x10; /* DW_CFA_expression */ \
90 .uleb128 regno; /* regno */ \
91 .uleb128 1f-0f; /* length */ \
920: .byte 0x74; /* DW_OP_breg4 */ \
93 .sleb128 offset; /* offset */ \
941:
95
742fa54a
PA
96 do_cfa_expr(IA32_SIGCONTEXT_sp+4)
97 do_expr(0, IA32_SIGCONTEXT_ax+4)
98 do_expr(1, IA32_SIGCONTEXT_cx+4)
99 do_expr(2, IA32_SIGCONTEXT_dx+4)
100 do_expr(3, IA32_SIGCONTEXT_bx+4)
101 do_expr(5, IA32_SIGCONTEXT_bp+4)
102 do_expr(6, IA32_SIGCONTEXT_si+4)
103 do_expr(7, IA32_SIGCONTEXT_di+4)
104 do_expr(8, IA32_SIGCONTEXT_ip+4)
1da177e4
LT
105
106 .byte 0x42 /* DW_CFA_advance_loc 2 -- nop; popl eax. */
107
742fa54a
PA
108 do_cfa_expr(IA32_SIGCONTEXT_sp)
109 do_expr(0, IA32_SIGCONTEXT_ax)
110 do_expr(1, IA32_SIGCONTEXT_cx)
111 do_expr(2, IA32_SIGCONTEXT_dx)
112 do_expr(3, IA32_SIGCONTEXT_bx)
113 do_expr(5, IA32_SIGCONTEXT_bp)
114 do_expr(6, IA32_SIGCONTEXT_si)
115 do_expr(7, IA32_SIGCONTEXT_di)
116 do_expr(8, IA32_SIGCONTEXT_ip)
1da177e4
LT
117
118 .align 4
119.LENDFDEDLSI1:
120
121 .long .LENDFDEDLSI2-.LSTARTFDEDLSI2 /* Length FDE */
122.LSTARTFDEDLSI2:
123 .long .LSTARTFDEDLSI2-.LSTARTFRAMEDLSI1 /* CIE pointer */
124 /* HACK: See above wrt unwind library assumptions. */
125 .long .LSTART_rt_sigreturn-1-. /* PC-relative start address */
126 .long .LEND_rt_sigreturn-.LSTART_rt_sigreturn+1
127 .uleb128 0 /* Augmentation */
128 /* What follows are the instructions for the table generation.
129 We record the locations of each register saved. This is
130 slightly less complicated than the above, since we don't
131 modify the stack pointer in the process. */
132
742fa54a
PA
133 do_cfa_expr(IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_sp)
134 do_expr(0, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ax)
135 do_expr(1, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_cx)
136 do_expr(2, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_dx)
137 do_expr(3, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_bx)
138 do_expr(5, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_bp)
139 do_expr(6, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_si)
140 do_expr(7, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_di)
141 do_expr(8, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ip)
1da177e4
LT
142
143 .align 4
144.LENDFDEDLSI2:
145 .previous