Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 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 Ravnborg | e2d5df9 | 2005-09-09 21:28:48 +0200 | [diff] [blame] | 9 | #include <asm/asm-offsets.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | #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 Molnar | 2601e64 | 2006-07-03 00:24:45 -0700 | [diff] [blame] | 15 | #include <asm/irqflags.h> |
H. Peter Anvin | 1ce6f86 | 2012-04-20 12:19:50 -0700 | [diff] [blame] | 16 | #include <asm/asm.h> |
H. Peter Anvin | 63bcff2 | 2012-09-21 12:43:12 -0700 | [diff] [blame] | 17 | #include <asm/smap.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #include <linux/linkage.h> |
Eric Paris | d7e7528 | 2012-01-03 14:23:06 -0500 | [diff] [blame] | 19 | #include <linux/err.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 21 | /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */ |
| 22 | #include <linux/elf-em.h> |
| 23 | #define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE) |
| 24 | #define __AUDIT_ARCH_LE 0x40000000 |
| 25 | |
| 26 | #ifndef CONFIG_AUDITSYSCALL |
Jan Beulich | 24e3580 | 2009-09-30 11:22:11 +0100 | [diff] [blame] | 27 | #define sysexit_audit ia32_ret_from_sys_call |
| 28 | #define sysretl_audit ia32_ret_from_sys_call |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 29 | #endif |
| 30 | |
Jiri Olsa | ea71454 | 2011-03-07 19:10:39 +0100 | [diff] [blame] | 31 | .section .entry.text, "ax" |
| 32 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | .macro IA32_ARG_FIXUP noebp=0 |
| 34 | movl %edi,%r8d |
| 35 | .if \noebp |
| 36 | .else |
| 37 | movl %ebp,%r9d |
| 38 | .endif |
| 39 | xchg %ecx,%esi |
| 40 | movl %ebx,%edi |
| 41 | movl %edx,%edx /* zero extension */ |
| 42 | .endm |
| 43 | |
| 44 | /* clobbers %eax */ |
Jan Beulich | 24e3580 | 2009-09-30 11:22:11 +0100 | [diff] [blame] | 45 | .macro CLEAR_RREGS offset=0, _r9=rax |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | xorl %eax,%eax |
Jan Beulich | 24e3580 | 2009-09-30 11:22:11 +0100 | [diff] [blame] | 47 | movq %rax,\offset+R11(%rsp) |
| 48 | movq %rax,\offset+R10(%rsp) |
| 49 | movq %\_r9,\offset+R9(%rsp) |
| 50 | movq %rax,\offset+R8(%rsp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | .endm |
| 52 | |
Roland McGrath | d4d6715 | 2008-07-09 02:38:07 -0700 | [diff] [blame] | 53 | /* |
| 54 | * Reload arg registers from stack in case ptrace changed them. |
| 55 | * We don't reload %eax because syscall_trace_enter() returned |
Roland McGrath | eefdca0 | 2010-09-14 12:22:58 -0700 | [diff] [blame] | 56 | * the %rax value we should see. Instead, we just truncate that |
| 57 | * value to 32 bits again as we did on entry from user mode. |
| 58 | * If it's a new value set by user_regset during entry tracing, |
| 59 | * this matches the normal truncation of the user-mode value. |
| 60 | * If it's -1 to make us punt the syscall, then (u32)-1 is still |
| 61 | * an appropriately invalid value. |
Roland McGrath | d4d6715 | 2008-07-09 02:38:07 -0700 | [diff] [blame] | 62 | */ |
Jan Beulich | 295286a | 2008-08-29 13:21:11 +0100 | [diff] [blame] | 63 | .macro LOAD_ARGS32 offset, _r9=0 |
| 64 | .if \_r9 |
Andi Kleen | 176df24 | 2007-09-21 16:16:18 +0200 | [diff] [blame] | 65 | movl \offset+16(%rsp),%r9d |
Jan Beulich | 295286a | 2008-08-29 13:21:11 +0100 | [diff] [blame] | 66 | .endif |
Andi Kleen | 176df24 | 2007-09-21 16:16:18 +0200 | [diff] [blame] | 67 | movl \offset+40(%rsp),%ecx |
| 68 | movl \offset+48(%rsp),%edx |
| 69 | movl \offset+56(%rsp),%esi |
| 70 | movl \offset+64(%rsp),%edi |
Roland McGrath | eefdca0 | 2010-09-14 12:22:58 -0700 | [diff] [blame] | 71 | movl %eax,%eax /* zero extension */ |
Andi Kleen | 176df24 | 2007-09-21 16:16:18 +0200 | [diff] [blame] | 72 | .endm |
| 73 | |
Jan Beulich | 2765130 | 2006-01-11 22:41:59 +0100 | [diff] [blame] | 74 | .macro CFI_STARTPROC32 simple |
| 75 | CFI_STARTPROC \simple |
| 76 | CFI_UNDEFINED r8 |
| 77 | CFI_UNDEFINED r9 |
| 78 | CFI_UNDEFINED r10 |
| 79 | CFI_UNDEFINED r11 |
| 80 | CFI_UNDEFINED r12 |
| 81 | CFI_UNDEFINED r13 |
| 82 | CFI_UNDEFINED r14 |
| 83 | CFI_UNDEFINED r15 |
| 84 | .endm |
| 85 | |
Jeremy Fitzhardinge | 2be2998 | 2008-06-25 00:19:28 -0400 | [diff] [blame] | 86 | #ifdef CONFIG_PARAVIRT |
| 87 | ENTRY(native_usergs_sysret32) |
| 88 | swapgs |
| 89 | sysretl |
| 90 | ENDPROC(native_usergs_sysret32) |
| 91 | |
| 92 | ENTRY(native_irq_enable_sysexit) |
| 93 | swapgs |
| 94 | sti |
| 95 | sysexit |
| 96 | ENDPROC(native_irq_enable_sysexit) |
| 97 | #endif |
| 98 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | /* |
| 100 | * 32bit SYSENTER instruction entry. |
| 101 | * |
| 102 | * Arguments: |
| 103 | * %eax System call number. |
| 104 | * %ebx Arg1 |
| 105 | * %ecx Arg2 |
| 106 | * %edx Arg3 |
| 107 | * %esi Arg4 |
| 108 | * %edi Arg5 |
| 109 | * %ebp user stack |
| 110 | * 0(%ebp) Arg6 |
| 111 | * |
| 112 | * Interrupts off. |
| 113 | * |
| 114 | * This is purely a fast path. For anything complicated we use the int 0x80 |
| 115 | * path below. Set up a complete hardware stack frame to share code |
| 116 | * with the int 0x80 path. |
| 117 | */ |
| 118 | ENTRY(ia32_sysenter_target) |
Jan Beulich | 2765130 | 2006-01-11 22:41:59 +0100 | [diff] [blame] | 119 | CFI_STARTPROC32 simple |
Jan Beulich | adf1423 | 2006-09-26 10:52:41 +0200 | [diff] [blame] | 120 | CFI_SIGNAL_FRAME |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 121 | CFI_DEF_CFA rsp,0 |
| 122 | CFI_REGISTER rsp,rbp |
Jeremy Fitzhardinge | 457da70 | 2008-06-26 07:28:51 -0700 | [diff] [blame] | 123 | SWAPGS_UNSAFE_STACK |
Brian Gerst | 9af4565 | 2009-01-19 00:38:58 +0900 | [diff] [blame] | 124 | movq PER_CPU_VAR(kernel_stack), %rsp |
| 125 | addq $(KERNEL_STACK_OFFSET),%rsp |
Ingo Molnar | 2601e64 | 2006-07-03 00:24:45 -0700 | [diff] [blame] | 126 | /* |
| 127 | * No need to follow this irqs on/off section: the syscall |
| 128 | * disabled irqs, here we enable it straight after entry: |
| 129 | */ |
Jeremy Fitzhardinge | 6680415 | 2008-06-25 00:19:29 -0400 | [diff] [blame] | 130 | ENABLE_INTERRUPTS(CLBR_NONE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | movl %ebp,%ebp /* zero extension */ |
Jan Beulich | 60cf637 | 2011-02-28 15:54:40 +0000 | [diff] [blame] | 132 | pushq_cfi $__USER32_DS |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 133 | /*CFI_REL_OFFSET ss,0*/ |
Jan Beulich | 60cf637 | 2011-02-28 15:54:40 +0000 | [diff] [blame] | 134 | pushq_cfi %rbp |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 135 | CFI_REL_OFFSET rsp,0 |
Jan Beulich | 60cf637 | 2011-02-28 15:54:40 +0000 | [diff] [blame] | 136 | pushfq_cfi |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 137 | /*CFI_REL_OFFSET rflags,0*/ |
Jan Beulich | 46db09d | 2011-11-29 11:17:45 +0000 | [diff] [blame] | 138 | movl TI_sysenter_return+THREAD_INFO(%rsp,3*8-KERNEL_STACK_OFFSET),%r10d |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 139 | CFI_REGISTER rip,r10 |
Jan Beulich | 60cf637 | 2011-02-28 15:54:40 +0000 | [diff] [blame] | 140 | pushq_cfi $__USER32_CS |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 141 | /*CFI_REL_OFFSET cs,0*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | movl %eax, %eax |
Jan Beulich | 60cf637 | 2011-02-28 15:54:40 +0000 | [diff] [blame] | 143 | pushq_cfi %r10 |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 144 | CFI_REL_OFFSET rip,0 |
Jan Beulich | 60cf637 | 2011-02-28 15:54:40 +0000 | [diff] [blame] | 145 | pushq_cfi %rax |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | cld |
Borislav Petkov | cac0e0a | 2011-05-31 22:21:52 +0200 | [diff] [blame] | 147 | SAVE_ARGS 0,1,0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | /* no need to do an access_ok check here because rbp has been |
| 149 | 32bit zero extended */ |
H. Peter Anvin | 63bcff2 | 2012-09-21 12:43:12 -0700 | [diff] [blame] | 150 | ASM_STAC |
Jan Beulich | 295286a | 2008-08-29 13:21:11 +0100 | [diff] [blame] | 151 | 1: movl (%rbp),%ebp |
H. Peter Anvin | 1ce6f86 | 2012-04-20 12:19:50 -0700 | [diff] [blame] | 152 | _ASM_EXTABLE(1b,ia32_badarg) |
H. Peter Anvin | 63bcff2 | 2012-09-21 12:43:12 -0700 | [diff] [blame] | 153 | ASM_CLAC |
Andy Lutomirski | 8c7aa69 | 2014-10-01 11:49:04 -0700 | [diff] [blame^] | 154 | |
| 155 | /* |
| 156 | * Sysenter doesn't filter flags, so we need to clear NT |
| 157 | * ourselves. To save a few cycles, we can check whether |
| 158 | * NT was set instead of doing an unconditional popfq. |
| 159 | */ |
| 160 | testl $X86_EFLAGS_NT,EFLAGS(%rsp) /* saved EFLAGS match cpu */ |
| 161 | jnz sysenter_fix_flags |
| 162 | sysenter_flags_fixed: |
| 163 | |
Jan Beulich | 46db09d | 2011-11-29 11:17:45 +0000 | [diff] [blame] | 164 | orl $TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET) |
| 165 | testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 166 | CFI_REMEMBER_STATE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | jnz sysenter_tracesys |
H. Peter Anvin | 36d001c | 2010-09-14 12:42:41 -0700 | [diff] [blame] | 168 | cmpq $(IA32_NR_syscalls-1),%rax |
Andi Kleen | 67d53ea | 2006-04-07 19:50:31 +0200 | [diff] [blame] | 169 | ja ia32_badsys |
Roland McGrath | d4d6715 | 2008-07-09 02:38:07 -0700 | [diff] [blame] | 170 | sysenter_do_call: |
Jan Beulich | 295286a | 2008-08-29 13:21:11 +0100 | [diff] [blame] | 171 | IA32_ARG_FIXUP |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 172 | sysenter_dispatch: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | call *ia32_sys_call_table(,%rax,8) |
| 174 | movq %rax,RAX-ARGOFFSET(%rsp) |
Jeremy Fitzhardinge | 6680415 | 2008-06-25 00:19:29 -0400 | [diff] [blame] | 175 | DISABLE_INTERRUPTS(CLBR_NONE) |
Ingo Molnar | 2601e64 | 2006-07-03 00:24:45 -0700 | [diff] [blame] | 176 | TRACE_IRQS_OFF |
Jan Beulich | 46db09d | 2011-11-29 11:17:45 +0000 | [diff] [blame] | 177 | testl $_TIF_ALLWORK_MASK,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 178 | jnz sysexit_audit |
| 179 | sysexit_from_sys_call: |
Jan Beulich | 46db09d | 2011-11-29 11:17:45 +0000 | [diff] [blame] | 180 | andl $~TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | /* clear IF, that popfq doesn't enable interrupts early */ |
| 182 | andl $~0x200,EFLAGS-R11(%rsp) |
Roland McGrath | 36197c9 | 2008-01-30 13:30:43 +0100 | [diff] [blame] | 183 | movl RIP-R11(%rsp),%edx /* User %eip */ |
| 184 | CFI_REGISTER rip,rdx |
Borislav Petkov | 838feb4 | 2011-05-31 22:21:53 +0200 | [diff] [blame] | 185 | RESTORE_ARGS 0,24,0,0,0,0 |
Jan Beulich | 24e3580 | 2009-09-30 11:22:11 +0100 | [diff] [blame] | 186 | xorq %r8,%r8 |
| 187 | xorq %r9,%r9 |
| 188 | xorq %r10,%r10 |
| 189 | xorq %r11,%r11 |
Jan Beulich | 60cf637 | 2011-02-28 15:54:40 +0000 | [diff] [blame] | 190 | popfq_cfi |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 191 | /*CFI_RESTORE rflags*/ |
Jan Beulich | 60cf637 | 2011-02-28 15:54:40 +0000 | [diff] [blame] | 192 | popq_cfi %rcx /* User %esp */ |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 193 | CFI_REGISTER rsp,rcx |
Ingo Molnar | 2601e64 | 2006-07-03 00:24:45 -0700 | [diff] [blame] | 194 | TRACE_IRQS_ON |
Jeremy Fitzhardinge | 2be2998 | 2008-06-25 00:19:28 -0400 | [diff] [blame] | 195 | ENABLE_INTERRUPTS_SYSEXIT32 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | |
Andy Lutomirski | 8c7aa69 | 2014-10-01 11:49:04 -0700 | [diff] [blame^] | 197 | CFI_RESTORE_STATE |
| 198 | |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 199 | #ifdef CONFIG_AUDITSYSCALL |
| 200 | .macro auditsys_entry_common |
| 201 | movl %esi,%r9d /* 6th arg: 4th syscall arg */ |
| 202 | movl %edx,%r8d /* 5th arg: 3rd syscall arg */ |
| 203 | /* (already in %ecx) 4th arg: 2nd syscall arg */ |
| 204 | movl %ebx,%edx /* 3rd arg: 1st syscall arg */ |
| 205 | movl %eax,%esi /* 2nd arg: syscall number */ |
| 206 | movl $AUDIT_ARCH_I386,%edi /* 1st arg: audit arch */ |
Eric Paris | b05d844 | 2012-01-03 14:23:06 -0500 | [diff] [blame] | 207 | call __audit_syscall_entry |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 208 | movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall number */ |
H. Peter Anvin | 36d001c | 2010-09-14 12:42:41 -0700 | [diff] [blame] | 209 | cmpq $(IA32_NR_syscalls-1),%rax |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 210 | ja ia32_badsys |
| 211 | movl %ebx,%edi /* reload 1st syscall arg */ |
| 212 | movl RCX-ARGOFFSET(%rsp),%esi /* reload 2nd syscall arg */ |
| 213 | movl RDX-ARGOFFSET(%rsp),%edx /* reload 3rd syscall arg */ |
| 214 | movl RSI-ARGOFFSET(%rsp),%ecx /* reload 4th syscall arg */ |
| 215 | movl RDI-ARGOFFSET(%rsp),%r8d /* reload 5th syscall arg */ |
| 216 | .endm |
| 217 | |
Jan Beulich | 8176674 | 2009-10-26 15:20:29 +0000 | [diff] [blame] | 218 | .macro auditsys_exit exit |
Jan Beulich | 46db09d | 2011-11-29 11:17:45 +0000 | [diff] [blame] | 219 | testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) |
Jan Beulich | 24e3580 | 2009-09-30 11:22:11 +0100 | [diff] [blame] | 220 | jnz ia32_ret_from_sys_call |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 221 | TRACE_IRQS_ON |
Jan Beulich | 40a1ef9 | 2013-01-30 07:55:53 +0000 | [diff] [blame] | 222 | ENABLE_INTERRUPTS(CLBR_NONE) |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 223 | movl %eax,%esi /* second arg, syscall return value */ |
Eric Paris | d7e7528 | 2012-01-03 14:23:06 -0500 | [diff] [blame] | 224 | cmpl $-MAX_ERRNO,%eax /* is it an error ? */ |
Eric Paris | f031cd2 | 2012-01-03 14:23:06 -0500 | [diff] [blame] | 225 | jbe 1f |
| 226 | movslq %eax, %rsi /* if error sign extend to 64 bits */ |
| 227 | 1: setbe %al /* 1 if error, 0 if not */ |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 228 | movzbl %al,%edi /* zero-extend that into %edi */ |
Eric Paris | d7e7528 | 2012-01-03 14:23:06 -0500 | [diff] [blame] | 229 | call __audit_syscall_exit |
| 230 | movq RAX-ARGOFFSET(%rsp),%rax /* reload syscall return value */ |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 231 | movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi |
Jan Beulich | 40a1ef9 | 2013-01-30 07:55:53 +0000 | [diff] [blame] | 232 | DISABLE_INTERRUPTS(CLBR_NONE) |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 233 | TRACE_IRQS_OFF |
Jan Beulich | 46db09d | 2011-11-29 11:17:45 +0000 | [diff] [blame] | 234 | testl %edi,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) |
Jan Beulich | 24e3580 | 2009-09-30 11:22:11 +0100 | [diff] [blame] | 235 | jz \exit |
| 236 | CLEAR_RREGS -ARGOFFSET |
| 237 | jmp int_with_check |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 238 | .endm |
| 239 | |
| 240 | sysenter_auditsys: |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 241 | auditsys_entry_common |
| 242 | movl %ebp,%r9d /* reload 6th syscall arg */ |
| 243 | jmp sysenter_dispatch |
| 244 | |
| 245 | sysexit_audit: |
| 246 | auditsys_exit sysexit_from_sys_call |
| 247 | #endif |
| 248 | |
Andy Lutomirski | 8c7aa69 | 2014-10-01 11:49:04 -0700 | [diff] [blame^] | 249 | sysenter_fix_flags: |
| 250 | pushq_cfi $(X86_EFLAGS_IF|X86_EFLAGS_FIXED) |
| 251 | popfq_cfi |
| 252 | jmp sysenter_flags_fixed |
| 253 | |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 254 | sysenter_tracesys: |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 255 | #ifdef CONFIG_AUDITSYSCALL |
Jan Beulich | 46db09d | 2011-11-29 11:17:45 +0000 | [diff] [blame] | 256 | testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 257 | jz sysenter_auditsys |
| 258 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | SAVE_REST |
| 260 | CLEAR_RREGS |
Roland McGrath | 48ee679 | 2008-03-18 18:23:50 -0700 | [diff] [blame] | 261 | movq $-ENOSYS,RAX(%rsp)/* ptrace can change this for a bad syscall */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | movq %rsp,%rdi /* &pt_regs -> arg1 */ |
| 263 | call syscall_trace_enter |
Andi Kleen | 176df24 | 2007-09-21 16:16:18 +0200 | [diff] [blame] | 264 | LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | RESTORE_REST |
H. Peter Anvin | 36d001c | 2010-09-14 12:42:41 -0700 | [diff] [blame] | 266 | cmpq $(IA32_NR_syscalls-1),%rax |
Roland McGrath | 48ee679 | 2008-03-18 18:23:50 -0700 | [diff] [blame] | 267 | ja int_ret_from_sys_call /* sysenter_tracesys has set RAX(%rsp) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | jmp sysenter_do_call |
| 269 | CFI_ENDPROC |
Jan Beulich | 4b787e0 | 2006-06-26 13:56:55 +0200 | [diff] [blame] | 270 | ENDPROC(ia32_sysenter_target) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | |
| 272 | /* |
| 273 | * 32bit SYSCALL instruction entry. |
| 274 | * |
| 275 | * Arguments: |
| 276 | * %eax System call number. |
| 277 | * %ebx Arg1 |
| 278 | * %ecx return EIP |
| 279 | * %edx Arg3 |
| 280 | * %esi Arg4 |
| 281 | * %edi Arg5 |
| 282 | * %ebp Arg2 [note: not saved in the stack frame, should not be touched] |
| 283 | * %esp user stack |
| 284 | * 0(%esp) Arg6 |
| 285 | * |
| 286 | * Interrupts off. |
| 287 | * |
| 288 | * This is purely a fast path. For anything complicated we use the int 0x80 |
| 289 | * path below. Set up a complete hardware stack frame to share code |
| 290 | * with the int 0x80 path. |
| 291 | */ |
| 292 | ENTRY(ia32_cstar_target) |
Jan Beulich | 2765130 | 2006-01-11 22:41:59 +0100 | [diff] [blame] | 293 | CFI_STARTPROC32 simple |
Jan Beulich | adf1423 | 2006-09-26 10:52:41 +0200 | [diff] [blame] | 294 | CFI_SIGNAL_FRAME |
Brian Gerst | 9af4565 | 2009-01-19 00:38:58 +0900 | [diff] [blame] | 295 | CFI_DEF_CFA rsp,KERNEL_STACK_OFFSET |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 296 | CFI_REGISTER rip,rcx |
| 297 | /*CFI_REGISTER rflags,r11*/ |
Jeremy Fitzhardinge | 457da70 | 2008-06-26 07:28:51 -0700 | [diff] [blame] | 298 | SWAPGS_UNSAFE_STACK |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | movl %esp,%r8d |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 300 | CFI_REGISTER rsp,r8 |
Brian Gerst | 9af4565 | 2009-01-19 00:38:58 +0900 | [diff] [blame] | 301 | movq PER_CPU_VAR(kernel_stack),%rsp |
Ingo Molnar | 2601e64 | 2006-07-03 00:24:45 -0700 | [diff] [blame] | 302 | /* |
| 303 | * No need to follow this irqs on/off section: the syscall |
| 304 | * disabled irqs and here we enable it straight after entry: |
| 305 | */ |
Jeremy Fitzhardinge | 6680415 | 2008-06-25 00:19:29 -0400 | [diff] [blame] | 306 | ENABLE_INTERRUPTS(CLBR_NONE) |
Borislav Petkov | cac0e0a | 2011-05-31 22:21:52 +0200 | [diff] [blame] | 307 | SAVE_ARGS 8,0,0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | movl %eax,%eax /* zero extension */ |
| 309 | movq %rax,ORIG_RAX-ARGOFFSET(%rsp) |
| 310 | movq %rcx,RIP-ARGOFFSET(%rsp) |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 311 | CFI_REL_OFFSET rip,RIP-ARGOFFSET |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | movq %rbp,RCX-ARGOFFSET(%rsp) /* this lies slightly to ptrace */ |
| 313 | movl %ebp,%ecx |
| 314 | movq $__USER32_CS,CS-ARGOFFSET(%rsp) |
| 315 | movq $__USER32_DS,SS-ARGOFFSET(%rsp) |
| 316 | movq %r11,EFLAGS-ARGOFFSET(%rsp) |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 317 | /*CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | movq %r8,RSP-ARGOFFSET(%rsp) |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 319 | CFI_REL_OFFSET rsp,RSP-ARGOFFSET |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | /* no need to do an access_ok check here because r8 has been |
| 321 | 32bit zero extended */ |
| 322 | /* hardware stack frame is complete now */ |
H. Peter Anvin | 63bcff2 | 2012-09-21 12:43:12 -0700 | [diff] [blame] | 323 | ASM_STAC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | 1: movl (%r8),%r9d |
H. Peter Anvin | a3e859f | 2012-04-20 16:51:50 -0700 | [diff] [blame] | 325 | _ASM_EXTABLE(1b,ia32_badarg) |
H. Peter Anvin | 63bcff2 | 2012-09-21 12:43:12 -0700 | [diff] [blame] | 326 | ASM_CLAC |
Jan Beulich | 46db09d | 2011-11-29 11:17:45 +0000 | [diff] [blame] | 327 | orl $TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET) |
| 328 | testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 329 | CFI_REMEMBER_STATE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | jnz cstar_tracesys |
H. Peter Anvin | 36d001c | 2010-09-14 12:42:41 -0700 | [diff] [blame] | 331 | cmpq $IA32_NR_syscalls-1,%rax |
Andi Kleen | 67d53ea | 2006-04-07 19:50:31 +0200 | [diff] [blame] | 332 | ja ia32_badsys |
Jan Beulich | 295286a | 2008-08-29 13:21:11 +0100 | [diff] [blame] | 333 | cstar_do_call: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | IA32_ARG_FIXUP 1 |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 335 | cstar_dispatch: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | call *ia32_sys_call_table(,%rax,8) |
| 337 | movq %rax,RAX-ARGOFFSET(%rsp) |
Jeremy Fitzhardinge | 6680415 | 2008-06-25 00:19:29 -0400 | [diff] [blame] | 338 | DISABLE_INTERRUPTS(CLBR_NONE) |
Ingo Molnar | 2601e64 | 2006-07-03 00:24:45 -0700 | [diff] [blame] | 339 | TRACE_IRQS_OFF |
Jan Beulich | 46db09d | 2011-11-29 11:17:45 +0000 | [diff] [blame] | 340 | testl $_TIF_ALLWORK_MASK,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 341 | jnz sysretl_audit |
| 342 | sysretl_from_sys_call: |
Jan Beulich | 46db09d | 2011-11-29 11:17:45 +0000 | [diff] [blame] | 343 | andl $~TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET) |
Borislav Petkov | 838feb4 | 2011-05-31 22:21:53 +0200 | [diff] [blame] | 344 | RESTORE_ARGS 0,-ARG_SKIP,0,0,0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | movl RIP-ARGOFFSET(%rsp),%ecx |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 346 | CFI_REGISTER rip,rcx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 347 | movl EFLAGS-ARGOFFSET(%rsp),%r11d |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 348 | /*CFI_REGISTER rflags,r11*/ |
Jan Beulich | 24e3580 | 2009-09-30 11:22:11 +0100 | [diff] [blame] | 349 | xorq %r10,%r10 |
| 350 | xorq %r9,%r9 |
| 351 | xorq %r8,%r8 |
Ingo Molnar | 2601e64 | 2006-07-03 00:24:45 -0700 | [diff] [blame] | 352 | TRACE_IRQS_ON |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | movl RSP-ARGOFFSET(%rsp),%esp |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 354 | CFI_RESTORE rsp |
Jeremy Fitzhardinge | 2be2998 | 2008-06-25 00:19:28 -0400 | [diff] [blame] | 355 | USERGS_SYSRET32 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 357 | #ifdef CONFIG_AUDITSYSCALL |
| 358 | cstar_auditsys: |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 359 | CFI_RESTORE_STATE |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 360 | movl %r9d,R9-ARGOFFSET(%rsp) /* register to be clobbered by call */ |
| 361 | auditsys_entry_common |
| 362 | movl R9-ARGOFFSET(%rsp),%r9d /* reload 6th syscall arg */ |
| 363 | jmp cstar_dispatch |
| 364 | |
| 365 | sysretl_audit: |
Jan Beulich | 8176674 | 2009-10-26 15:20:29 +0000 | [diff] [blame] | 366 | auditsys_exit sysretl_from_sys_call |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 367 | #endif |
| 368 | |
| 369 | cstar_tracesys: |
| 370 | #ifdef CONFIG_AUDITSYSCALL |
Jan Beulich | 46db09d | 2011-11-29 11:17:45 +0000 | [diff] [blame] | 371 | testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) |
Roland McGrath | 5cbf156 | 2008-06-24 01:13:31 -0700 | [diff] [blame] | 372 | jz cstar_auditsys |
| 373 | #endif |
Chuck Ebbert | ecd744e | 2007-11-07 10:48:39 -0500 | [diff] [blame] | 374 | xchgl %r9d,%ebp |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 375 | SAVE_REST |
Jan Beulich | 24e3580 | 2009-09-30 11:22:11 +0100 | [diff] [blame] | 376 | CLEAR_RREGS 0, r9 |
Roland McGrath | 48ee679 | 2008-03-18 18:23:50 -0700 | [diff] [blame] | 377 | movq $-ENOSYS,RAX(%rsp) /* ptrace can change this for a bad syscall */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 378 | movq %rsp,%rdi /* &pt_regs -> arg1 */ |
| 379 | call syscall_trace_enter |
Jan Beulich | 295286a | 2008-08-29 13:21:11 +0100 | [diff] [blame] | 380 | LOAD_ARGS32 ARGOFFSET, 1 /* reload args from stack in case ptrace changed it */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 381 | RESTORE_REST |
Chuck Ebbert | ecd744e | 2007-11-07 10:48:39 -0500 | [diff] [blame] | 382 | xchgl %ebp,%r9d |
H. Peter Anvin | 36d001c | 2010-09-14 12:42:41 -0700 | [diff] [blame] | 383 | cmpq $(IA32_NR_syscalls-1),%rax |
Roland McGrath | 48ee679 | 2008-03-18 18:23:50 -0700 | [diff] [blame] | 384 | ja int_ret_from_sys_call /* cstar_tracesys has set RAX(%rsp) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 | jmp cstar_do_call |
Jan Beulich | 4b787e0 | 2006-06-26 13:56:55 +0200 | [diff] [blame] | 386 | END(ia32_cstar_target) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 387 | |
| 388 | ia32_badarg: |
H. Peter Anvin | 63bcff2 | 2012-09-21 12:43:12 -0700 | [diff] [blame] | 389 | ASM_CLAC |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | movq $-EFAULT,%rax |
| 391 | jmp ia32_sysret |
| 392 | CFI_ENDPROC |
| 393 | |
| 394 | /* |
| 395 | * Emulated IA32 system calls via int 0x80. |
| 396 | * |
| 397 | * Arguments: |
| 398 | * %eax System call number. |
| 399 | * %ebx Arg1 |
| 400 | * %ecx Arg2 |
| 401 | * %edx Arg3 |
| 402 | * %esi Arg4 |
| 403 | * %edi Arg5 |
| 404 | * %ebp Arg6 [note: not saved in the stack frame, should not be touched] |
| 405 | * |
| 406 | * Notes: |
| 407 | * Uses the same stack frame as the x86-64 version. |
| 408 | * All registers except %eax must be saved (but ptrace may violate that) |
| 409 | * Arguments are zero extended. For system calls that want sign extension and |
| 410 | * take long arguments a wrapper is needed. Most calls can just be called |
| 411 | * directly. |
| 412 | * Assumes it is only called from user space and entered with interrupts off. |
| 413 | */ |
| 414 | |
| 415 | ENTRY(ia32_syscall) |
Jan Beulich | cdc1793 | 2007-07-21 17:10:20 +0200 | [diff] [blame] | 416 | CFI_STARTPROC32 simple |
Jan Beulich | adf1423 | 2006-09-26 10:52:41 +0200 | [diff] [blame] | 417 | CFI_SIGNAL_FRAME |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 418 | CFI_DEF_CFA rsp,SS+8-RIP |
| 419 | /*CFI_REL_OFFSET ss,SS-RIP*/ |
| 420 | CFI_REL_OFFSET rsp,RSP-RIP |
| 421 | /*CFI_REL_OFFSET rflags,EFLAGS-RIP*/ |
| 422 | /*CFI_REL_OFFSET cs,CS-RIP*/ |
| 423 | CFI_REL_OFFSET rip,RIP-RIP |
Jeremy Fitzhardinge | 360c044 | 2008-07-08 15:06:28 -0700 | [diff] [blame] | 424 | PARAVIRT_ADJUST_EXCEPTION_FRAME |
Jeremy Fitzhardinge | 6680415 | 2008-06-25 00:19:29 -0400 | [diff] [blame] | 425 | SWAPGS |
Ingo Molnar | 2601e64 | 2006-07-03 00:24:45 -0700 | [diff] [blame] | 426 | /* |
| 427 | * No need to follow this irqs on/off section: the syscall |
| 428 | * disabled irqs and here we enable it straight after entry: |
| 429 | */ |
Jeremy Fitzhardinge | 6680415 | 2008-06-25 00:19:29 -0400 | [diff] [blame] | 430 | ENABLE_INTERRUPTS(CLBR_NONE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 431 | movl %eax,%eax |
Jan Beulich | 60cf637 | 2011-02-28 15:54:40 +0000 | [diff] [blame] | 432 | pushq_cfi %rax |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 433 | cld |
| 434 | /* note the registers are not zero extended to the sf. |
| 435 | this could be a problem. */ |
Borislav Petkov | cac0e0a | 2011-05-31 22:21:52 +0200 | [diff] [blame] | 436 | SAVE_ARGS 0,1,0 |
Jan Beulich | 46db09d | 2011-11-29 11:17:45 +0000 | [diff] [blame] | 437 | orl $TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET) |
| 438 | testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | jnz ia32_tracesys |
H. Peter Anvin | 36d001c | 2010-09-14 12:42:41 -0700 | [diff] [blame] | 440 | cmpq $(IA32_NR_syscalls-1),%rax |
Roland McGrath | c09249f | 2009-02-06 18:15:18 -0800 | [diff] [blame] | 441 | ja ia32_badsys |
| 442 | ia32_do_call: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 443 | IA32_ARG_FIXUP |
| 444 | call *ia32_sys_call_table(,%rax,8) # xxx: rip relative |
| 445 | ia32_sysret: |
| 446 | movq %rax,RAX-ARGOFFSET(%rsp) |
Jan Beulich | 24e3580 | 2009-09-30 11:22:11 +0100 | [diff] [blame] | 447 | ia32_ret_from_sys_call: |
| 448 | CLEAR_RREGS -ARGOFFSET |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 449 | jmp int_ret_from_sys_call |
| 450 | |
| 451 | ia32_tracesys: |
| 452 | SAVE_REST |
Jan Beulich | cdc1793 | 2007-07-21 17:10:20 +0200 | [diff] [blame] | 453 | CLEAR_RREGS |
Roland McGrath | 8ab32bb | 2008-03-16 21:57:41 -0700 | [diff] [blame] | 454 | movq $-ENOSYS,RAX(%rsp) /* ptrace can change this for a bad syscall */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | movq %rsp,%rdi /* &pt_regs -> arg1 */ |
| 456 | call syscall_trace_enter |
Andi Kleen | 176df24 | 2007-09-21 16:16:18 +0200 | [diff] [blame] | 457 | LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 458 | RESTORE_REST |
H. Peter Anvin | 36d001c | 2010-09-14 12:42:41 -0700 | [diff] [blame] | 459 | cmpq $(IA32_NR_syscalls-1),%rax |
Roland McGrath | c09249f | 2009-02-06 18:15:18 -0800 | [diff] [blame] | 460 | ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */ |
| 461 | jmp ia32_do_call |
Jan Beulich | 4b787e0 | 2006-06-26 13:56:55 +0200 | [diff] [blame] | 462 | END(ia32_syscall) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 463 | |
| 464 | ia32_badsys: |
| 465 | movq $0,ORIG_RAX-ARGOFFSET(%rsp) |
Jan Beulich | 24e3580 | 2009-09-30 11:22:11 +0100 | [diff] [blame] | 466 | movq $-ENOSYS,%rax |
| 467 | jmp ia32_sysret |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 469 | CFI_ENDPROC |
| 470 | |
Ramkumar Ramachandra | d2475b8 | 2013-07-10 23:34:28 +0530 | [diff] [blame] | 471 | .macro PTREGSCALL label, func |
Jan Beulich | f6b2bc8 | 2011-11-29 11:24:10 +0000 | [diff] [blame] | 472 | ALIGN |
| 473 | GLOBAL(\label) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 474 | leaq \func(%rip),%rax |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | jmp ia32_ptregs_common |
| 476 | .endm |
| 477 | |
Jan Beulich | 2765130 | 2006-01-11 22:41:59 +0100 | [diff] [blame] | 478 | CFI_STARTPROC32 |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 479 | |
Al Viro | 3fe26fa | 2012-11-12 14:32:42 -0500 | [diff] [blame] | 480 | PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn |
| 481 | PTREGSCALL stub32_sigreturn, sys32_sigreturn |
| 482 | PTREGSCALL stub32_execve, compat_sys_execve |
| 483 | PTREGSCALL stub32_fork, sys_fork |
| 484 | PTREGSCALL stub32_vfork, sys_vfork |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 485 | |
Jan Beulich | f6b2bc8 | 2011-11-29 11:24:10 +0000 | [diff] [blame] | 486 | ALIGN |
Al Viro | 1d4b4b2 | 2012-10-22 22:34:11 -0400 | [diff] [blame] | 487 | GLOBAL(stub32_clone) |
| 488 | leaq sys_clone(%rip),%rax |
| 489 | mov %r8, %rcx |
| 490 | jmp ia32_ptregs_common |
| 491 | |
| 492 | ALIGN |
Jan Beulich | f6b2bc8 | 2011-11-29 11:24:10 +0000 | [diff] [blame] | 493 | ia32_ptregs_common: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | popq %r11 |
Jan Beulich | 2765130 | 2006-01-11 22:41:59 +0100 | [diff] [blame] | 495 | CFI_ENDPROC |
| 496 | CFI_STARTPROC32 simple |
Jan Beulich | adf1423 | 2006-09-26 10:52:41 +0200 | [diff] [blame] | 497 | CFI_SIGNAL_FRAME |
Jan Beulich | 2765130 | 2006-01-11 22:41:59 +0100 | [diff] [blame] | 498 | CFI_DEF_CFA rsp,SS+8-ARGOFFSET |
| 499 | CFI_REL_OFFSET rax,RAX-ARGOFFSET |
| 500 | CFI_REL_OFFSET rcx,RCX-ARGOFFSET |
| 501 | CFI_REL_OFFSET rdx,RDX-ARGOFFSET |
| 502 | CFI_REL_OFFSET rsi,RSI-ARGOFFSET |
| 503 | CFI_REL_OFFSET rdi,RDI-ARGOFFSET |
| 504 | CFI_REL_OFFSET rip,RIP-ARGOFFSET |
| 505 | /* CFI_REL_OFFSET cs,CS-ARGOFFSET*/ |
| 506 | /* CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/ |
| 507 | CFI_REL_OFFSET rsp,RSP-ARGOFFSET |
| 508 | /* CFI_REL_OFFSET ss,SS-ARGOFFSET*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 509 | SAVE_REST |
| 510 | call *%rax |
| 511 | RESTORE_REST |
| 512 | jmp ia32_sysret /* misbalances the return cache */ |
| 513 | CFI_ENDPROC |
Jan Beulich | 4b787e0 | 2006-06-26 13:56:55 +0200 | [diff] [blame] | 514 | END(ia32_ptregs_common) |