blob: 0db0a6291bbd06d059c654ce58f8e5d387d685c0 [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)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165 movq $-ENOSYS,RAX(%rsp) /* really needed? */
166 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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171 jmp sysenter_do_call
172 CFI_ENDPROC
Jan Beulich4b787e02006-06-26 13:56:55 +0200173ENDPROC(ia32_sysenter_target)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174
175/*
176 * 32bit SYSCALL instruction entry.
177 *
178 * Arguments:
179 * %eax System call number.
180 * %ebx Arg1
181 * %ecx return EIP
182 * %edx Arg3
183 * %esi Arg4
184 * %edi Arg5
185 * %ebp Arg2 [note: not saved in the stack frame, should not be touched]
186 * %esp user stack
187 * 0(%esp) Arg6
188 *
189 * Interrupts off.
190 *
191 * This is purely a fast path. For anything complicated we use the int 0x80
192 * path below. Set up a complete hardware stack frame to share code
193 * with the int 0x80 path.
194 */
195ENTRY(ia32_cstar_target)
Jan Beulich27651302006-01-11 22:41:59 +0100196 CFI_STARTPROC32 simple
Jan Beulichadf14232006-09-26 10:52:41 +0200197 CFI_SIGNAL_FRAME
Jan Beulichdffead42006-06-26 13:57:38 +0200198 CFI_DEF_CFA rsp,PDA_STACKOFFSET
Jan Beulich7effaa82005-09-12 18:49:24 +0200199 CFI_REGISTER rip,rcx
200 /*CFI_REGISTER rflags,r11*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201 swapgs
202 movl %esp,%r8d
Jan Beulich7effaa82005-09-12 18:49:24 +0200203 CFI_REGISTER rsp,r8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204 movq %gs:pda_kernelstack,%rsp
Ingo Molnar2601e642006-07-03 00:24:45 -0700205 /*
206 * No need to follow this irqs on/off section: the syscall
207 * disabled irqs and here we enable it straight after entry:
208 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209 sti
210 SAVE_ARGS 8,1,1
211 movl %eax,%eax /* zero extension */
212 movq %rax,ORIG_RAX-ARGOFFSET(%rsp)
213 movq %rcx,RIP-ARGOFFSET(%rsp)
Jan Beulich7effaa82005-09-12 18:49:24 +0200214 CFI_REL_OFFSET rip,RIP-ARGOFFSET
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215 movq %rbp,RCX-ARGOFFSET(%rsp) /* this lies slightly to ptrace */
216 movl %ebp,%ecx
217 movq $__USER32_CS,CS-ARGOFFSET(%rsp)
218 movq $__USER32_DS,SS-ARGOFFSET(%rsp)
219 movq %r11,EFLAGS-ARGOFFSET(%rsp)
Jan Beulich7effaa82005-09-12 18:49:24 +0200220 /*CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221 movq %r8,RSP-ARGOFFSET(%rsp)
Jan Beulich7effaa82005-09-12 18:49:24 +0200222 CFI_REL_OFFSET rsp,RSP-ARGOFFSET
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223 /* no need to do an access_ok check here because r8 has been
224 32bit zero extended */
225 /* hardware stack frame is complete now */
2261: movl (%r8),%r9d
227 .section __ex_table,"a"
228 .quad 1b,ia32_badarg
229 .previous
230 GET_THREAD_INFO(%r10)
Andi Kleenbf2fcc62006-01-11 22:44:06 +0100231 orl $TS_COMPAT,threadinfo_status(%r10)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
Jan Beulich7effaa82005-09-12 18:49:24 +0200233 CFI_REMEMBER_STATE
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234 jnz cstar_tracesys
235cstar_do_call:
Andi Kleen67d53ea2006-04-07 19:50:31 +0200236 cmpl $IA32_NR_syscalls-1,%eax
237 ja ia32_badsys
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 IA32_ARG_FIXUP 1
239 call *ia32_sys_call_table(,%rax,8)
240 movq %rax,RAX-ARGOFFSET(%rsp)
241 GET_THREAD_INFO(%r10)
242 cli
Ingo Molnar2601e642006-07-03 00:24:45 -0700243 TRACE_IRQS_OFF
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244 testl $_TIF_ALLWORK_MASK,threadinfo_flags(%r10)
245 jnz int_ret_from_sys_call
Andi Kleenbf2fcc62006-01-11 22:44:06 +0100246 andl $~TS_COMPAT,threadinfo_status(%r10)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247 RESTORE_ARGS 1,-ARG_SKIP,1,1,1
248 movl RIP-ARGOFFSET(%rsp),%ecx
Jan Beulich7effaa82005-09-12 18:49:24 +0200249 CFI_REGISTER rip,rcx
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250 movl EFLAGS-ARGOFFSET(%rsp),%r11d
Jan Beulich7effaa82005-09-12 18:49:24 +0200251 /*CFI_REGISTER rflags,r11*/
Ingo Molnar2601e642006-07-03 00:24:45 -0700252 TRACE_IRQS_ON
Linus Torvalds1da177e2005-04-16 15:20:36 -0700253 movl RSP-ARGOFFSET(%rsp),%esp
Jan Beulich7effaa82005-09-12 18:49:24 +0200254 CFI_RESTORE rsp
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255 swapgs
256 sysretl
257
258cstar_tracesys:
Jan Beulich7effaa82005-09-12 18:49:24 +0200259 CFI_RESTORE_STATE
Chuck Ebbertecd744e2007-11-07 10:48:39 -0500260 xchgl %r9d,%ebp
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261 SAVE_REST
262 CLEAR_RREGS
Chuck Ebbertecd744e2007-11-07 10:48:39 -0500263 movq %r9,R9(%rsp)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264 movq $-ENOSYS,RAX(%rsp) /* really needed? */
265 movq %rsp,%rdi /* &pt_regs -> arg1 */
266 call syscall_trace_enter
Andi Kleen176df242007-09-21 16:16:18 +0200267 LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268 RESTORE_REST
Chuck Ebbertecd744e2007-11-07 10:48:39 -0500269 xchgl %ebp,%r9d
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270 movl RSP-ARGOFFSET(%rsp), %r8d
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271 jmp cstar_do_call
Jan Beulich4b787e02006-06-26 13:56:55 +0200272END(ia32_cstar_target)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273
274ia32_badarg:
275 movq $-EFAULT,%rax
276 jmp ia32_sysret
277 CFI_ENDPROC
278
279/*
280 * Emulated IA32 system calls via int 0x80.
281 *
282 * Arguments:
283 * %eax System call number.
284 * %ebx Arg1
285 * %ecx Arg2
286 * %edx Arg3
287 * %esi Arg4
288 * %edi Arg5
289 * %ebp Arg6 [note: not saved in the stack frame, should not be touched]
290 *
291 * Notes:
292 * Uses the same stack frame as the x86-64 version.
293 * All registers except %eax must be saved (but ptrace may violate that)
294 * Arguments are zero extended. For system calls that want sign extension and
295 * take long arguments a wrapper is needed. Most calls can just be called
296 * directly.
297 * Assumes it is only called from user space and entered with interrupts off.
298 */
299
300ENTRY(ia32_syscall)
Jan Beulichcdc17932007-07-21 17:10:20 +0200301 CFI_STARTPROC32 simple
Jan Beulichadf14232006-09-26 10:52:41 +0200302 CFI_SIGNAL_FRAME
Jan Beulich7effaa82005-09-12 18:49:24 +0200303 CFI_DEF_CFA rsp,SS+8-RIP
304 /*CFI_REL_OFFSET ss,SS-RIP*/
305 CFI_REL_OFFSET rsp,RSP-RIP
306 /*CFI_REL_OFFSET rflags,EFLAGS-RIP*/
307 /*CFI_REL_OFFSET cs,CS-RIP*/
308 CFI_REL_OFFSET rip,RIP-RIP
Ingo Molnar2601e642006-07-03 00:24:45 -0700309 swapgs
310 /*
311 * No need to follow this irqs on/off section: the syscall
312 * disabled irqs and here we enable it straight after entry:
313 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700314 sti
315 movl %eax,%eax
316 pushq %rax
Jan Beulich7effaa82005-09-12 18:49:24 +0200317 CFI_ADJUST_CFA_OFFSET 8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318 cld
319 /* note the registers are not zero extended to the sf.
320 this could be a problem. */
321 SAVE_ARGS 0,0,1
322 GET_THREAD_INFO(%r10)
Andi Kleenbf2fcc62006-01-11 22:44:06 +0100323 orl $TS_COMPAT,threadinfo_status(%r10)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700324 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
325 jnz ia32_tracesys
326ia32_do_syscall:
Andi Kleen67d53ea2006-04-07 19:50:31 +0200327 cmpl $(IA32_NR_syscalls-1),%eax
328 ja ia32_badsys
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329 IA32_ARG_FIXUP
330 call *ia32_sys_call_table(,%rax,8) # xxx: rip relative
331ia32_sysret:
332 movq %rax,RAX-ARGOFFSET(%rsp)
333 jmp int_ret_from_sys_call
334
335ia32_tracesys:
336 SAVE_REST
Jan Beulichcdc17932007-07-21 17:10:20 +0200337 CLEAR_RREGS
Linus Torvalds1da177e2005-04-16 15:20:36 -0700338 movq $-ENOSYS,RAX(%rsp) /* really needed? */
339 movq %rsp,%rdi /* &pt_regs -> arg1 */
340 call syscall_trace_enter
Andi Kleen176df242007-09-21 16:16:18 +0200341 LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700342 RESTORE_REST
343 jmp ia32_do_syscall
Jan Beulich4b787e02006-06-26 13:56:55 +0200344END(ia32_syscall)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345
346ia32_badsys:
347 movq $0,ORIG_RAX-ARGOFFSET(%rsp)
348 movq $-ENOSYS,RAX-ARGOFFSET(%rsp)
349 jmp int_ret_from_sys_call
350
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351quiet_ni_syscall:
352 movq $-ENOSYS,%rax
353 ret
354 CFI_ENDPROC
355
356 .macro PTREGSCALL label, func, arg
357 .globl \label
358\label:
359 leaq \func(%rip),%rax
360 leaq -ARGOFFSET+8(%rsp),\arg /* 8 for return address */
361 jmp ia32_ptregs_common
362 .endm
363
Jan Beulich27651302006-01-11 22:41:59 +0100364 CFI_STARTPROC32
Jan Beulich7effaa82005-09-12 18:49:24 +0200365
Linus Torvalds1da177e2005-04-16 15:20:36 -0700366 PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi
367 PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi
368 PTREGSCALL stub32_sigaltstack, sys32_sigaltstack, %rdx
369 PTREGSCALL stub32_sigsuspend, sys32_sigsuspend, %rcx
370 PTREGSCALL stub32_execve, sys32_execve, %rcx
371 PTREGSCALL stub32_fork, sys_fork, %rdi
372 PTREGSCALL stub32_clone, sys32_clone, %rdx
373 PTREGSCALL stub32_vfork, sys_vfork, %rdi
374 PTREGSCALL stub32_iopl, sys_iopl, %rsi
375 PTREGSCALL stub32_rt_sigsuspend, sys_rt_sigsuspend, %rdx
376
377ENTRY(ia32_ptregs_common)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700378 popq %r11
Jan Beulich27651302006-01-11 22:41:59 +0100379 CFI_ENDPROC
380 CFI_STARTPROC32 simple
Jan Beulichadf14232006-09-26 10:52:41 +0200381 CFI_SIGNAL_FRAME
Jan Beulich27651302006-01-11 22:41:59 +0100382 CFI_DEF_CFA rsp,SS+8-ARGOFFSET
383 CFI_REL_OFFSET rax,RAX-ARGOFFSET
384 CFI_REL_OFFSET rcx,RCX-ARGOFFSET
385 CFI_REL_OFFSET rdx,RDX-ARGOFFSET
386 CFI_REL_OFFSET rsi,RSI-ARGOFFSET
387 CFI_REL_OFFSET rdi,RDI-ARGOFFSET
388 CFI_REL_OFFSET rip,RIP-ARGOFFSET
389/* CFI_REL_OFFSET cs,CS-ARGOFFSET*/
390/* CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/
391 CFI_REL_OFFSET rsp,RSP-ARGOFFSET
392/* CFI_REL_OFFSET ss,SS-ARGOFFSET*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393 SAVE_REST
394 call *%rax
395 RESTORE_REST
396 jmp ia32_sysret /* misbalances the return cache */
397 CFI_ENDPROC
Jan Beulich4b787e02006-06-26 13:56:55 +0200398END(ia32_ptregs_common)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399
Arjan van de Venbb152f52006-01-06 00:12:05 -0800400 .section .rodata,"a"
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401 .align 8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402ia32_sys_call_table:
403 .quad sys_restart_syscall
404 .quad sys_exit
405 .quad stub32_fork
406 .quad sys_read
407 .quad sys_write
Miklos Szeredie922efc2005-09-06 15:18:25 -0700408 .quad compat_sys_open /* 5 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409 .quad sys_close
410 .quad sys32_waitpid
411 .quad sys_creat
412 .quad sys_link
413 .quad sys_unlink /* 10 */
414 .quad stub32_execve
415 .quad sys_chdir
416 .quad compat_sys_time
417 .quad sys_mknod
418 .quad sys_chmod /* 15 */
419 .quad sys_lchown16
420 .quad quiet_ni_syscall /* old break syscall holder */
421 .quad sys_stat
422 .quad sys32_lseek
423 .quad sys_getpid /* 20 */
424 .quad compat_sys_mount /* mount */
425 .quad sys_oldumount /* old_umount */
426 .quad sys_setuid16
427 .quad sys_getuid16
428 .quad compat_sys_stime /* stime */ /* 25 */
429 .quad sys32_ptrace /* ptrace */
430 .quad sys_alarm
431 .quad sys_fstat /* (old)fstat */
432 .quad sys_pause
433 .quad compat_sys_utime /* 30 */
434 .quad quiet_ni_syscall /* old stty syscall holder */
435 .quad quiet_ni_syscall /* old gtty syscall holder */
436 .quad sys_access
437 .quad sys_nice
438 .quad quiet_ni_syscall /* 35 */ /* old ftime syscall holder */
439 .quad sys_sync
440 .quad sys32_kill
441 .quad sys_rename
442 .quad sys_mkdir
443 .quad sys_rmdir /* 40 */
444 .quad sys_dup
445 .quad sys32_pipe
446 .quad compat_sys_times
447 .quad quiet_ni_syscall /* old prof syscall holder */
448 .quad sys_brk /* 45 */
449 .quad sys_setgid16
450 .quad sys_getgid16
451 .quad sys_signal
452 .quad sys_geteuid16
453 .quad sys_getegid16 /* 50 */
454 .quad sys_acct
455 .quad sys_umount /* new_umount */
456 .quad quiet_ni_syscall /* old lock syscall holder */
457 .quad compat_sys_ioctl
458 .quad compat_sys_fcntl64 /* 55 */
459 .quad quiet_ni_syscall /* old mpx syscall holder */
460 .quad sys_setpgid
461 .quad quiet_ni_syscall /* old ulimit syscall holder */
462 .quad sys32_olduname
463 .quad sys_umask /* 60 */
464 .quad sys_chroot
465 .quad sys32_ustat
466 .quad sys_dup2
467 .quad sys_getppid
468 .quad sys_getpgrp /* 65 */
469 .quad sys_setsid
470 .quad sys32_sigaction
471 .quad sys_sgetmask
472 .quad sys_ssetmask
473 .quad sys_setreuid16 /* 70 */
474 .quad sys_setregid16
475 .quad stub32_sigsuspend
476 .quad compat_sys_sigpending
477 .quad sys_sethostname
478 .quad compat_sys_setrlimit /* 75 */
479 .quad compat_sys_old_getrlimit /* old_getrlimit */
480 .quad compat_sys_getrusage
481 .quad sys32_gettimeofday
482 .quad sys32_settimeofday
483 .quad sys_getgroups16 /* 80 */
484 .quad sys_setgroups16
485 .quad sys32_old_select
486 .quad sys_symlink
487 .quad sys_lstat
488 .quad sys_readlink /* 85 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700489 .quad sys_uselib
Linus Torvalds1da177e2005-04-16 15:20:36 -0700490 .quad sys_swapon
491 .quad sys_reboot
492 .quad compat_sys_old_readdir
493 .quad sys32_mmap /* 90 */
494 .quad sys_munmap
495 .quad sys_truncate
496 .quad sys_ftruncate
497 .quad sys_fchmod
498 .quad sys_fchown16 /* 95 */
499 .quad sys_getpriority
500 .quad sys_setpriority
501 .quad quiet_ni_syscall /* old profil syscall holder */
502 .quad compat_sys_statfs
503 .quad compat_sys_fstatfs /* 100 */
504 .quad sys_ioperm
505 .quad compat_sys_socketcall
506 .quad sys_syslog
507 .quad compat_sys_setitimer
508 .quad compat_sys_getitimer /* 105 */
509 .quad compat_sys_newstat
510 .quad compat_sys_newlstat
511 .quad compat_sys_newfstat
512 .quad sys32_uname
513 .quad stub32_iopl /* 110 */
514 .quad sys_vhangup
515 .quad quiet_ni_syscall /* old "idle" system call */
516 .quad sys32_vm86_warning /* vm86old */
517 .quad compat_sys_wait4
518 .quad sys_swapoff /* 115 */
Kyle McMartind4d23ad2007-02-10 01:46:00 -0800519 .quad compat_sys_sysinfo
Linus Torvalds1da177e2005-04-16 15:20:36 -0700520 .quad sys32_ipc
521 .quad sys_fsync
522 .quad stub32_sigreturn
523 .quad stub32_clone /* 120 */
524 .quad sys_setdomainname
525 .quad sys_uname
526 .quad sys_modify_ldt
Stephen Rothwell3158e942006-03-26 01:37:29 -0800527 .quad compat_sys_adjtimex
Linus Torvalds1da177e2005-04-16 15:20:36 -0700528 .quad sys32_mprotect /* 125 */
529 .quad compat_sys_sigprocmask
530 .quad quiet_ni_syscall /* create_module */
531 .quad sys_init_module
532 .quad sys_delete_module
533 .quad quiet_ni_syscall /* 130 get_kernel_syms */
Vasily Tarasovb7163952007-07-15 23:41:12 -0700534 .quad sys32_quotactl
Linus Torvalds1da177e2005-04-16 15:20:36 -0700535 .quad sys_getpgid
536 .quad sys_fchdir
537 .quad quiet_ni_syscall /* bdflush */
538 .quad sys_sysfs /* 135 */
539 .quad sys_personality
540 .quad quiet_ni_syscall /* for afs_syscall */
541 .quad sys_setfsuid16
542 .quad sys_setfsgid16
543 .quad sys_llseek /* 140 */
544 .quad compat_sys_getdents
545 .quad compat_sys_select
546 .quad sys_flock
547 .quad sys_msync
548 .quad compat_sys_readv /* 145 */
549 .quad compat_sys_writev
550 .quad sys_getsid
551 .quad sys_fdatasync
552 .quad sys32_sysctl /* sysctl */
553 .quad sys_mlock /* 150 */
554 .quad sys_munlock
555 .quad sys_mlockall
556 .quad sys_munlockall
557 .quad sys_sched_setparam
558 .quad sys_sched_getparam /* 155 */
559 .quad sys_sched_setscheduler
560 .quad sys_sched_getscheduler
561 .quad sys_sched_yield
562 .quad sys_sched_get_priority_max
563 .quad sys_sched_get_priority_min /* 160 */
Alexandr Andreeva9bc3bf2007-03-16 21:07:36 +0100564 .quad sys32_sched_rr_get_interval
Linus Torvalds1da177e2005-04-16 15:20:36 -0700565 .quad compat_sys_nanosleep
566 .quad sys_mremap
567 .quad sys_setresuid16
568 .quad sys_getresuid16 /* 165 */
569 .quad sys32_vm86_warning /* vm86 */
570 .quad quiet_ni_syscall /* query_module */
571 .quad sys_poll
572 .quad compat_sys_nfsservctl
573 .quad sys_setresgid16 /* 170 */
574 .quad sys_getresgid16
575 .quad sys_prctl
576 .quad stub32_rt_sigreturn
577 .quad sys32_rt_sigaction
578 .quad sys32_rt_sigprocmask /* 175 */
579 .quad sys32_rt_sigpending
580 .quad compat_sys_rt_sigtimedwait
581 .quad sys32_rt_sigqueueinfo
582 .quad stub32_rt_sigsuspend
583 .quad sys32_pread /* 180 */
584 .quad sys32_pwrite
585 .quad sys_chown16
586 .quad sys_getcwd
587 .quad sys_capget
588 .quad sys_capset
589 .quad stub32_sigaltstack
590 .quad sys32_sendfile
591 .quad quiet_ni_syscall /* streams1 */
592 .quad quiet_ni_syscall /* streams2 */
593 .quad stub32_vfork /* 190 */
594 .quad compat_sys_getrlimit
595 .quad sys32_mmap2
596 .quad sys32_truncate64
597 .quad sys32_ftruncate64
598 .quad sys32_stat64 /* 195 */
599 .quad sys32_lstat64
600 .quad sys32_fstat64
601 .quad sys_lchown
602 .quad sys_getuid
603 .quad sys_getgid /* 200 */
604 .quad sys_geteuid
605 .quad sys_getegid
606 .quad sys_setreuid
607 .quad sys_setregid
608 .quad sys_getgroups /* 205 */
609 .quad sys_setgroups
610 .quad sys_fchown
611 .quad sys_setresuid
612 .quad sys_getresuid
613 .quad sys_setresgid /* 210 */
614 .quad sys_getresgid
615 .quad sys_chown
616 .quad sys_setuid
617 .quad sys_setgid
618 .quad sys_setfsuid /* 215 */
619 .quad sys_setfsgid
620 .quad sys_pivot_root
621 .quad sys_mincore
622 .quad sys_madvise
623 .quad compat_sys_getdents64 /* 220 getdents64 */
624 .quad compat_sys_fcntl64
625 .quad quiet_ni_syscall /* tux */
626 .quad quiet_ni_syscall /* security */
627 .quad sys_gettid
Andi Kleene412ac42007-06-20 12:23:30 +0200628 .quad sys32_readahead /* 225 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700629 .quad sys_setxattr
630 .quad sys_lsetxattr
631 .quad sys_fsetxattr
632 .quad sys_getxattr
633 .quad sys_lgetxattr /* 230 */
634 .quad sys_fgetxattr
635 .quad sys_listxattr
636 .quad sys_llistxattr
637 .quad sys_flistxattr
638 .quad sys_removexattr /* 235 */
639 .quad sys_lremovexattr
640 .quad sys_fremovexattr
641 .quad sys_tkill
642 .quad sys_sendfile64
643 .quad compat_sys_futex /* 240 */
644 .quad compat_sys_sched_setaffinity
645 .quad compat_sys_sched_getaffinity
Roland McGrathefd1ca52008-01-30 13:30:46 +0100646 .quad sys_set_thread_area
647 .quad sys_get_thread_area
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648 .quad compat_sys_io_setup /* 245 */
649 .quad sys_io_destroy
650 .quad compat_sys_io_getevents
651 .quad compat_sys_io_submit
652 .quad sys_io_cancel
Andi Kleene412ac42007-06-20 12:23:30 +0200653 .quad sys32_fadvise64 /* 250 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700654 .quad quiet_ni_syscall /* free_huge_pages */
655 .quad sys_exit_group
656 .quad sys32_lookup_dcookie
657 .quad sys_epoll_create
658 .quad sys_epoll_ctl /* 255 */
659 .quad sys_epoll_wait
660 .quad sys_remap_file_pages
661 .quad sys_set_tid_address
Christoph Hellwig3a0f69d2006-01-09 20:52:08 -0800662 .quad compat_sys_timer_create
Linus Torvalds1da177e2005-04-16 15:20:36 -0700663 .quad compat_sys_timer_settime /* 260 */
664 .quad compat_sys_timer_gettime
665 .quad sys_timer_getoverrun
666 .quad sys_timer_delete
667 .quad compat_sys_clock_settime
668 .quad compat_sys_clock_gettime /* 265 */
669 .quad compat_sys_clock_getres
670 .quad compat_sys_clock_nanosleep
671 .quad compat_sys_statfs64
672 .quad compat_sys_fstatfs64
673 .quad sys_tgkill /* 270 */
674 .quad compat_sys_utimes
675 .quad sys32_fadvise64_64
676 .quad quiet_ni_syscall /* sys_vserver */
677 .quad sys_mbind
678 .quad compat_sys_get_mempolicy /* 275 */
679 .quad sys_set_mempolicy
680 .quad compat_sys_mq_open
681 .quad sys_mq_unlink
682 .quad compat_sys_mq_timedsend
683 .quad compat_sys_mq_timedreceive /* 280 */
684 .quad compat_sys_mq_notify
685 .quad compat_sys_mq_getsetattr
Eric W. Biederman5234f5e2005-06-25 14:58:02 -0700686 .quad compat_sys_kexec_load /* reserved for kexec */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700687 .quad compat_sys_waitid
Robert Love725b38ab2005-07-25 15:19:29 -0400688 .quad quiet_ni_syscall /* 285: sys_altroot */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700689 .quad sys_add_key
690 .quad sys_request_key
691 .quad sys_keyctl
Robert Love725b38ab2005-07-25 15:19:29 -0400692 .quad sys_ioprio_set
693 .quad sys_ioprio_get /* 290 */
694 .quad sys_inotify_init
695 .quad sys_inotify_add_watch
696 .quad sys_inotify_rm_watch
Christoph Lameter39743882006-01-08 01:00:51 -0800697 .quad sys_migrate_pages
Ulrich Dreppera60fc512006-01-18 17:43:56 -0800698 .quad compat_sys_openat /* 295 */
699 .quad sys_mkdirat
700 .quad sys_mknodat
701 .quad sys_fchownat
Andrew Morton3833a702006-02-01 03:04:32 -0800702 .quad compat_sys_futimesat
Ulrich Dreppercff2b762006-02-11 17:55:47 -0800703 .quad sys32_fstatat /* 300 */
Ulrich Dreppera60fc512006-01-18 17:43:56 -0800704 .quad sys_unlinkat
705 .quad sys_renameat
706 .quad sys_linkat
707 .quad sys_symlinkat
708 .quad sys_readlinkat /* 305 */
709 .quad sys_fchmodat
710 .quad sys_faccessat
Andi Kleen957dc872006-09-26 10:52:27 +0200711 .quad compat_sys_pselect6
712 .quad compat_sys_ppoll
Andi Kleen4b88f092006-02-09 00:35:50 +0100713 .quad sys_unshare /* 310 */
Ingo Molnar8fdd6c62006-03-27 01:16:26 -0800714 .quad compat_sys_set_robust_list
715 .quad compat_sys_get_robust_list
Andi Kleenb8feb472006-04-07 19:50:34 +0200716 .quad sys_splice
Andi Kleene412ac42007-06-20 12:23:30 +0200717 .quad sys32_sync_file_range
Ulrich Drepper1c710c82007-05-08 00:33:25 -0700718 .quad sys_tee /* 315 */
Andi Kleend2610202006-05-01 12:15:48 -0700719 .quad compat_sys_vmsplice
Christoph Lameter1b2db9f2006-06-23 02:03:56 -0700720 .quad compat_sys_move_pages
Andi Kleen3cfc3482006-09-26 10:52:28 +0200721 .quad sys_getcpu
Ralf Baechle9af3cf02007-02-13 13:26:26 +0100722 .quad sys_epoll_pwait
Ulrich Drepper1c710c82007-05-08 00:33:25 -0700723 .quad compat_sys_utimensat /* 320 */
Heiko Carstensae7d5c82007-05-12 17:27:41 +0200724 .quad compat_sys_signalfd
725 .quad compat_sys_timerfd
Davide Libenzifdb902b12007-05-10 22:23:20 -0700726 .quad sys_eventfd
Amit Arora97ac7352007-07-17 21:42:44 -0400727 .quad sys32_fallocate
Heiko Carstensae7d5c82007-05-12 17:27:41 +0200728ia32_syscall_end: