Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / arch / x86 / vdso / vdso32 / sigreturn.S
1 /*
2  * Common code for the sigreturn entry points in vDSO images.
3  * So far this code is the same for both int80 and sysenter versions.
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.
7  */
8
9 #include <linux/linkage.h>
10 #include <asm/unistd_32.h>
11 #include <asm/asm-offsets.h>
12
13 #ifndef SYSCALL_ENTER_KERNEL
14 #define SYSCALL_ENTER_KERNEL    int $0x80
15 #endif
16
17         .text
18         .globl __kernel_sigreturn
19         .type __kernel_sigreturn,@function
20         nop /* this guy is needed for .LSTARTFDEDLSI1 below (watch for HACK) */
21         ALIGN
22 __kernel_sigreturn:
23 .LSTART_sigreturn:
24         popl %eax               /* XXX does this mean it needs unwind info? */
25         movl $__NR_sigreturn, %eax
26         SYSCALL_ENTER_KERNEL
27 .LEND_sigreturn:
28         nop
29         .size __kernel_sigreturn,.-.LSTART_sigreturn
30
31         .globl __kernel_rt_sigreturn
32         .type __kernel_rt_sigreturn,@function
33         ALIGN
34 __kernel_rt_sigreturn:
35 .LSTART_rt_sigreturn:
36         movl $__NR_rt_sigreturn, %eax
37         SYSCALL_ENTER_KERNEL
38 .LEND_rt_sigreturn:
39         nop
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 */
49         .string "zRS"           /* NUL-terminated augmentation string */
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
75            also means that there is no fixed relation to the other
76            saved registers, which means that we must use DW_CFA_expression
77            to compute their addresses.  It also means that when we
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 */                  \
83 0:      .byte 0x74;                     /*     DW_OP_breg4 */           \
84         .sleb128 offset;                /*      offset */               \
85         .byte 0x06;                     /*     DW_OP_deref */           \
86 1:
87
88 #define do_expr(regno, offset)                                          \
89         .byte 0x10;                     /* DW_CFA_expression */         \
90         .uleb128 regno;                 /*   regno */                   \
91         .uleb128 1f-0f;                 /*   length */                  \
92 0:      .byte 0x74;                     /*     DW_OP_breg4 */           \
93         .sleb128 offset;                /*       offset */              \
94 1:
95
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)
105
106         .byte 0x42      /* DW_CFA_advance_loc 2 -- nop; popl eax. */
107
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)
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
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)
142
143         .align 4
144 .LENDFDEDLSI2:
145         .previous