cb421be0f754d35cba497b4d789cd914db326966
[linux-2.6.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         .text
11         .globl __kernel_vsyscall
12         .type __kernel_vsyscall,@function
13 __kernel_vsyscall:
14 .LSTART_vsyscall:
15         cmpl $192, %eax
16         jne 1f
17         int $0x80
18         ret
19 1:
20         push %ecx
21 .Lpush_ecx:
22         push %edx
23 .Lpush_edx:
24         push %ebp
25 .Lenter_kernel:
26         movl %esp,%ebp
27         sysenter
28
29         /* 7: align return point with nop's to make disassembly easier */
30         .space 7,0x90
31
32         /* 14: System call restart point is here! (SYSENTER_RETURN_OFFSET-2) */
33         jmp .Lenter_kernel
34         /* 16: System call normal return point is here! */
35         .globl SYSENTER_RETURN_OFFSET   /* Symbol used by sysenter.c  */
36 SYSENTER_RETURN_OFFSET:
37         pop %ebp
38 .Lpop_ebp:
39         pop %edx
40 .Lpop_edx:
41         pop %ecx
42 .Lpop_ecx:
43         ret
44 .LEND_vsyscall:
45         .size __kernel_vsyscall,.-.LSTART_vsyscall
46         .previous
47
48         .section .eh_frame,"a",@progbits
49 .LSTARTFRAMEDLSI:
50         .long .LENDCIEDLSI-.LSTARTCIEDLSI
51 .LSTARTCIEDLSI:
52         .long 0                 /* CIE ID */
53         .byte 1                 /* Version number */
54         .string "zR"            /* NUL-terminated augmentation string */
55         .uleb128 1              /* Code alignment factor */
56         .sleb128 -4             /* Data alignment factor */
57         .byte 8                 /* Return address register column */
58         .uleb128 1              /* Augmentation value length */
59         .byte 0x1b              /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
60         .byte 0x0c              /* DW_CFA_def_cfa */
61         .uleb128 4
62         .uleb128 4
63         .byte 0x88              /* DW_CFA_offset, column 0x8 */
64         .uleb128 1
65         .align 4
66 .LENDCIEDLSI:
67         .long .LENDFDEDLSI-.LSTARTFDEDLSI /* Length FDE */
68 .LSTARTFDEDLSI:
69         .long .LSTARTFDEDLSI-.LSTARTFRAMEDLSI /* CIE pointer */
70         .long .LSTART_vsyscall-.        /* PC-relative start address */
71         .long .LEND_vsyscall-.LSTART_vsyscall
72         .uleb128 0
73         /* What follows are the instructions for the table generation.
74            We have to record all changes of the stack pointer.  */
75         .byte 0x04              /* DW_CFA_advance_loc4 */
76         .long .Lpush_ecx-.LSTART_vsyscall
77         .byte 0x0e              /* DW_CFA_def_cfa_offset */
78         .byte 0x08              /* RA at offset 8 now */
79         .byte 0x04              /* DW_CFA_advance_loc4 */
80         .long .Lpush_edx-.Lpush_ecx
81         .byte 0x0e              /* DW_CFA_def_cfa_offset */
82         .byte 0x0c              /* RA at offset 12 now */
83         .byte 0x04              /* DW_CFA_advance_loc4 */
84         .long .Lenter_kernel-.Lpush_edx
85         .byte 0x0e              /* DW_CFA_def_cfa_offset */
86         .byte 0x10              /* RA at offset 16 now */
87         .byte 0x85, 0x04        /* DW_CFA_offset %ebp -16 */
88         /* Finally the epilogue.  */
89         .byte 0x04              /* DW_CFA_advance_loc4 */
90         .long .Lpop_ebp-.Lenter_kernel
91         .byte 0x0e              /* DW_CFA_def_cfa_offset */
92         .byte 0x12              /* RA at offset 12 now */
93         .byte 0xc5              /* DW_CFA_restore %ebp */
94         .byte 0x04              /* DW_CFA_advance_loc4 */
95         .long .Lpop_edx-.Lpop_ebp
96         .byte 0x0e              /* DW_CFA_def_cfa_offset */
97         .byte 0x08              /* RA at offset 8 now */
98         .byte 0x04              /* DW_CFA_advance_loc4 */
99         .long .Lpop_ecx-.Lpop_edx
100         .byte 0x0e              /* DW_CFA_def_cfa_offset */
101         .byte 0x04              /* RA at offset 4 now */
102         .align 4
103 .LENDFDEDLSI:
104         .previous
105
106 /*
107  * Get the common code for the sigreturn entry points.
108  */
109 #include "vsyscall-sigreturn.S"