blob: 3aefbce2de487e4562b3ce81cf9d926e75878155 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Compatibility mode system call entry point for x86-64.
3 *
4 * Copyright 2000-2002 Andi Kleen, SuSE Labs.
5 */
6
7#include <asm/dwarf2.h>
8#include <asm/calling.h>
Sam Ravnborge2d5df92005-09-09 21:28:48 +02009#include <asm/asm-offsets.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <asm/current.h>
11#include <asm/errno.h>
12#include <asm/ia32_unistd.h>
13#include <asm/thread_info.h>
14#include <asm/segment.h>
Ingo Molnar2601e642006-07-03 00:24:45 -070015#include <asm/irqflags.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <linux/linkage.h>
17
Andi Kleen67d53ea2006-04-07 19:50:31 +020018#define IA32_NR_syscalls ((ia32_syscall_end - ia32_sys_call_table)/8)
19
Linus Torvalds1da177e2005-04-16 15:20:36 -070020 .macro IA32_ARG_FIXUP noebp=0
21 movl %edi,%r8d
22 .if \noebp
23 .else
24 movl %ebp,%r9d
25 .endif
26 xchg %ecx,%esi
27 movl %ebx,%edi
28 movl %edx,%edx /* zero extension */
29 .endm
30
31 /* clobbers %eax */
32 .macro CLEAR_RREGS
33 xorl %eax,%eax
34 movq %rax,R11(%rsp)
35 movq %rax,R10(%rsp)
36 movq %rax,R9(%rsp)
37 movq %rax,R8(%rsp)
38 .endm
39
Andi Kleen176df242007-09-21 16:16:18 +020040 .macro LOAD_ARGS32 offset
41 movl \offset(%rsp),%r11d
42 movl \offset+8(%rsp),%r10d
43 movl \offset+16(%rsp),%r9d
44 movl \offset+24(%rsp),%r8d
45 movl \offset+40(%rsp),%ecx
46 movl \offset+48(%rsp),%edx
47 movl \offset+56(%rsp),%esi
48 movl \offset+64(%rsp),%edi
49 movl \offset+72(%rsp),%eax
50 .endm
51
Jan Beulich27651302006-01-11 22:41:59 +010052 .macro CFI_STARTPROC32 simple
53 CFI_STARTPROC \simple
54 CFI_UNDEFINED r8
55 CFI_UNDEFINED r9
56 CFI_UNDEFINED r10
57 CFI_UNDEFINED r11
58 CFI_UNDEFINED r12
59 CFI_UNDEFINED r13
60 CFI_UNDEFINED r14
61 CFI_UNDEFINED r15
62 .endm
63
Linus Torvalds1da177e2005-04-16 15:20:36 -070064/*
65 * 32bit SYSENTER instruction entry.
66 *
67 * Arguments:
68 * %eax System call number.
69 * %ebx Arg1
70 * %ecx Arg2
71 * %edx Arg3
72 * %esi Arg4
73 * %edi Arg5
74 * %ebp user stack
75 * 0(%ebp) Arg6
76 *
77 * Interrupts off.
78 *
79 * This is purely a fast path. For anything complicated we use the int 0x80
80 * path below. Set up a complete hardware stack frame to share code
81 * with the int 0x80 path.
82 */
83ENTRY(ia32_sysenter_target)
Jan Beulich27651302006-01-11 22:41:59 +010084 CFI_STARTPROC32 simple
Jan Beulichadf14232006-09-26 10:52:41 +020085 CFI_SIGNAL_FRAME
Jan Beulich7effaa82005-09-12 18:49:24 +020086 CFI_DEF_CFA rsp,0
87 CFI_REGISTER rsp,rbp
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 swapgs
89 movq %gs:pda_kernelstack, %rsp
90 addq $(PDA_STACKOFFSET),%rsp
Ingo Molnar2601e642006-07-03 00:24:45 -070091 /*
92 * No need to follow this irqs on/off section: the syscall
93 * disabled irqs, here we enable it straight after entry:
94 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070095 sti
96 movl %ebp,%ebp /* zero extension */
97 pushq $__USER32_DS
Jan Beulich7effaa82005-09-12 18:49:24 +020098 CFI_ADJUST_CFA_OFFSET 8
99 /*CFI_REL_OFFSET ss,0*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100 pushq %rbp
Jan Beulich7effaa82005-09-12 18:49:24 +0200101 CFI_ADJUST_CFA_OFFSET 8
102 CFI_REL_OFFSET rsp,0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 pushfq
Jan Beulich7effaa82005-09-12 18:49:24 +0200104 CFI_ADJUST_CFA_OFFSET 8
105 /*CFI_REL_OFFSET rflags,0*/
Roland McGrath36197c92008-01-30 13:30:43 +0100106 movl 8*3-THREAD_SIZE+threadinfo_sysenter_return(%rsp), %r10d
Jan Beulich7effaa82005-09-12 18:49:24 +0200107 CFI_REGISTER rip,r10
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108 pushq $__USER32_CS
Jan Beulich7effaa82005-09-12 18:49:24 +0200109 CFI_ADJUST_CFA_OFFSET 8
110 /*CFI_REL_OFFSET cs,0*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111 movl %eax, %eax
112 pushq %r10
Jan Beulich7effaa82005-09-12 18:49:24 +0200113 CFI_ADJUST_CFA_OFFSET 8
114 CFI_REL_OFFSET rip,0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 pushq %rax
Jan Beulich7effaa82005-09-12 18:49:24 +0200116 CFI_ADJUST_CFA_OFFSET 8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117 cld
Jan Beulichcdc17932007-07-21 17:10:20 +0200118 SAVE_ARGS 0,0,1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119 /* no need to do an access_ok check here because rbp has been
120 32bit zero extended */
1211: movl (%rbp),%r9d
122 .section __ex_table,"a"
123 .quad 1b,ia32_badarg
124 .previous
125 GET_THREAD_INFO(%r10)
Andi Kleenbf2fcc62006-01-11 22:44:06 +0100126 orl $TS_COMPAT,threadinfo_status(%r10)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
Jan Beulich7effaa82005-09-12 18:49:24 +0200128 CFI_REMEMBER_STATE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129 jnz sysenter_tracesys
130sysenter_do_call:
Andi Kleen67d53ea2006-04-07 19:50:31 +0200131 cmpl $(IA32_NR_syscalls-1),%eax
132 ja ia32_badsys
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 IA32_ARG_FIXUP 1
134 call *ia32_sys_call_table(,%rax,8)
135 movq %rax,RAX-ARGOFFSET(%rsp)
136 GET_THREAD_INFO(%r10)
137 cli
Ingo Molnar2601e642006-07-03 00:24:45 -0700138 TRACE_IRQS_OFF
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139 testl $_TIF_ALLWORK_MASK,threadinfo_flags(%r10)
140 jnz int_ret_from_sys_call
Andi Kleenbf2fcc62006-01-11 22:44:06 +0100141 andl $~TS_COMPAT,threadinfo_status(%r10)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142 /* clear IF, that popfq doesn't enable interrupts early */
143 andl $~0x200,EFLAGS-R11(%rsp)
Roland McGrath36197c92008-01-30 13:30:43 +0100144 movl RIP-R11(%rsp),%edx /* User %eip */
145 CFI_REGISTER rip,rdx
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146 RESTORE_ARGS 1,24,1,1,1,1
147 popfq
Jan Beulich7effaa82005-09-12 18:49:24 +0200148 CFI_ADJUST_CFA_OFFSET -8
149 /*CFI_RESTORE rflags*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150 popq %rcx /* User %esp */
Jan Beulich7effaa82005-09-12 18:49:24 +0200151 CFI_ADJUST_CFA_OFFSET -8
152 CFI_REGISTER rsp,rcx
Ingo Molnar2601e642006-07-03 00:24:45 -0700153 TRACE_IRQS_ON
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154 swapgs
155 sti /* sti only takes effect after the next instruction */
156 /* sysexit */
157 .byte 0xf, 0x35
158
159sysenter_tracesys:
Jan Beulich7effaa82005-09-12 18:49:24 +0200160 CFI_RESTORE_STATE
Chuck Ebbertecd744e2007-11-07 10:48:39 -0500161 xchgl %r9d,%ebp
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162 SAVE_REST
163 CLEAR_RREGS
Chuck Ebbertecd744e2007-11-07 10:48:39 -0500164 movq %r9,R9(%rsp)
Roland McGrath48ee6792008-03-18 18:23:50 -0700165 movq $-ENOSYS,RAX(%rsp)/* ptrace can change this for a bad syscall */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166 movq %rsp,%rdi /* &pt_regs -> arg1 */
167 call syscall_trace_enter
Andi Kleen176df242007-09-21 16:16:18 +0200168 LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169 RESTORE_REST
Chuck Ebbertecd744e2007-11-07 10:48:39 -0500170 xchgl %ebp,%r9d
Roland McGrath48ee6792008-03-18 18:23:50 -0700171 cmpl $(IA32_NR_syscalls-1),%eax
172 ja int_ret_from_sys_call /* sysenter_tracesys has set RAX(%rsp) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173 jmp sysenter_do_call
174 CFI_ENDPROC
Jan Beulich4b787e02006-06-26 13:56:55 +0200175ENDPROC(ia32_sysenter_target)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176
177/*
178 * 32bit SYSCALL instruction entry.
179 *
180 * Arguments:
181 * %eax System call number.
182 * %ebx Arg1
183 * %ecx return EIP
184 * %edx Arg3
185 * %esi Arg4
186 * %edi Arg5
187 * %ebp Arg2 [note: not saved in the stack frame, should not be touched]
188 * %esp user stack
189 * 0(%esp) Arg6
190 *
191 * Interrupts off.
192 *
193 * This is purely a fast path. For anything complicated we use the int 0x80
194 * path below. Set up a complete hardware stack frame to share code
195 * with the int 0x80 path.
196 */
197ENTRY(ia32_cstar_target)
Jan Beulich27651302006-01-11 22:41:59 +0100198 CFI_STARTPROC32 simple
Jan Beulichadf14232006-09-26 10:52:41 +0200199 CFI_SIGNAL_FRAME
Jan Beulichdffead42006-06-26 13:57:38 +0200200 CFI_DEF_CFA rsp,PDA_STACKOFFSET
Jan Beulich7effaa82005-09-12 18:49:24 +0200201 CFI_REGISTER rip,rcx
202 /*CFI_REGISTER rflags,r11*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203 swapgs
204 movl %esp,%r8d
Jan Beulich7effaa82005-09-12 18:49:24 +0200205 CFI_REGISTER rsp,r8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206 movq %gs:pda_kernelstack,%rsp
Ingo Molnar2601e642006-07-03 00:24:45 -0700207 /*
208 * No need to follow this irqs on/off section: the syscall
209 * disabled irqs and here we enable it straight after entry:
210 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700211 sti
212 SAVE_ARGS 8,1,1
213 movl %eax,%eax /* zero extension */
214 movq %rax,ORIG_RAX-ARGOFFSET(%rsp)
215 movq %rcx,RIP-ARGOFFSET(%rsp)
Jan Beulich7effaa82005-09-12 18:49:24 +0200216 CFI_REL_OFFSET rip,RIP-ARGOFFSET
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217 movq %rbp,RCX-ARGOFFSET(%rsp) /* this lies slightly to ptrace */
218 movl %ebp,%ecx
219 movq $__USER32_CS,CS-ARGOFFSET(%rsp)
220 movq $__USER32_DS,SS-ARGOFFSET(%rsp)
221 movq %r11,EFLAGS-ARGOFFSET(%rsp)
Jan Beulich7effaa82005-09-12 18:49:24 +0200222 /*CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223 movq %r8,RSP-ARGOFFSET(%rsp)
Jan Beulich7effaa82005-09-12 18:49:24 +0200224 CFI_REL_OFFSET rsp,RSP-ARGOFFSET
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225 /* no need to do an access_ok check here because r8 has been
226 32bit zero extended */
227 /* hardware stack frame is complete now */
2281: movl (%r8),%r9d
229 .section __ex_table,"a"
230 .quad 1b,ia32_badarg
231 .previous
232 GET_THREAD_INFO(%r10)
Andi Kleenbf2fcc62006-01-11 22:44:06 +0100233 orl $TS_COMPAT,threadinfo_status(%r10)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
Jan Beulich7effaa82005-09-12 18:49:24 +0200235 CFI_REMEMBER_STATE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236 jnz cstar_tracesys
237cstar_do_call:
Andi Kleen67d53ea2006-04-07 19:50:31 +0200238 cmpl $IA32_NR_syscalls-1,%eax
239 ja ia32_badsys
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240 IA32_ARG_FIXUP 1
241 call *ia32_sys_call_table(,%rax,8)
242 movq %rax,RAX-ARGOFFSET(%rsp)
243 GET_THREAD_INFO(%r10)
244 cli
Ingo Molnar2601e642006-07-03 00:24:45 -0700245 TRACE_IRQS_OFF
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246 testl $_TIF_ALLWORK_MASK,threadinfo_flags(%r10)
247 jnz int_ret_from_sys_call
Andi Kleenbf2fcc62006-01-11 22:44:06 +0100248 andl $~TS_COMPAT,threadinfo_status(%r10)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249 RESTORE_ARGS 1,-ARG_SKIP,1,1,1
250 movl RIP-ARGOFFSET(%rsp),%ecx
Jan Beulich7effaa82005-09-12 18:49:24 +0200251 CFI_REGISTER rip,rcx
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252 movl EFLAGS-ARGOFFSET(%rsp),%r11d
Jan Beulich7effaa82005-09-12 18:49:24 +0200253 /*CFI_REGISTER rflags,r11*/
Ingo Molnar2601e642006-07-03 00:24:45 -0700254 TRACE_IRQS_ON
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255 movl RSP-ARGOFFSET(%rsp),%esp
Jan Beulich7effaa82005-09-12 18:49:24 +0200256 CFI_RESTORE rsp
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257 swapgs
258 sysretl
259
260cstar_tracesys:
Jan Beulich7effaa82005-09-12 18:49:24 +0200261 CFI_RESTORE_STATE
Chuck Ebbertecd744e2007-11-07 10:48:39 -0500262 xchgl %r9d,%ebp
Linus Torvalds1da177e2005-04-16 15:20:36 -0700263 SAVE_REST
264 CLEAR_RREGS
Chuck Ebbertecd744e2007-11-07 10:48:39 -0500265 movq %r9,R9(%rsp)
Roland McGrath48ee6792008-03-18 18:23:50 -0700266 movq $-ENOSYS,RAX(%rsp) /* ptrace can change this for a bad syscall */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700267 movq %rsp,%rdi /* &pt_regs -> arg1 */
268 call syscall_trace_enter
Andi Kleen176df242007-09-21 16:16:18 +0200269 LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270 RESTORE_REST
Chuck Ebbertecd744e2007-11-07 10:48:39 -0500271 xchgl %ebp,%r9d
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272 movl RSP-ARGOFFSET(%rsp), %r8d
Roland McGrath48ee6792008-03-18 18:23:50 -0700273 cmpl $(IA32_NR_syscalls-1),%eax
274 ja int_ret_from_sys_call /* cstar_tracesys has set RAX(%rsp) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275 jmp cstar_do_call
Jan Beulich4b787e02006-06-26 13:56:55 +0200276END(ia32_cstar_target)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700277
278ia32_badarg:
279 movq $-EFAULT,%rax
280 jmp ia32_sysret
281 CFI_ENDPROC
282
283/*
284 * Emulated IA32 system calls via int 0x80.
285 *
286 * Arguments:
287 * %eax System call number.
288 * %ebx Arg1
289 * %ecx Arg2
290 * %edx Arg3
291 * %esi Arg4
292 * %edi Arg5
293 * %ebp Arg6 [note: not saved in the stack frame, should not be touched]
294 *
295 * Notes:
296 * Uses the same stack frame as the x86-64 version.
297 * All registers except %eax must be saved (but ptrace may violate that)
298 * Arguments are zero extended. For system calls that want sign extension and
299 * take long arguments a wrapper is needed. Most calls can just be called
300 * directly.
301 * Assumes it is only called from user space and entered with interrupts off.
302 */
303
304ENTRY(ia32_syscall)
Jan Beulichcdc17932007-07-21 17:10:20 +0200305 CFI_STARTPROC32 simple
Jan Beulichadf14232006-09-26 10:52:41 +0200306 CFI_SIGNAL_FRAME
Jan Beulich7effaa82005-09-12 18:49:24 +0200307 CFI_DEF_CFA rsp,SS+8-RIP
308 /*CFI_REL_OFFSET ss,SS-RIP*/
309 CFI_REL_OFFSET rsp,RSP-RIP
310 /*CFI_REL_OFFSET rflags,EFLAGS-RIP*/
311 /*CFI_REL_OFFSET cs,CS-RIP*/
312 CFI_REL_OFFSET rip,RIP-RIP
Ingo Molnar2601e642006-07-03 00:24:45 -0700313 swapgs
314 /*
315 * No need to follow this irqs on/off section: the syscall
316 * disabled irqs and here we enable it straight after entry:
317 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318 sti
319 movl %eax,%eax
320 pushq %rax
Jan Beulich7effaa82005-09-12 18:49:24 +0200321 CFI_ADJUST_CFA_OFFSET 8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322 cld
323 /* note the registers are not zero extended to the sf.
324 this could be a problem. */
325 SAVE_ARGS 0,0,1
326 GET_THREAD_INFO(%r10)
Andi Kleenbf2fcc62006-01-11 22:44:06 +0100327 orl $TS_COMPAT,threadinfo_status(%r10)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700328 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
329 jnz ia32_tracesys
330ia32_do_syscall:
Andi Kleen67d53ea2006-04-07 19:50:31 +0200331 cmpl $(IA32_NR_syscalls-1),%eax
Roland McGrath8ab32bb2008-03-16 21:57:41 -0700332 ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700333 IA32_ARG_FIXUP
334 call *ia32_sys_call_table(,%rax,8) # xxx: rip relative
335ia32_sysret:
336 movq %rax,RAX-ARGOFFSET(%rsp)
337 jmp int_ret_from_sys_call
338
339ia32_tracesys:
340 SAVE_REST
Jan Beulichcdc17932007-07-21 17:10:20 +0200341 CLEAR_RREGS
Roland McGrath8ab32bb2008-03-16 21:57:41 -0700342 movq $-ENOSYS,RAX(%rsp) /* ptrace can change this for a bad syscall */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343 movq %rsp,%rdi /* &pt_regs -> arg1 */
344 call syscall_trace_enter
Andi Kleen176df242007-09-21 16:16:18 +0200345 LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700346 RESTORE_REST
347 jmp ia32_do_syscall
Jan Beulich4b787e02006-06-26 13:56:55 +0200348END(ia32_syscall)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700349
350ia32_badsys:
351 movq $0,ORIG_RAX-ARGOFFSET(%rsp)
352 movq $-ENOSYS,RAX-ARGOFFSET(%rsp)
353 jmp int_ret_from_sys_call
354
Linus Torvalds1da177e2005-04-16 15:20:36 -0700355quiet_ni_syscall:
356 movq $-ENOSYS,%rax
357 ret
358 CFI_ENDPROC
359
360 .macro PTREGSCALL label, func, arg
361 .globl \label
362\label:
363 leaq \func(%rip),%rax
364 leaq -ARGOFFSET+8(%rsp),\arg /* 8 for return address */
365 jmp ia32_ptregs_common
366 .endm
367
Jan Beulich27651302006-01-11 22:41:59 +0100368 CFI_STARTPROC32
Jan Beulich7effaa82005-09-12 18:49:24 +0200369
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370 PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi
371 PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi
372 PTREGSCALL stub32_sigaltstack, sys32_sigaltstack, %rdx
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373 PTREGSCALL stub32_execve, sys32_execve, %rcx
374 PTREGSCALL stub32_fork, sys_fork, %rdi
375 PTREGSCALL stub32_clone, sys32_clone, %rdx
376 PTREGSCALL stub32_vfork, sys_vfork, %rdi
377 PTREGSCALL stub32_iopl, sys_iopl, %rsi
Linus Torvalds1da177e2005-04-16 15:20:36 -0700378
379ENTRY(ia32_ptregs_common)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380 popq %r11
Jan Beulich27651302006-01-11 22:41:59 +0100381 CFI_ENDPROC
382 CFI_STARTPROC32 simple
Jan Beulichadf14232006-09-26 10:52:41 +0200383 CFI_SIGNAL_FRAME
Jan Beulich27651302006-01-11 22:41:59 +0100384 CFI_DEF_CFA rsp,SS+8-ARGOFFSET
385 CFI_REL_OFFSET rax,RAX-ARGOFFSET
386 CFI_REL_OFFSET rcx,RCX-ARGOFFSET
387 CFI_REL_OFFSET rdx,RDX-ARGOFFSET
388 CFI_REL_OFFSET rsi,RSI-ARGOFFSET
389 CFI_REL_OFFSET rdi,RDI-ARGOFFSET
390 CFI_REL_OFFSET rip,RIP-ARGOFFSET
391/* CFI_REL_OFFSET cs,CS-ARGOFFSET*/
392/* CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/
393 CFI_REL_OFFSET rsp,RSP-ARGOFFSET
394/* CFI_REL_OFFSET ss,SS-ARGOFFSET*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700395 SAVE_REST
396 call *%rax
397 RESTORE_REST
398 jmp ia32_sysret /* misbalances the return cache */
399 CFI_ENDPROC
Jan Beulich4b787e02006-06-26 13:56:55 +0200400END(ia32_ptregs_common)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401
Arjan van de Venbb152f52006-01-06 00:12:05 -0800402 .section .rodata,"a"
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403 .align 8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700404ia32_sys_call_table:
405 .quad sys_restart_syscall
406 .quad sys_exit
407 .quad stub32_fork
408 .quad sys_read
409 .quad sys_write
Miklos Szeredie922efc2005-09-06 15:18:25 -0700410 .quad compat_sys_open /* 5 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411 .quad sys_close
412 .quad sys32_waitpid
413 .quad sys_creat
414 .quad sys_link
415 .quad sys_unlink /* 10 */
416 .quad stub32_execve
417 .quad sys_chdir
418 .quad compat_sys_time
419 .quad sys_mknod
420 .quad sys_chmod /* 15 */
421 .quad sys_lchown16
422 .quad quiet_ni_syscall /* old break syscall holder */
423 .quad sys_stat
424 .quad sys32_lseek
425 .quad sys_getpid /* 20 */
426 .quad compat_sys_mount /* mount */
427 .quad sys_oldumount /* old_umount */
428 .quad sys_setuid16
429 .quad sys_getuid16
430 .quad compat_sys_stime /* stime */ /* 25 */
Roland McGrath562b80b2008-04-22 12:21:25 -0700431 .quad compat_sys_ptrace /* ptrace */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432 .quad sys_alarm
433 .quad sys_fstat /* (old)fstat */
434 .quad sys_pause
435 .quad compat_sys_utime /* 30 */
436 .quad quiet_ni_syscall /* old stty syscall holder */
437 .quad quiet_ni_syscall /* old gtty syscall holder */
438 .quad sys_access
439 .quad sys_nice
440 .quad quiet_ni_syscall /* 35 */ /* old ftime syscall holder */
441 .quad sys_sync
442 .quad sys32_kill
443 .quad sys_rename
444 .quad sys_mkdir
445 .quad sys_rmdir /* 40 */
446 .quad sys_dup
447 .quad sys32_pipe
448 .quad compat_sys_times
449 .quad quiet_ni_syscall /* old prof syscall holder */
450 .quad sys_brk /* 45 */
451 .quad sys_setgid16
452 .quad sys_getgid16
453 .quad sys_signal
454 .quad sys_geteuid16
455 .quad sys_getegid16 /* 50 */
456 .quad sys_acct
457 .quad sys_umount /* new_umount */
458 .quad quiet_ni_syscall /* old lock syscall holder */
459 .quad compat_sys_ioctl
460 .quad compat_sys_fcntl64 /* 55 */
461 .quad quiet_ni_syscall /* old mpx syscall holder */
462 .quad sys_setpgid
463 .quad quiet_ni_syscall /* old ulimit syscall holder */
464 .quad sys32_olduname
465 .quad sys_umask /* 60 */
466 .quad sys_chroot
467 .quad sys32_ustat
468 .quad sys_dup2
469 .quad sys_getppid
470 .quad sys_getpgrp /* 65 */
471 .quad sys_setsid
472 .quad sys32_sigaction
473 .quad sys_sgetmask
474 .quad sys_ssetmask
475 .quad sys_setreuid16 /* 70 */
476 .quad sys_setregid16
Jan Beulich5f0120b2008-06-18 12:42:11 +0100477 .quad sys32_sigsuspend
Linus Torvalds1da177e2005-04-16 15:20:36 -0700478 .quad compat_sys_sigpending
479 .quad sys_sethostname
480 .quad compat_sys_setrlimit /* 75 */
481 .quad compat_sys_old_getrlimit /* old_getrlimit */
482 .quad compat_sys_getrusage
483 .quad sys32_gettimeofday
484 .quad sys32_settimeofday
485 .quad sys_getgroups16 /* 80 */
486 .quad sys_setgroups16
487 .quad sys32_old_select
488 .quad sys_symlink
489 .quad sys_lstat
490 .quad sys_readlink /* 85 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700491 .quad sys_uselib
Linus Torvalds1da177e2005-04-16 15:20:36 -0700492 .quad sys_swapon
493 .quad sys_reboot
494 .quad compat_sys_old_readdir
495 .quad sys32_mmap /* 90 */
496 .quad sys_munmap
497 .quad sys_truncate
498 .quad sys_ftruncate
499 .quad sys_fchmod
500 .quad sys_fchown16 /* 95 */
501 .quad sys_getpriority
502 .quad sys_setpriority
503 .quad quiet_ni_syscall /* old profil syscall holder */
504 .quad compat_sys_statfs
505 .quad compat_sys_fstatfs /* 100 */
506 .quad sys_ioperm
507 .quad compat_sys_socketcall
508 .quad sys_syslog
509 .quad compat_sys_setitimer
510 .quad compat_sys_getitimer /* 105 */
511 .quad compat_sys_newstat
512 .quad compat_sys_newlstat
513 .quad compat_sys_newfstat
514 .quad sys32_uname
515 .quad stub32_iopl /* 110 */
516 .quad sys_vhangup
517 .quad quiet_ni_syscall /* old "idle" system call */
518 .quad sys32_vm86_warning /* vm86old */
519 .quad compat_sys_wait4
520 .quad sys_swapoff /* 115 */
Kyle McMartind4d23ad2007-02-10 01:46:00 -0800521 .quad compat_sys_sysinfo
Linus Torvalds1da177e2005-04-16 15:20:36 -0700522 .quad sys32_ipc
523 .quad sys_fsync
524 .quad stub32_sigreturn
525 .quad stub32_clone /* 120 */
526 .quad sys_setdomainname
527 .quad sys_uname
528 .quad sys_modify_ldt
Stephen Rothwell3158e942006-03-26 01:37:29 -0800529 .quad compat_sys_adjtimex
Linus Torvalds1da177e2005-04-16 15:20:36 -0700530 .quad sys32_mprotect /* 125 */
531 .quad compat_sys_sigprocmask
532 .quad quiet_ni_syscall /* create_module */
533 .quad sys_init_module
534 .quad sys_delete_module
535 .quad quiet_ni_syscall /* 130 get_kernel_syms */
Vasily Tarasovb7163952007-07-15 23:41:12 -0700536 .quad sys32_quotactl
Linus Torvalds1da177e2005-04-16 15:20:36 -0700537 .quad sys_getpgid
538 .quad sys_fchdir
539 .quad quiet_ni_syscall /* bdflush */
540 .quad sys_sysfs /* 135 */
541 .quad sys_personality
542 .quad quiet_ni_syscall /* for afs_syscall */
543 .quad sys_setfsuid16
544 .quad sys_setfsgid16
545 .quad sys_llseek /* 140 */
546 .quad compat_sys_getdents
547 .quad compat_sys_select
548 .quad sys_flock
549 .quad sys_msync
550 .quad compat_sys_readv /* 145 */
551 .quad compat_sys_writev
552 .quad sys_getsid
553 .quad sys_fdatasync
554 .quad sys32_sysctl /* sysctl */
555 .quad sys_mlock /* 150 */
556 .quad sys_munlock
557 .quad sys_mlockall
558 .quad sys_munlockall
559 .quad sys_sched_setparam
560 .quad sys_sched_getparam /* 155 */
561 .quad sys_sched_setscheduler
562 .quad sys_sched_getscheduler
563 .quad sys_sched_yield
564 .quad sys_sched_get_priority_max
565 .quad sys_sched_get_priority_min /* 160 */
Alexandr Andreeva9bc3bf2007-03-16 21:07:36 +0100566 .quad sys32_sched_rr_get_interval
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567 .quad compat_sys_nanosleep
568 .quad sys_mremap
569 .quad sys_setresuid16
570 .quad sys_getresuid16 /* 165 */
571 .quad sys32_vm86_warning /* vm86 */
572 .quad quiet_ni_syscall /* query_module */
573 .quad sys_poll
574 .quad compat_sys_nfsservctl
575 .quad sys_setresgid16 /* 170 */
576 .quad sys_getresgid16
577 .quad sys_prctl
578 .quad stub32_rt_sigreturn
579 .quad sys32_rt_sigaction
580 .quad sys32_rt_sigprocmask /* 175 */
581 .quad sys32_rt_sigpending
582 .quad compat_sys_rt_sigtimedwait
583 .quad sys32_rt_sigqueueinfo
Jan Beulich5f0120b2008-06-18 12:42:11 +0100584 .quad sys_rt_sigsuspend
Linus Torvalds1da177e2005-04-16 15:20:36 -0700585 .quad sys32_pread /* 180 */
586 .quad sys32_pwrite
587 .quad sys_chown16
588 .quad sys_getcwd
589 .quad sys_capget
590 .quad sys_capset
591 .quad stub32_sigaltstack
592 .quad sys32_sendfile
593 .quad quiet_ni_syscall /* streams1 */
594 .quad quiet_ni_syscall /* streams2 */
595 .quad stub32_vfork /* 190 */
596 .quad compat_sys_getrlimit
597 .quad sys32_mmap2
598 .quad sys32_truncate64
599 .quad sys32_ftruncate64
600 .quad sys32_stat64 /* 195 */
601 .quad sys32_lstat64
602 .quad sys32_fstat64
603 .quad sys_lchown
604 .quad sys_getuid
605 .quad sys_getgid /* 200 */
606 .quad sys_geteuid
607 .quad sys_getegid
608 .quad sys_setreuid
609 .quad sys_setregid
610 .quad sys_getgroups /* 205 */
611 .quad sys_setgroups
612 .quad sys_fchown
613 .quad sys_setresuid
614 .quad sys_getresuid
615 .quad sys_setresgid /* 210 */
616 .quad sys_getresgid
617 .quad sys_chown
618 .quad sys_setuid
619 .quad sys_setgid
620 .quad sys_setfsuid /* 215 */
621 .quad sys_setfsgid
622 .quad sys_pivot_root
623 .quad sys_mincore
624 .quad sys_madvise
625 .quad compat_sys_getdents64 /* 220 getdents64 */
626 .quad compat_sys_fcntl64
627 .quad quiet_ni_syscall /* tux */
628 .quad quiet_ni_syscall /* security */
629 .quad sys_gettid
Andi Kleene412ac42007-06-20 12:23:30 +0200630 .quad sys32_readahead /* 225 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700631 .quad sys_setxattr
632 .quad sys_lsetxattr
633 .quad sys_fsetxattr
634 .quad sys_getxattr
635 .quad sys_lgetxattr /* 230 */
636 .quad sys_fgetxattr
637 .quad sys_listxattr
638 .quad sys_llistxattr
639 .quad sys_flistxattr
640 .quad sys_removexattr /* 235 */
641 .quad sys_lremovexattr
642 .quad sys_fremovexattr
643 .quad sys_tkill
644 .quad sys_sendfile64
645 .quad compat_sys_futex /* 240 */
646 .quad compat_sys_sched_setaffinity
647 .quad compat_sys_sched_getaffinity
Roland McGrathefd1ca52008-01-30 13:30:46 +0100648 .quad sys_set_thread_area
649 .quad sys_get_thread_area
Linus Torvalds1da177e2005-04-16 15:20:36 -0700650 .quad compat_sys_io_setup /* 245 */
651 .quad sys_io_destroy
652 .quad compat_sys_io_getevents
653 .quad compat_sys_io_submit
654 .quad sys_io_cancel
Andi Kleene412ac42007-06-20 12:23:30 +0200655 .quad sys32_fadvise64 /* 250 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700656 .quad quiet_ni_syscall /* free_huge_pages */
657 .quad sys_exit_group
658 .quad sys32_lookup_dcookie
659 .quad sys_epoll_create
660 .quad sys_epoll_ctl /* 255 */
661 .quad sys_epoll_wait
662 .quad sys_remap_file_pages
663 .quad sys_set_tid_address
Christoph Hellwig3a0f69d2006-01-09 20:52:08 -0800664 .quad compat_sys_timer_create
Linus Torvalds1da177e2005-04-16 15:20:36 -0700665 .quad compat_sys_timer_settime /* 260 */
666 .quad compat_sys_timer_gettime
667 .quad sys_timer_getoverrun
668 .quad sys_timer_delete
669 .quad compat_sys_clock_settime
670 .quad compat_sys_clock_gettime /* 265 */
671 .quad compat_sys_clock_getres
672 .quad compat_sys_clock_nanosleep
673 .quad compat_sys_statfs64
674 .quad compat_sys_fstatfs64
675 .quad sys_tgkill /* 270 */
676 .quad compat_sys_utimes
677 .quad sys32_fadvise64_64
678 .quad quiet_ni_syscall /* sys_vserver */
679 .quad sys_mbind
680 .quad compat_sys_get_mempolicy /* 275 */
681 .quad sys_set_mempolicy
682 .quad compat_sys_mq_open
683 .quad sys_mq_unlink
684 .quad compat_sys_mq_timedsend
685 .quad compat_sys_mq_timedreceive /* 280 */
686 .quad compat_sys_mq_notify
687 .quad compat_sys_mq_getsetattr
Eric W. Biederman5234f5e2005-06-25 14:58:02 -0700688 .quad compat_sys_kexec_load /* reserved for kexec */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700689 .quad compat_sys_waitid
Robert Love725b38ab2005-07-25 15:19:29 -0400690 .quad quiet_ni_syscall /* 285: sys_altroot */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700691 .quad sys_add_key
692 .quad sys_request_key
693 .quad sys_keyctl
Robert Love725b38ab2005-07-25 15:19:29 -0400694 .quad sys_ioprio_set
695 .quad sys_ioprio_get /* 290 */
696 .quad sys_inotify_init
697 .quad sys_inotify_add_watch
698 .quad sys_inotify_rm_watch
Christoph Lameter39743882006-01-08 01:00:51 -0800699 .quad sys_migrate_pages
Ulrich Dreppera60fc512006-01-18 17:43:56 -0800700 .quad compat_sys_openat /* 295 */
701 .quad sys_mkdirat
702 .quad sys_mknodat
703 .quad sys_fchownat
Andrew Morton3833a702006-02-01 03:04:32 -0800704 .quad compat_sys_futimesat
Ulrich Dreppercff2b762006-02-11 17:55:47 -0800705 .quad sys32_fstatat /* 300 */
Ulrich Dreppera60fc512006-01-18 17:43:56 -0800706 .quad sys_unlinkat
707 .quad sys_renameat
708 .quad sys_linkat
709 .quad sys_symlinkat
710 .quad sys_readlinkat /* 305 */
711 .quad sys_fchmodat
712 .quad sys_faccessat
Andi Kleen957dc872006-09-26 10:52:27 +0200713 .quad compat_sys_pselect6
714 .quad compat_sys_ppoll
Andi Kleen4b88f092006-02-09 00:35:50 +0100715 .quad sys_unshare /* 310 */
Ingo Molnar8fdd6c62006-03-27 01:16:26 -0800716 .quad compat_sys_set_robust_list
717 .quad compat_sys_get_robust_list
Andi Kleenb8feb472006-04-07 19:50:34 +0200718 .quad sys_splice
Andi Kleene412ac42007-06-20 12:23:30 +0200719 .quad sys32_sync_file_range
Ulrich Drepper1c710c82007-05-08 00:33:25 -0700720 .quad sys_tee /* 315 */
Andi Kleend2610202006-05-01 12:15:48 -0700721 .quad compat_sys_vmsplice
Christoph Lameter1b2db9f2006-06-23 02:03:56 -0700722 .quad compat_sys_move_pages
Andi Kleen3cfc3482006-09-26 10:52:28 +0200723 .quad sys_getcpu
Ralf Baechle9af3cf02007-02-13 13:26:26 +0100724 .quad sys_epoll_pwait
Ulrich Drepper1c710c82007-05-08 00:33:25 -0700725 .quad compat_sys_utimensat /* 320 */
Heiko Carstensae7d5c82007-05-12 17:27:41 +0200726 .quad compat_sys_signalfd
Davide Libenzicb9282e2008-02-04 22:27:28 -0800727 .quad sys_timerfd_create
Davide Libenzifdb902b2007-05-10 22:23:20 -0700728 .quad sys_eventfd
Amit Arora97ac7352007-07-17 21:42:44 -0400729 .quad sys32_fallocate
Davide Libenzicb9282e2008-02-04 22:27:28 -0800730 .quad compat_sys_timerfd_settime /* 325 */
731 .quad compat_sys_timerfd_gettime
Heiko Carstensae7d5c82007-05-12 17:27:41 +0200732ia32_syscall_end: