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