ia32entry.S 22.6 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8
/*
 * Compatibility mode system call entry point for x86-64. 
 * 		
 * Copyright 2000-2002 Andi Kleen, SuSE Labs.
 */		 

#include <asm/dwarf2.h>
#include <asm/calling.h>
9
#include <asm/asm-offsets.h>
L
Linus Torvalds 已提交
10 11 12 13 14
#include <asm/current.h>
#include <asm/errno.h>
#include <asm/ia32_unistd.h>	
#include <asm/thread_info.h>	
#include <asm/segment.h>
15
#include <asm/irqflags.h>
L
Linus Torvalds 已提交
16
#include <linux/linkage.h>
17
#include <linux/err.h>
L
Linus Torvalds 已提交
18

19 20 21 22 23 24
/* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this.  */
#include <linux/elf-em.h>
#define AUDIT_ARCH_I386		(EM_386|__AUDIT_ARCH_LE)
#define __AUDIT_ARCH_LE	   0x40000000

#ifndef CONFIG_AUDITSYSCALL
25 26
#define sysexit_audit ia32_ret_from_sys_call
#define sysretl_audit ia32_ret_from_sys_call
27 28
#endif

J
Jiri Olsa 已提交
29 30
	.section .entry.text, "ax"

31 32
#define IA32_NR_syscalls ((ia32_syscall_end - ia32_sys_call_table)/8)

L
Linus Torvalds 已提交
33 34 35 36 37 38 39 40 41 42 43 44
	.macro IA32_ARG_FIXUP noebp=0
	movl	%edi,%r8d
	.if \noebp
	.else
	movl	%ebp,%r9d
	.endif
	xchg	%ecx,%esi
	movl	%ebx,%edi
	movl	%edx,%edx	/* zero extension */
	.endm 

	/* clobbers %eax */	
45
	.macro  CLEAR_RREGS offset=0, _r9=rax
L
Linus Torvalds 已提交
46
	xorl 	%eax,%eax
47 48 49 50
	movq	%rax,\offset+R11(%rsp)
	movq	%rax,\offset+R10(%rsp)
	movq	%\_r9,\offset+R9(%rsp)
	movq	%rax,\offset+R8(%rsp)
L
Linus Torvalds 已提交
51 52
	.endm

53 54 55
	/*
	 * Reload arg registers from stack in case ptrace changed them.
	 * We don't reload %eax because syscall_trace_enter() returned
56 57 58 59 60 61
	 * the %rax value we should see.  Instead, we just truncate that
	 * value to 32 bits again as we did on entry from user mode.
	 * If it's a new value set by user_regset during entry tracing,
	 * this matches the normal truncation of the user-mode value.
	 * If it's -1 to make us punt the syscall, then (u32)-1 is still
	 * an appropriately invalid value.
62
	 */
63 64
	.macro LOAD_ARGS32 offset, _r9=0
	.if \_r9
65
	movl \offset+16(%rsp),%r9d
66
	.endif
67 68 69 70
	movl \offset+40(%rsp),%ecx
	movl \offset+48(%rsp),%edx
	movl \offset+56(%rsp),%esi
	movl \offset+64(%rsp),%edi
71
	movl %eax,%eax			/* zero extension */
72 73
	.endm
	
74 75 76 77 78 79 80 81 82 83 84 85
	.macro CFI_STARTPROC32 simple
	CFI_STARTPROC	\simple
	CFI_UNDEFINED	r8
	CFI_UNDEFINED	r9
	CFI_UNDEFINED	r10
	CFI_UNDEFINED	r11
	CFI_UNDEFINED	r12
	CFI_UNDEFINED	r13
	CFI_UNDEFINED	r14
	CFI_UNDEFINED	r15
	.endm

86 87 88 89 90 91 92 93 94 95 96 97 98
#ifdef CONFIG_PARAVIRT
ENTRY(native_usergs_sysret32)
	swapgs
	sysretl
ENDPROC(native_usergs_sysret32)

ENTRY(native_irq_enable_sysexit)
	swapgs
	sti
	sysexit
ENDPROC(native_irq_enable_sysexit)
#endif

L
Linus Torvalds 已提交
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
/*
 * 32bit SYSENTER instruction entry.
 *
 * Arguments:
 * %eax	System call number.
 * %ebx Arg1
 * %ecx Arg2
 * %edx Arg3
 * %esi Arg4
 * %edi Arg5
 * %ebp user stack
 * 0(%ebp) Arg6	
 * 	
 * Interrupts off.
 *	
 * This is purely a fast path. For anything complicated we use the int 0x80
 * path below.	Set up a complete hardware stack frame to share code
 * with the int 0x80 path.
 */ 	
ENTRY(ia32_sysenter_target)
119
	CFI_STARTPROC32	simple
120
	CFI_SIGNAL_FRAME
121 122
	CFI_DEF_CFA	rsp,0
	CFI_REGISTER	rsp,rbp
123
	SWAPGS_UNSAFE_STACK
124 125
	movq	PER_CPU_VAR(kernel_stack), %rsp
	addq	$(KERNEL_STACK_OFFSET),%rsp
126 127 128 129
	/*
	 * No need to follow this irqs on/off section: the syscall
	 * disabled irqs, here we enable it straight after entry:
	 */
130
	ENABLE_INTERRUPTS(CLBR_NONE)
L
Linus Torvalds 已提交
131
 	movl	%ebp,%ebp		/* zero extension */
132
	pushq_cfi $__USER32_DS
133
	/*CFI_REL_OFFSET ss,0*/
134
	pushq_cfi %rbp
135
	CFI_REL_OFFSET rsp,0
136
	pushfq_cfi
137
	/*CFI_REL_OFFSET rflags,0*/
138
	movl	TI_sysenter_return+THREAD_INFO(%rsp,3*8-KERNEL_STACK_OFFSET),%r10d
139
	CFI_REGISTER rip,r10
140
	pushq_cfi $__USER32_CS
141
	/*CFI_REL_OFFSET cs,0*/
L
Linus Torvalds 已提交
142
	movl	%eax, %eax
143
	pushq_cfi %r10
144
	CFI_REL_OFFSET rip,0
145
	pushq_cfi %rax
L
Linus Torvalds 已提交
146
	cld
147
	SAVE_ARGS 0,1,0
L
Linus Torvalds 已提交
148 149
 	/* no need to do an access_ok check here because rbp has been
 	   32bit zero extended */ 
150
1:	movl	(%rbp),%ebp
L
Linus Torvalds 已提交
151 152 153
 	.section __ex_table,"a"
 	.quad 1b,ia32_badarg
 	.previous	
154 155
	orl     $TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET)
	testl   $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
156
	CFI_REMEMBER_STATE
L
Linus Torvalds 已提交
157
	jnz  sysenter_tracesys
158
	cmpq	$(IA32_NR_syscalls-1),%rax
159
	ja	ia32_badsys
160
sysenter_do_call:
161
	IA32_ARG_FIXUP
162
sysenter_dispatch:
L
Linus Torvalds 已提交
163 164
	call	*ia32_sys_call_table(,%rax,8)
	movq	%rax,RAX-ARGOFFSET(%rsp)
165
	DISABLE_INTERRUPTS(CLBR_NONE)
166
	TRACE_IRQS_OFF
167
	testl	$_TIF_ALLWORK_MASK,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
168 169
	jnz	sysexit_audit
sysexit_from_sys_call:
170
	andl    $~TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET)
L
Linus Torvalds 已提交
171 172
	/* clear IF, that popfq doesn't enable interrupts early */
	andl  $~0x200,EFLAGS-R11(%rsp) 
R
Roland McGrath 已提交
173 174
	movl	RIP-R11(%rsp),%edx		/* User %eip */
	CFI_REGISTER rip,rdx
175
	RESTORE_ARGS 0,24,0,0,0,0
176 177 178 179
	xorq	%r8,%r8
	xorq	%r9,%r9
	xorq	%r10,%r10
	xorq	%r11,%r11
180
	popfq_cfi
181
	/*CFI_RESTORE rflags*/
182
	popq_cfi %rcx				/* User %esp */
183
	CFI_REGISTER rsp,rcx
184
	TRACE_IRQS_ON
185
	ENABLE_INTERRUPTS_SYSEXIT32
L
Linus Torvalds 已提交
186

187 188 189 190 191 192 193 194 195 196
#ifdef CONFIG_AUDITSYSCALL
	.macro auditsys_entry_common
	movl %esi,%r9d			/* 6th arg: 4th syscall arg */
	movl %edx,%r8d			/* 5th arg: 3rd syscall arg */
	/* (already in %ecx)		   4th arg: 2nd syscall arg */
	movl %ebx,%edx			/* 3rd arg: 1st syscall arg */
	movl %eax,%esi			/* 2nd arg: syscall number */
	movl $AUDIT_ARCH_I386,%edi	/* 1st arg: audit arch */
	call audit_syscall_entry
	movl RAX-ARGOFFSET(%rsp),%eax	/* reload syscall number */
197
	cmpq $(IA32_NR_syscalls-1),%rax
198 199 200 201 202 203 204 205
	ja ia32_badsys
	movl %ebx,%edi			/* reload 1st syscall arg */
	movl RCX-ARGOFFSET(%rsp),%esi	/* reload 2nd syscall arg */
	movl RDX-ARGOFFSET(%rsp),%edx	/* reload 3rd syscall arg */
	movl RSI-ARGOFFSET(%rsp),%ecx	/* reload 4th syscall arg */
	movl RDI-ARGOFFSET(%rsp),%r8d	/* reload 5th syscall arg */
	.endm

206
	.macro auditsys_exit exit
207
	testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
208
	jnz ia32_ret_from_sys_call
209 210 211
	TRACE_IRQS_ON
	sti
	movl %eax,%esi		/* second arg, syscall return value */
212
	cmpl $-MAX_ERRNO,%eax	/* is it an error ? */
213 214 215
	jbe 1f
	movslq %eax, %rsi	/* if error sign extend to 64 bits */
1:	setbe %al		/* 1 if error, 0 if not */
216
	movzbl %al,%edi		/* zero-extend that into %edi */
217 218
	call __audit_syscall_exit
	movq RAX-ARGOFFSET(%rsp),%rax	/* reload syscall return value */
219 220 221
	movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi
	cli
	TRACE_IRQS_OFF
222
	testl %edi,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
223 224 225
	jz \exit
	CLEAR_RREGS -ARGOFFSET
	jmp int_with_check
226 227 228
	.endm

sysenter_auditsys:
229
	CFI_RESTORE_STATE
230 231 232 233 234 235 236 237 238 239
	auditsys_entry_common
	movl %ebp,%r9d			/* reload 6th syscall arg */
	jmp sysenter_dispatch

sysexit_audit:
	auditsys_exit sysexit_from_sys_call
#endif

sysenter_tracesys:
#ifdef CONFIG_AUDITSYSCALL
240
	testl	$(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
241 242
	jz	sysenter_auditsys
#endif
L
Linus Torvalds 已提交
243 244
	SAVE_REST
	CLEAR_RREGS
245
	movq	$-ENOSYS,RAX(%rsp)/* ptrace can change this for a bad syscall */
L
Linus Torvalds 已提交
246 247
	movq	%rsp,%rdi        /* &pt_regs -> arg1 */
	call	syscall_trace_enter
248
	LOAD_ARGS32 ARGOFFSET  /* reload args from stack in case ptrace changed it */
L
Linus Torvalds 已提交
249
	RESTORE_REST
250
	cmpq	$(IA32_NR_syscalls-1),%rax
251
	ja	int_ret_from_sys_call /* sysenter_tracesys has set RAX(%rsp) */
L
Linus Torvalds 已提交
252 253
	jmp	sysenter_do_call
	CFI_ENDPROC
254
ENDPROC(ia32_sysenter_target)
L
Linus Torvalds 已提交
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276

/*
 * 32bit SYSCALL instruction entry.
 *
 * Arguments:
 * %eax	System call number.
 * %ebx Arg1
 * %ecx return EIP 
 * %edx Arg3
 * %esi Arg4
 * %edi Arg5
 * %ebp Arg2    [note: not saved in the stack frame, should not be touched]
 * %esp user stack 
 * 0(%esp) Arg6
 * 	
 * Interrupts off.
 *	
 * This is purely a fast path. For anything complicated we use the int 0x80
 * path below.	Set up a complete hardware stack frame to share code
 * with the int 0x80 path.	
 */ 	
ENTRY(ia32_cstar_target)
277
	CFI_STARTPROC32	simple
278
	CFI_SIGNAL_FRAME
279
	CFI_DEF_CFA	rsp,KERNEL_STACK_OFFSET
280 281
	CFI_REGISTER	rip,rcx
	/*CFI_REGISTER	rflags,r11*/
282
	SWAPGS_UNSAFE_STACK
L
Linus Torvalds 已提交
283
	movl	%esp,%r8d
284
	CFI_REGISTER	rsp,r8
285
	movq	PER_CPU_VAR(kernel_stack),%rsp
286 287 288 289
	/*
	 * No need to follow this irqs on/off section: the syscall
	 * disabled irqs and here we enable it straight after entry:
	 */
290
	ENABLE_INTERRUPTS(CLBR_NONE)
291
	SAVE_ARGS 8,0,0
L
Linus Torvalds 已提交
292 293 294
	movl 	%eax,%eax	/* zero extension */
	movq	%rax,ORIG_RAX-ARGOFFSET(%rsp)
	movq	%rcx,RIP-ARGOFFSET(%rsp)
295
	CFI_REL_OFFSET rip,RIP-ARGOFFSET
L
Linus Torvalds 已提交
296 297 298 299 300
	movq	%rbp,RCX-ARGOFFSET(%rsp) /* this lies slightly to ptrace */
	movl	%ebp,%ecx
	movq	$__USER32_CS,CS-ARGOFFSET(%rsp)
	movq	$__USER32_DS,SS-ARGOFFSET(%rsp)
	movq	%r11,EFLAGS-ARGOFFSET(%rsp)
301
	/*CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/
L
Linus Torvalds 已提交
302
	movq	%r8,RSP-ARGOFFSET(%rsp)	
303
	CFI_REL_OFFSET rsp,RSP-ARGOFFSET
L
Linus Torvalds 已提交
304 305 306 307 308 309 310
	/* no need to do an access_ok check here because r8 has been
	   32bit zero extended */ 
	/* hardware stack frame is complete now */	
1:	movl	(%r8),%r9d
	.section __ex_table,"a"
	.quad 1b,ia32_badarg
	.previous	
311 312
	orl     $TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET)
	testl   $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
313
	CFI_REMEMBER_STATE
L
Linus Torvalds 已提交
314
	jnz   cstar_tracesys
315
	cmpq $IA32_NR_syscalls-1,%rax
316
	ja  ia32_badsys
317
cstar_do_call:
L
Linus Torvalds 已提交
318
	IA32_ARG_FIXUP 1
319
cstar_dispatch:
L
Linus Torvalds 已提交
320 321
	call *ia32_sys_call_table(,%rax,8)
	movq %rax,RAX-ARGOFFSET(%rsp)
322
	DISABLE_INTERRUPTS(CLBR_NONE)
323
	TRACE_IRQS_OFF
324
	testl $_TIF_ALLWORK_MASK,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
325 326
	jnz sysretl_audit
sysretl_from_sys_call:
327
	andl $~TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET)
328
	RESTORE_ARGS 0,-ARG_SKIP,0,0,0
L
Linus Torvalds 已提交
329
	movl RIP-ARGOFFSET(%rsp),%ecx
330
	CFI_REGISTER rip,rcx
L
Linus Torvalds 已提交
331
	movl EFLAGS-ARGOFFSET(%rsp),%r11d	
332
	/*CFI_REGISTER rflags,r11*/
333 334 335
	xorq	%r10,%r10
	xorq	%r9,%r9
	xorq	%r8,%r8
336
	TRACE_IRQS_ON
L
Linus Torvalds 已提交
337
	movl RSP-ARGOFFSET(%rsp),%esp
338
	CFI_RESTORE rsp
339
	USERGS_SYSRET32
L
Linus Torvalds 已提交
340
	
341 342
#ifdef CONFIG_AUDITSYSCALL
cstar_auditsys:
343
	CFI_RESTORE_STATE
344 345 346 347 348 349
	movl %r9d,R9-ARGOFFSET(%rsp)	/* register to be clobbered by call */
	auditsys_entry_common
	movl R9-ARGOFFSET(%rsp),%r9d	/* reload 6th syscall arg */
	jmp cstar_dispatch

sysretl_audit:
350
	auditsys_exit sysretl_from_sys_call
351 352 353 354
#endif

cstar_tracesys:
#ifdef CONFIG_AUDITSYSCALL
355
	testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
356 357
	jz cstar_auditsys
#endif
358
	xchgl %r9d,%ebp
L
Linus Torvalds 已提交
359
	SAVE_REST
360
	CLEAR_RREGS 0, r9
361
	movq $-ENOSYS,RAX(%rsp)	/* ptrace can change this for a bad syscall */
L
Linus Torvalds 已提交
362 363
	movq %rsp,%rdi        /* &pt_regs -> arg1 */
	call syscall_trace_enter
364
	LOAD_ARGS32 ARGOFFSET, 1  /* reload args from stack in case ptrace changed it */
L
Linus Torvalds 已提交
365
	RESTORE_REST
366
	xchgl %ebp,%r9d
367
	cmpq $(IA32_NR_syscalls-1),%rax
368
	ja int_ret_from_sys_call /* cstar_tracesys has set RAX(%rsp) */
L
Linus Torvalds 已提交
369
	jmp cstar_do_call
370
END(ia32_cstar_target)
L
Linus Torvalds 已提交
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398
				
ia32_badarg:
	movq $-EFAULT,%rax
	jmp ia32_sysret
	CFI_ENDPROC

/* 
 * Emulated IA32 system calls via int 0x80. 
 *
 * Arguments:	 
 * %eax	System call number.
 * %ebx Arg1
 * %ecx Arg2
 * %edx Arg3
 * %esi Arg4
 * %edi Arg5
 * %ebp Arg6    [note: not saved in the stack frame, should not be touched]
 *
 * Notes:
 * Uses the same stack frame as the x86-64 version.	
 * All registers except %eax must be saved (but ptrace may violate that)
 * Arguments are zero extended. For system calls that want sign extension and
 * take long arguments a wrapper is needed. Most calls can just be called
 * directly.
 * Assumes it is only called from user space and entered with interrupts off.	
 */ 				

ENTRY(ia32_syscall)
J
Jan Beulich 已提交
399
	CFI_STARTPROC32	simple
400
	CFI_SIGNAL_FRAME
401 402 403 404 405 406
	CFI_DEF_CFA	rsp,SS+8-RIP
	/*CFI_REL_OFFSET	ss,SS-RIP*/
	CFI_REL_OFFSET	rsp,RSP-RIP
	/*CFI_REL_OFFSET	rflags,EFLAGS-RIP*/
	/*CFI_REL_OFFSET	cs,CS-RIP*/
	CFI_REL_OFFSET	rip,RIP-RIP
407
	PARAVIRT_ADJUST_EXCEPTION_FRAME
408
	SWAPGS
409 410 411 412
	/*
	 * No need to follow this irqs on/off section: the syscall
	 * disabled irqs and here we enable it straight after entry:
	 */
413
	ENABLE_INTERRUPTS(CLBR_NONE)
L
Linus Torvalds 已提交
414
	movl %eax,%eax
415
	pushq_cfi %rax
L
Linus Torvalds 已提交
416 417 418
	cld
	/* note the registers are not zero extended to the sf.
	   this could be a problem. */
419
	SAVE_ARGS 0,1,0
420 421
	orl $TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET)
	testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
L
Linus Torvalds 已提交
422
	jnz ia32_tracesys
423
	cmpq $(IA32_NR_syscalls-1),%rax
424 425
	ja ia32_badsys
ia32_do_call:
L
Linus Torvalds 已提交
426 427 428 429
	IA32_ARG_FIXUP
	call *ia32_sys_call_table(,%rax,8) # xxx: rip relative
ia32_sysret:
	movq %rax,RAX-ARGOFFSET(%rsp)
430 431
ia32_ret_from_sys_call:
	CLEAR_RREGS -ARGOFFSET
L
Linus Torvalds 已提交
432 433 434 435
	jmp int_ret_from_sys_call 

ia32_tracesys:			 
	SAVE_REST
J
Jan Beulich 已提交
436
	CLEAR_RREGS
R
Roland McGrath 已提交
437
	movq $-ENOSYS,RAX(%rsp)	/* ptrace can change this for a bad syscall */
L
Linus Torvalds 已提交
438 439
	movq %rsp,%rdi        /* &pt_regs -> arg1 */
	call syscall_trace_enter
440
	LOAD_ARGS32 ARGOFFSET  /* reload args from stack in case ptrace changed it */
L
Linus Torvalds 已提交
441
	RESTORE_REST
442
	cmpq $(IA32_NR_syscalls-1),%rax
443 444
	ja  int_ret_from_sys_call	/* ia32_tracesys has set RAX(%rsp) */
	jmp ia32_do_call
445
END(ia32_syscall)
L
Linus Torvalds 已提交
446 447 448

ia32_badsys:
	movq $0,ORIG_RAX-ARGOFFSET(%rsp)
449 450
	movq $-ENOSYS,%rax
	jmp ia32_sysret
L
Linus Torvalds 已提交
451 452 453 454 455 456 457

quiet_ni_syscall:
	movq $-ENOSYS,%rax
	ret
	CFI_ENDPROC
	
	.macro PTREGSCALL label, func, arg
458 459
	ALIGN
GLOBAL(\label)
L
Linus Torvalds 已提交
460 461 462 463 464
	leaq \func(%rip),%rax
	leaq -ARGOFFSET+8(%rsp),\arg	/* 8 for return address */
	jmp  ia32_ptregs_common	
	.endm

465
	CFI_STARTPROC32
466

L
Linus Torvalds 已提交
467 468 469 470 471 472 473 474 475
	PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi
	PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi
	PTREGSCALL stub32_sigaltstack, sys32_sigaltstack, %rdx
	PTREGSCALL stub32_execve, sys32_execve, %rcx
	PTREGSCALL stub32_fork, sys_fork, %rdi
	PTREGSCALL stub32_clone, sys32_clone, %rdx
	PTREGSCALL stub32_vfork, sys_vfork, %rdi
	PTREGSCALL stub32_iopl, sys_iopl, %rsi

476 477
	ALIGN
ia32_ptregs_common:
L
Linus Torvalds 已提交
478
	popq %r11
479 480
	CFI_ENDPROC
	CFI_STARTPROC32	simple
481
	CFI_SIGNAL_FRAME
482 483 484 485 486 487 488 489 490 491 492
	CFI_DEF_CFA	rsp,SS+8-ARGOFFSET
	CFI_REL_OFFSET	rax,RAX-ARGOFFSET
	CFI_REL_OFFSET	rcx,RCX-ARGOFFSET
	CFI_REL_OFFSET	rdx,RDX-ARGOFFSET
	CFI_REL_OFFSET	rsi,RSI-ARGOFFSET
	CFI_REL_OFFSET	rdi,RDI-ARGOFFSET
	CFI_REL_OFFSET	rip,RIP-ARGOFFSET
/*	CFI_REL_OFFSET	cs,CS-ARGOFFSET*/
/*	CFI_REL_OFFSET	rflags,EFLAGS-ARGOFFSET*/
	CFI_REL_OFFSET	rsp,RSP-ARGOFFSET
/*	CFI_REL_OFFSET	ss,SS-ARGOFFSET*/
L
Linus Torvalds 已提交
493 494 495 496 497
	SAVE_REST
	call *%rax
	RESTORE_REST
	jmp  ia32_sysret	/* misbalances the return cache */
	CFI_ENDPROC
498
END(ia32_ptregs_common)
L
Linus Torvalds 已提交
499

500
	.section .rodata,"a"
L
Linus Torvalds 已提交
501 502 503 504 505 506 507
	.align 8
ia32_sys_call_table:
	.quad sys_restart_syscall
	.quad sys_exit
	.quad stub32_fork
	.quad sys_read
	.quad sys_write
508
	.quad compat_sys_open		/* 5 */
L
Linus Torvalds 已提交
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528
	.quad sys_close
	.quad sys32_waitpid
	.quad sys_creat
	.quad sys_link
	.quad sys_unlink		/* 10 */
	.quad stub32_execve
	.quad sys_chdir
	.quad compat_sys_time
	.quad sys_mknod
	.quad sys_chmod		/* 15 */
	.quad sys_lchown16
	.quad quiet_ni_syscall			/* old break syscall holder */
	.quad sys_stat
	.quad sys32_lseek
	.quad sys_getpid		/* 20 */
	.quad compat_sys_mount	/* mount  */
	.quad sys_oldumount	/* old_umount  */
	.quad sys_setuid16
	.quad sys_getuid16
	.quad compat_sys_stime	/* stime */		/* 25 */
529
	.quad compat_sys_ptrace	/* ptrace */
L
Linus Torvalds 已提交
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544
	.quad sys_alarm
	.quad sys_fstat	/* (old)fstat */
	.quad sys_pause
	.quad compat_sys_utime	/* 30 */
	.quad quiet_ni_syscall	/* old stty syscall holder */
	.quad quiet_ni_syscall	/* old gtty syscall holder */
	.quad sys_access
	.quad sys_nice	
	.quad quiet_ni_syscall	/* 35 */	/* old ftime syscall holder */
	.quad sys_sync
	.quad sys32_kill
	.quad sys_rename
	.quad sys_mkdir
	.quad sys_rmdir		/* 40 */
	.quad sys_dup
545
	.quad sys_pipe
L
Linus Torvalds 已提交
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561
	.quad compat_sys_times
	.quad quiet_ni_syscall			/* old prof syscall holder */
	.quad sys_brk		/* 45 */
	.quad sys_setgid16
	.quad sys_getgid16
	.quad sys_signal
	.quad sys_geteuid16
	.quad sys_getegid16	/* 50 */
	.quad sys_acct
	.quad sys_umount			/* new_umount */
	.quad quiet_ni_syscall			/* old lock syscall holder */
	.quad compat_sys_ioctl
	.quad compat_sys_fcntl64		/* 55 */
	.quad quiet_ni_syscall			/* old mpx syscall holder */
	.quad sys_setpgid
	.quad quiet_ni_syscall			/* old ulimit syscall holder */
C
Christoph Hellwig 已提交
562
	.quad sys_olduname
L
Linus Torvalds 已提交
563 564
	.quad sys_umask		/* 60 */
	.quad sys_chroot
C
Christoph Hellwig 已提交
565
	.quad compat_sys_ustat
L
Linus Torvalds 已提交
566 567 568 569 570 571 572 573 574
	.quad sys_dup2
	.quad sys_getppid
	.quad sys_getpgrp		/* 65 */
	.quad sys_setsid
	.quad sys32_sigaction
	.quad sys_sgetmask
	.quad sys_ssetmask
	.quad sys_setreuid16	/* 70 */
	.quad sys_setregid16
575
	.quad sys32_sigsuspend
L
Linus Torvalds 已提交
576 577 578 579 580
	.quad compat_sys_sigpending
	.quad sys_sethostname
	.quad compat_sys_setrlimit	/* 75 */
	.quad compat_sys_old_getrlimit	/* old_getrlimit */
	.quad compat_sys_getrusage
581 582
	.quad compat_sys_gettimeofday
	.quad compat_sys_settimeofday
L
Linus Torvalds 已提交
583 584
	.quad sys_getgroups16	/* 80 */
	.quad sys_setgroups16
C
Christoph Hellwig 已提交
585
	.quad compat_sys_old_select
L
Linus Torvalds 已提交
586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611
	.quad sys_symlink
	.quad sys_lstat
	.quad sys_readlink		/* 85 */
	.quad sys_uselib
	.quad sys_swapon
	.quad sys_reboot
	.quad compat_sys_old_readdir
	.quad sys32_mmap		/* 90 */
	.quad sys_munmap
	.quad sys_truncate
	.quad sys_ftruncate
	.quad sys_fchmod
	.quad sys_fchown16		/* 95 */
	.quad sys_getpriority
	.quad sys_setpriority
	.quad quiet_ni_syscall			/* old profil syscall holder */
	.quad compat_sys_statfs
	.quad compat_sys_fstatfs		/* 100 */
	.quad sys_ioperm
	.quad compat_sys_socketcall
	.quad sys_syslog
	.quad compat_sys_setitimer
	.quad compat_sys_getitimer	/* 105 */
	.quad compat_sys_newstat
	.quad compat_sys_newlstat
	.quad compat_sys_newfstat
C
Christoph Hellwig 已提交
612
	.quad sys_uname
L
Linus Torvalds 已提交
613 614 615 616 617 618
	.quad stub32_iopl		/* 110 */
	.quad sys_vhangup
	.quad quiet_ni_syscall	/* old "idle" system call */
	.quad sys32_vm86_warning	/* vm86old */ 
	.quad compat_sys_wait4
	.quad sys_swapoff		/* 115 */
619
	.quad compat_sys_sysinfo
L
Linus Torvalds 已提交
620 621 622 623 624
	.quad sys32_ipc
	.quad sys_fsync
	.quad stub32_sigreturn
	.quad stub32_clone		/* 120 */
	.quad sys_setdomainname
625
	.quad sys_newuname
L
Linus Torvalds 已提交
626
	.quad sys_modify_ldt
627
	.quad compat_sys_adjtimex
L
Linus Torvalds 已提交
628 629 630 631 632 633
	.quad sys32_mprotect		/* 125 */
	.quad compat_sys_sigprocmask
	.quad quiet_ni_syscall		/* create_module */
	.quad sys_init_module
	.quad sys_delete_module
	.quad quiet_ni_syscall		/* 130  get_kernel_syms */
634
	.quad sys32_quotactl
L
Linus Torvalds 已提交
635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651
	.quad sys_getpgid
	.quad sys_fchdir
	.quad quiet_ni_syscall	/* bdflush */
	.quad sys_sysfs		/* 135 */
	.quad sys_personality
	.quad quiet_ni_syscall	/* for afs_syscall */
	.quad sys_setfsuid16
	.quad sys_setfsgid16
	.quad sys_llseek		/* 140 */
	.quad compat_sys_getdents
	.quad compat_sys_select
	.quad sys_flock
	.quad sys_msync
	.quad compat_sys_readv		/* 145 */
	.quad compat_sys_writev
	.quad sys_getsid
	.quad sys_fdatasync
652
	.quad compat_sys_sysctl	/* sysctl */
L
Linus Torvalds 已提交
653 654 655 656 657 658 659 660 661 662 663
	.quad sys_mlock		/* 150 */
	.quad sys_munlock
	.quad sys_mlockall
	.quad sys_munlockall
	.quad sys_sched_setparam
	.quad sys_sched_getparam   /* 155 */
	.quad sys_sched_setscheduler
	.quad sys_sched_getscheduler
	.quad sys_sched_yield
	.quad sys_sched_get_priority_max
	.quad sys_sched_get_priority_min  /* 160 */
664
	.quad sys32_sched_rr_get_interval
L
Linus Torvalds 已提交
665 666 667 668 669 670 671
	.quad compat_sys_nanosleep
	.quad sys_mremap
	.quad sys_setresuid16
	.quad sys_getresuid16	/* 165 */
	.quad sys32_vm86_warning	/* vm86 */ 
	.quad quiet_ni_syscall	/* query_module */
	.quad sys_poll
672
	.quad quiet_ni_syscall /* old nfsservctl */
L
Linus Torvalds 已提交
673 674 675 676 677 678 679 680 681
	.quad sys_setresgid16	/* 170 */
	.quad sys_getresgid16
	.quad sys_prctl
	.quad stub32_rt_sigreturn
	.quad sys32_rt_sigaction
	.quad sys32_rt_sigprocmask	/* 175 */
	.quad sys32_rt_sigpending
	.quad compat_sys_rt_sigtimedwait
	.quad sys32_rt_sigqueueinfo
682
	.quad sys_rt_sigsuspend
L
Linus Torvalds 已提交
683 684 685 686 687 688 689 690 691 692 693 694
	.quad sys32_pread		/* 180 */
	.quad sys32_pwrite
	.quad sys_chown16
	.quad sys_getcwd
	.quad sys_capget
	.quad sys_capset
	.quad stub32_sigaltstack
	.quad sys32_sendfile
	.quad quiet_ni_syscall		/* streams1 */
	.quad quiet_ni_syscall		/* streams2 */
	.quad stub32_vfork            /* 190 */
	.quad compat_sys_getrlimit
A
Al Viro 已提交
695
	.quad sys_mmap_pgoff
L
Linus Torvalds 已提交
696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727
	.quad sys32_truncate64
	.quad sys32_ftruncate64
	.quad sys32_stat64		/* 195 */
	.quad sys32_lstat64
	.quad sys32_fstat64
	.quad sys_lchown
	.quad sys_getuid
	.quad sys_getgid		/* 200 */
	.quad sys_geteuid
	.quad sys_getegid
	.quad sys_setreuid
	.quad sys_setregid
	.quad sys_getgroups	/* 205 */
	.quad sys_setgroups
	.quad sys_fchown
	.quad sys_setresuid
	.quad sys_getresuid
	.quad sys_setresgid	/* 210 */
	.quad sys_getresgid
	.quad sys_chown
	.quad sys_setuid
	.quad sys_setgid
	.quad sys_setfsuid		/* 215 */
	.quad sys_setfsgid
	.quad sys_pivot_root
	.quad sys_mincore
	.quad sys_madvise
	.quad compat_sys_getdents64	/* 220 getdents64 */
	.quad compat_sys_fcntl64	
	.quad quiet_ni_syscall		/* tux */
	.quad quiet_ni_syscall    	/* security */
	.quad sys_gettid	
728
	.quad sys32_readahead	/* 225 */
L
Linus Torvalds 已提交
729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745
	.quad sys_setxattr
	.quad sys_lsetxattr
	.quad sys_fsetxattr
	.quad sys_getxattr
	.quad sys_lgetxattr	/* 230 */
	.quad sys_fgetxattr
	.quad sys_listxattr
	.quad sys_llistxattr
	.quad sys_flistxattr
	.quad sys_removexattr	/* 235 */
	.quad sys_lremovexattr
	.quad sys_fremovexattr
	.quad sys_tkill
	.quad sys_sendfile64 
	.quad compat_sys_futex		/* 240 */
	.quad compat_sys_sched_setaffinity
	.quad compat_sys_sched_getaffinity
R
Roland McGrath 已提交
746 747
	.quad sys_set_thread_area
	.quad sys_get_thread_area
L
Linus Torvalds 已提交
748 749 750 751 752
	.quad compat_sys_io_setup	/* 245 */
	.quad sys_io_destroy
	.quad compat_sys_io_getevents
	.quad compat_sys_io_submit
	.quad sys_io_cancel
753
	.quad sys32_fadvise64		/* 250 */
L
Linus Torvalds 已提交
754 755 756 757 758 759 760 761
	.quad quiet_ni_syscall 	/* free_huge_pages */
	.quad sys_exit_group
	.quad sys32_lookup_dcookie
	.quad sys_epoll_create
	.quad sys_epoll_ctl		/* 255 */
	.quad sys_epoll_wait
	.quad sys_remap_file_pages
	.quad sys_set_tid_address
762
	.quad compat_sys_timer_create
L
Linus Torvalds 已提交
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785
	.quad compat_sys_timer_settime	/* 260 */
	.quad compat_sys_timer_gettime
	.quad sys_timer_getoverrun
	.quad sys_timer_delete
	.quad compat_sys_clock_settime
	.quad compat_sys_clock_gettime	/* 265 */
	.quad compat_sys_clock_getres
	.quad compat_sys_clock_nanosleep
	.quad compat_sys_statfs64
	.quad compat_sys_fstatfs64
	.quad sys_tgkill		/* 270 */
	.quad compat_sys_utimes
	.quad sys32_fadvise64_64
	.quad quiet_ni_syscall	/* sys_vserver */
	.quad sys_mbind
	.quad compat_sys_get_mempolicy	/* 275 */
	.quad sys_set_mempolicy
	.quad compat_sys_mq_open
	.quad sys_mq_unlink
	.quad compat_sys_mq_timedsend
	.quad compat_sys_mq_timedreceive	/* 280 */
	.quad compat_sys_mq_notify
	.quad compat_sys_mq_getsetattr
786
	.quad compat_sys_kexec_load	/* reserved for kexec */
L
Linus Torvalds 已提交
787
	.quad compat_sys_waitid
788
	.quad quiet_ni_syscall		/* 285: sys_altroot */
L
Linus Torvalds 已提交
789 790 791
	.quad sys_add_key
	.quad sys_request_key
	.quad sys_keyctl
792 793 794 795 796
	.quad sys_ioprio_set
	.quad sys_ioprio_get		/* 290 */
	.quad sys_inotify_init
	.quad sys_inotify_add_watch
	.quad sys_inotify_rm_watch
797
	.quad sys_migrate_pages
798 799 800 801
	.quad compat_sys_openat		/* 295 */
	.quad sys_mkdirat
	.quad sys_mknodat
	.quad sys_fchownat
802
	.quad compat_sys_futimesat
U
Ulrich Drepper 已提交
803
	.quad sys32_fstatat		/* 300 */
804 805 806 807 808 809 810
	.quad sys_unlinkat
	.quad sys_renameat
	.quad sys_linkat
	.quad sys_symlinkat
	.quad sys_readlinkat		/* 305 */
	.quad sys_fchmodat
	.quad sys_faccessat
A
Andi Kleen 已提交
811 812
	.quad compat_sys_pselect6
	.quad compat_sys_ppoll
A
Andi Kleen 已提交
813
	.quad sys_unshare		/* 310 */
814 815
	.quad compat_sys_set_robust_list
	.quad compat_sys_get_robust_list
816
	.quad sys_splice
817
	.quad sys32_sync_file_range
U
Ulrich Drepper 已提交
818
	.quad sys_tee			/* 315 */
819
	.quad compat_sys_vmsplice
820
	.quad compat_sys_move_pages
821
	.quad sys_getcpu
822
	.quad sys_epoll_pwait
U
Ulrich Drepper 已提交
823
	.quad compat_sys_utimensat	/* 320 */
824
	.quad compat_sys_signalfd
825
	.quad sys_timerfd_create
826
	.quad sys_eventfd
827
	.quad sys32_fallocate
828 829
	.quad compat_sys_timerfd_settime	/* 325 */
	.quad compat_sys_timerfd_gettime
U
Ulrich Drepper 已提交
830
	.quad compat_sys_signalfd4
U
Ulrich Drepper 已提交
831
	.quad sys_eventfd2
832
	.quad sys_epoll_create1
I
Ingo Molnar 已提交
833
	.quad sys_dup3				/* 330 */
U
Ulrich Drepper 已提交
834
	.quad sys_pipe2
U
Ulrich Drepper 已提交
835
	.quad sys_inotify_init1
836 837
	.quad compat_sys_preadv
	.quad compat_sys_pwritev
838
	.quad compat_sys_rt_tgsigqueueinfo	/* 335 */
839
	.quad sys_perf_event_open
840
	.quad compat_sys_recvmmsg
841
	.quad sys_fanotify_init
842
	.quad sys32_fanotify_mark
843
	.quad sys_prlimit64		/* 340 */
844 845
	.quad sys_name_to_handle_at
	.quad compat_sys_open_by_handle_at
R
Richard Cochran 已提交
846
	.quad compat_sys_clock_adjtime
847
	.quad sys_syncfs
848
	.quad compat_sys_sendmmsg	/* 345 */
849
	.quad sys_setns
C
Christopher Yeoh 已提交
850 851
	.quad compat_sys_process_vm_readv
	.quad compat_sys_process_vm_writev
852
ia32_syscall_end: