Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / x86_64 / ia32 / vsyscall-sigreturn.S
blobba4067d350e47efc071e8607d6708b9ab523c261
1 /*
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  */
10         .section .text.sigreturn,"ax"
11         .balign 32
12         .globl __kernel_sigreturn
13         .type __kernel_sigreturn,@function
14 __kernel_sigreturn:
15 .LSTART_sigreturn:
16         popl %eax
17         movl $__NR_ia32_sigreturn, %eax
18         SYSCALL_ENTER_KERNEL
19 .LEND_sigreturn:
20         .size __kernel_sigreturn,.-.LSTART_sigreturn
22         .section .text.rtsigreturn,"ax"
23         .balign 32
24         .globl __kernel_rt_sigreturn
25         .type __kernel_rt_sigreturn,@function
26 __kernel_rt_sigreturn:
27 .LSTART_rt_sigreturn:
28         movl $__NR_ia32_rt_sigreturn, %eax
29         SYSCALL_ENTER_KERNEL
30 .LEND_rt_sigreturn:
31         .size __kernel_rt_sigreturn,.-.LSTART_rt_sigreturn
33         .section .eh_frame,"a",@progbits
34         .long .LENDFDE2-.LSTARTFDE2     /* Length FDE */
35 .LSTARTFDE2:
36         .long .LSTARTFDE2-.LSTARTFRAME  /* CIE pointer */
37         /* HACK: The dwarf2 unwind routines will subtract 1 from the
38            return address to get an address in the middle of the
39            presumed call instruction.  Since we didn't get here via
40            a call, we need to include the nop before the real start
41            to make up for it.  */
42         .long .LSTART_sigreturn-1-.     /* PC-relative start address */
43         .long .LEND_sigreturn-.LSTART_sigreturn+1
44         .uleb128 0                      /* Augmentation length */
45         /* What follows are the instructions for the table generation.
46            We record the locations of each register saved.  This is
47            complicated by the fact that the "CFA" is always assumed to
48            be the value of the stack pointer in the caller.  This means
49            that we must define the CFA of this body of code to be the
50            saved value of the stack pointer in the sigcontext.  Which
51            also means that there is no fixed relation to the other 
52            saved registers, which means that we must use DW_CFA_expression
53            to compute their addresses.  It also means that when we 
54            adjust the stack with the popl, we have to do it all over again.  */
56 #define do_cfa_expr(offset)                                             \
57         .byte 0x0f;                     /* DW_CFA_def_cfa_expression */ \
58         .uleb128 1f-0f;                 /*   length */                  \
59 0:      .byte 0x74;                     /*     DW_OP_breg4 */           \
60         .sleb128 offset;                /*      offset */               \
61         .byte 0x06;                     /*     DW_OP_deref */           \
64 #define do_expr(regno, offset)                                          \
65         .byte 0x10;                     /* DW_CFA_expression */         \
66         .uleb128 regno;                 /*   regno */                   \
67         .uleb128 1f-0f;                 /*   length */                  \
68 0:      .byte 0x74;                     /*     DW_OP_breg4 */           \
69         .sleb128 offset;                /*       offset */              \
72         do_cfa_expr(IA32_SIGCONTEXT_esp+4)
73         do_expr(0, IA32_SIGCONTEXT_eax+4)
74         do_expr(1, IA32_SIGCONTEXT_ecx+4)
75         do_expr(2, IA32_SIGCONTEXT_edx+4)
76         do_expr(3, IA32_SIGCONTEXT_ebx+4)
77         do_expr(5, IA32_SIGCONTEXT_ebp+4)
78         do_expr(6, IA32_SIGCONTEXT_esi+4)
79         do_expr(7, IA32_SIGCONTEXT_edi+4)
80         do_expr(8, IA32_SIGCONTEXT_eip+4)
82         .byte 0x42      /* DW_CFA_advance_loc 2 -- nop; popl eax. */
84         do_cfa_expr(IA32_SIGCONTEXT_esp)
85         do_expr(0, IA32_SIGCONTEXT_eax)
86         do_expr(1, IA32_SIGCONTEXT_ecx)
87         do_expr(2, IA32_SIGCONTEXT_edx)
88         do_expr(3, IA32_SIGCONTEXT_ebx)
89         do_expr(5, IA32_SIGCONTEXT_ebp)
90         do_expr(6, IA32_SIGCONTEXT_esi)
91         do_expr(7, IA32_SIGCONTEXT_edi)
92         do_expr(8, IA32_SIGCONTEXT_eip)
94         .align 4
95 .LENDFDE2:
97         .long .LENDFDE3-.LSTARTFDE3     /* Length FDE */
98 .LSTARTFDE3:
99         .long .LSTARTFDE3-.LSTARTFRAME  /* CIE pointer */
100         /* HACK: See above wrt unwind library assumptions.  */
101         .long .LSTART_rt_sigreturn-1-.  /* PC-relative start address */
102         .long .LEND_rt_sigreturn-.LSTART_rt_sigreturn+1
103         .uleb128 0                      /* Augmentation */
104         /* What follows are the instructions for the table generation.
105            We record the locations of each register saved.  This is
106            slightly less complicated than the above, since we don't
107            modify the stack pointer in the process.  */
109         do_cfa_expr(IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_esp)
110         do_expr(0, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_eax)
111         do_expr(1, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ecx)
112         do_expr(2, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_edx)
113         do_expr(3, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ebx)
114         do_expr(5, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ebp)
115         do_expr(6, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_esi)
116         do_expr(7, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_edi)
117         do_expr(8, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_eip)
119         .align 4
120 .LENDFDE3: