Pull delete-sigdelayed into release branch
[pandora-kernel.git] / arch / i386 / kernel / vsyscall-sysenter.S
1 /*
2  * Code for the vsyscall page.  This version uses the sysenter instruction.
3  *
4  * NOTE:
5  * 1) __kernel_vsyscall _must_ be first in this page.
6  * 2) there are alignment constraints on this stub, see vsyscall-sigreturn.S
7  *    for details.
8  */
9
10 /*
11  * The caller puts arg2 in %ecx, which gets pushed. The kernel will use
12  * %ecx itself for arg2. The pushing is because the sysexit instruction
13  * (found in entry.S) requires that we clobber %ecx with the desired %esp.
14  * User code might expect that %ecx is unclobbered though, as it would be
15  * for returning via the iret instruction, so we must push and pop.
16  *
17  * The caller puts arg3 in %edx, which the sysexit instruction requires
18  * for %eip. Thus, exactly as for arg2, we must push and pop.
19  *
20  * Arg6 is different. The caller puts arg6 in %ebp. Since the sysenter
21  * instruction clobbers %esp, the user's %esp won't even survive entry
22  * into the kernel. We store %esp in %ebp. Code in entry.S must fetch
23  * arg6 from the stack.
24  */
25         .text
26         .globl __kernel_vsyscall
27         .type __kernel_vsyscall,@function
28 __kernel_vsyscall:
29 .LSTART_vsyscall:
30         push %ecx
31 .Lpush_ecx:
32         push %edx
33 .Lpush_edx:
34         push %ebp
35 .Lenter_kernel:
36         movl %esp,%ebp
37         sysenter
38
39         /* 7: align return point with nop's to make disassembly easier */
40         .space 7,0x90
41
42         /* 14: System call restart point is here! (SYSENTER_RETURN - 2) */
43         jmp .Lenter_kernel
44         /* 16: System call normal return point is here! */
45         .globl SYSENTER_RETURN  /* Symbol used by entry.S.  */
46 SYSENTER_RETURN:
47         pop %ebp
48 .Lpop_ebp:
49         pop %edx
50 .Lpop_edx:
51         pop %ecx
52 .Lpop_ecx:
53         ret
54 .LEND_vsyscall:
55         .size __kernel_vsyscall,.-.LSTART_vsyscall
56         .previous
57
58         .section .eh_frame,"a",@progbits
59 .LSTARTFRAMEDLSI:
60         .long .LENDCIEDLSI-.LSTARTCIEDLSI
61 .LSTARTCIEDLSI:
62         .long 0                 /* CIE ID */
63         .byte 1                 /* Version number */
64         .string "zR"            /* NUL-terminated augmentation string */
65         .uleb128 1              /* Code alignment factor */
66         .sleb128 -4             /* Data alignment factor */
67         .byte 8                 /* Return address register column */
68         .uleb128 1              /* Augmentation value length */
69         .byte 0x1b              /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
70         .byte 0x0c              /* DW_CFA_def_cfa */
71         .uleb128 4
72         .uleb128 4
73         .byte 0x88              /* DW_CFA_offset, column 0x8 */
74         .uleb128 1
75         .align 4
76 .LENDCIEDLSI:
77         .long .LENDFDEDLSI-.LSTARTFDEDLSI /* Length FDE */
78 .LSTARTFDEDLSI:
79         .long .LSTARTFDEDLSI-.LSTARTFRAMEDLSI /* CIE pointer */
80         .long .LSTART_vsyscall-.        /* PC-relative start address */
81         .long .LEND_vsyscall-.LSTART_vsyscall
82         .uleb128 0
83         /* What follows are the instructions for the table generation.
84            We have to record all changes of the stack pointer.  */
85         .byte 0x04              /* DW_CFA_advance_loc4 */
86         .long .Lpush_ecx-.LSTART_vsyscall
87         .byte 0x0e              /* DW_CFA_def_cfa_offset */
88         .byte 0x08              /* RA at offset 8 now */
89         .byte 0x04              /* DW_CFA_advance_loc4 */
90         .long .Lpush_edx-.Lpush_ecx
91         .byte 0x0e              /* DW_CFA_def_cfa_offset */
92         .byte 0x0c              /* RA at offset 12 now */
93         .byte 0x04              /* DW_CFA_advance_loc4 */
94         .long .Lenter_kernel-.Lpush_edx
95         .byte 0x0e              /* DW_CFA_def_cfa_offset */
96         .byte 0x10              /* RA at offset 16 now */
97         .byte 0x85, 0x04        /* DW_CFA_offset %ebp -16 */
98         /* Finally the epilogue.  */
99         .byte 0x04              /* DW_CFA_advance_loc4 */
100         .long .Lpop_ebp-.Lenter_kernel
101         .byte 0x0e              /* DW_CFA_def_cfa_offset */
102         .byte 0x0c              /* RA at offset 12 now */
103         .byte 0xc5              /* DW_CFA_restore %ebp */
104         .byte 0x04              /* DW_CFA_advance_loc4 */
105         .long .Lpop_edx-.Lpop_ebp
106         .byte 0x0e              /* DW_CFA_def_cfa_offset */
107         .byte 0x08              /* RA at offset 8 now */
108         .byte 0x04              /* DW_CFA_advance_loc4 */
109         .long .Lpop_ecx-.Lpop_edx
110         .byte 0x0e              /* DW_CFA_def_cfa_offset */
111         .byte 0x04              /* RA at offset 4 now */
112         .align 4
113 .LENDFDEDLSI:
114         .previous
115
116 /*
117  * Get the common code for the sigreturn entry points.
118  */
119 #include "vsyscall-sigreturn.S"