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> |
| 15 | #include <asm/vsyscall32.h> |
| 16 | #include <linux/linkage.h> |
| 17 | |
Andi Kleen | 67d53ea | 2006-04-07 19:50:31 +0200 | [diff] [blame] | 18 | #define IA32_NR_syscalls ((ia32_syscall_end - ia32_sys_call_table)/8) |
| 19 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | .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 | |
Jan Beulich | 2765130 | 2006-01-11 22:41:59 +0100 | [diff] [blame] | 40 | .macro CFI_STARTPROC32 simple |
| 41 | CFI_STARTPROC \simple |
| 42 | CFI_UNDEFINED r8 |
| 43 | CFI_UNDEFINED r9 |
| 44 | CFI_UNDEFINED r10 |
| 45 | CFI_UNDEFINED r11 |
| 46 | CFI_UNDEFINED r12 |
| 47 | CFI_UNDEFINED r13 |
| 48 | CFI_UNDEFINED r14 |
| 49 | CFI_UNDEFINED r15 |
| 50 | .endm |
| 51 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | /* |
| 53 | * 32bit SYSENTER instruction entry. |
| 54 | * |
| 55 | * Arguments: |
| 56 | * %eax System call number. |
| 57 | * %ebx Arg1 |
| 58 | * %ecx Arg2 |
| 59 | * %edx Arg3 |
| 60 | * %esi Arg4 |
| 61 | * %edi Arg5 |
| 62 | * %ebp user stack |
| 63 | * 0(%ebp) Arg6 |
| 64 | * |
| 65 | * Interrupts off. |
| 66 | * |
| 67 | * This is purely a fast path. For anything complicated we use the int 0x80 |
| 68 | * path below. Set up a complete hardware stack frame to share code |
| 69 | * with the int 0x80 path. |
| 70 | */ |
| 71 | ENTRY(ia32_sysenter_target) |
Jan Beulich | 2765130 | 2006-01-11 22:41:59 +0100 | [diff] [blame] | 72 | CFI_STARTPROC32 simple |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 73 | CFI_DEF_CFA rsp,0 |
| 74 | CFI_REGISTER rsp,rbp |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | swapgs |
| 76 | movq %gs:pda_kernelstack, %rsp |
| 77 | addq $(PDA_STACKOFFSET),%rsp |
| 78 | sti |
| 79 | movl %ebp,%ebp /* zero extension */ |
| 80 | pushq $__USER32_DS |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 81 | CFI_ADJUST_CFA_OFFSET 8 |
| 82 | /*CFI_REL_OFFSET ss,0*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | pushq %rbp |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 84 | CFI_ADJUST_CFA_OFFSET 8 |
| 85 | CFI_REL_OFFSET rsp,0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | pushfq |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 87 | CFI_ADJUST_CFA_OFFSET 8 |
| 88 | /*CFI_REL_OFFSET rflags,0*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | movl $VSYSCALL32_SYSEXIT, %r10d |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 90 | CFI_REGISTER rip,r10 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | pushq $__USER32_CS |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 92 | CFI_ADJUST_CFA_OFFSET 8 |
| 93 | /*CFI_REL_OFFSET cs,0*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | movl %eax, %eax |
| 95 | pushq %r10 |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 96 | CFI_ADJUST_CFA_OFFSET 8 |
| 97 | CFI_REL_OFFSET rip,0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | pushq %rax |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 99 | CFI_ADJUST_CFA_OFFSET 8 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | cld |
| 101 | SAVE_ARGS 0,0,1 |
| 102 | /* no need to do an access_ok check here because rbp has been |
| 103 | 32bit zero extended */ |
| 104 | 1: movl (%rbp),%r9d |
| 105 | .section __ex_table,"a" |
| 106 | .quad 1b,ia32_badarg |
| 107 | .previous |
| 108 | GET_THREAD_INFO(%r10) |
Andi Kleen | bf2fcc6 | 2006-01-11 22:44:06 +0100 | [diff] [blame] | 109 | orl $TS_COMPAT,threadinfo_status(%r10) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 111 | CFI_REMEMBER_STATE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | jnz sysenter_tracesys |
| 113 | sysenter_do_call: |
Andi Kleen | 67d53ea | 2006-04-07 19:50:31 +0200 | [diff] [blame] | 114 | cmpl $(IA32_NR_syscalls-1),%eax |
| 115 | ja ia32_badsys |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | IA32_ARG_FIXUP 1 |
| 117 | call *ia32_sys_call_table(,%rax,8) |
| 118 | movq %rax,RAX-ARGOFFSET(%rsp) |
| 119 | GET_THREAD_INFO(%r10) |
| 120 | cli |
| 121 | testl $_TIF_ALLWORK_MASK,threadinfo_flags(%r10) |
| 122 | jnz int_ret_from_sys_call |
Andi Kleen | bf2fcc6 | 2006-01-11 22:44:06 +0100 | [diff] [blame] | 123 | andl $~TS_COMPAT,threadinfo_status(%r10) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | /* clear IF, that popfq doesn't enable interrupts early */ |
| 125 | andl $~0x200,EFLAGS-R11(%rsp) |
| 126 | RESTORE_ARGS 1,24,1,1,1,1 |
| 127 | popfq |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 128 | CFI_ADJUST_CFA_OFFSET -8 |
| 129 | /*CFI_RESTORE rflags*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | popq %rcx /* User %esp */ |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 131 | CFI_ADJUST_CFA_OFFSET -8 |
| 132 | CFI_REGISTER rsp,rcx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | movl $VSYSCALL32_SYSEXIT,%edx /* User %eip */ |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 134 | CFI_REGISTER rip,rdx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | swapgs |
| 136 | sti /* sti only takes effect after the next instruction */ |
| 137 | /* sysexit */ |
| 138 | .byte 0xf, 0x35 |
| 139 | |
| 140 | sysenter_tracesys: |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 141 | CFI_RESTORE_STATE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | SAVE_REST |
| 143 | CLEAR_RREGS |
| 144 | movq $-ENOSYS,RAX(%rsp) /* really needed? */ |
| 145 | movq %rsp,%rdi /* &pt_regs -> arg1 */ |
| 146 | call syscall_trace_enter |
| 147 | LOAD_ARGS ARGOFFSET /* reload args from stack in case ptrace changed it */ |
| 148 | RESTORE_REST |
| 149 | movl %ebp, %ebp |
| 150 | /* no need to do an access_ok check here because rbp has been |
| 151 | 32bit zero extended */ |
| 152 | 1: movl (%rbp),%r9d |
| 153 | .section __ex_table,"a" |
| 154 | .quad 1b,ia32_badarg |
| 155 | .previous |
| 156 | jmp sysenter_do_call |
| 157 | CFI_ENDPROC |
| 158 | |
| 159 | /* |
| 160 | * 32bit SYSCALL instruction entry. |
| 161 | * |
| 162 | * Arguments: |
| 163 | * %eax System call number. |
| 164 | * %ebx Arg1 |
| 165 | * %ecx return EIP |
| 166 | * %edx Arg3 |
| 167 | * %esi Arg4 |
| 168 | * %edi Arg5 |
| 169 | * %ebp Arg2 [note: not saved in the stack frame, should not be touched] |
| 170 | * %esp user stack |
| 171 | * 0(%esp) Arg6 |
| 172 | * |
| 173 | * Interrupts off. |
| 174 | * |
| 175 | * This is purely a fast path. For anything complicated we use the int 0x80 |
| 176 | * path below. Set up a complete hardware stack frame to share code |
| 177 | * with the int 0x80 path. |
| 178 | */ |
| 179 | ENTRY(ia32_cstar_target) |
Jan Beulich | 2765130 | 2006-01-11 22:41:59 +0100 | [diff] [blame] | 180 | CFI_STARTPROC32 simple |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 181 | CFI_DEF_CFA rsp,0 |
| 182 | CFI_REGISTER rip,rcx |
| 183 | /*CFI_REGISTER rflags,r11*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | swapgs |
| 185 | movl %esp,%r8d |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 186 | CFI_REGISTER rsp,r8 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | movq %gs:pda_kernelstack,%rsp |
| 188 | sti |
| 189 | SAVE_ARGS 8,1,1 |
| 190 | movl %eax,%eax /* zero extension */ |
| 191 | movq %rax,ORIG_RAX-ARGOFFSET(%rsp) |
| 192 | movq %rcx,RIP-ARGOFFSET(%rsp) |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 193 | CFI_REL_OFFSET rip,RIP-ARGOFFSET |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | movq %rbp,RCX-ARGOFFSET(%rsp) /* this lies slightly to ptrace */ |
| 195 | movl %ebp,%ecx |
| 196 | movq $__USER32_CS,CS-ARGOFFSET(%rsp) |
| 197 | movq $__USER32_DS,SS-ARGOFFSET(%rsp) |
| 198 | movq %r11,EFLAGS-ARGOFFSET(%rsp) |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 199 | /*CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 200 | movq %r8,RSP-ARGOFFSET(%rsp) |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 201 | CFI_REL_OFFSET rsp,RSP-ARGOFFSET |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | /* no need to do an access_ok check here because r8 has been |
| 203 | 32bit zero extended */ |
| 204 | /* hardware stack frame is complete now */ |
| 205 | 1: movl (%r8),%r9d |
| 206 | .section __ex_table,"a" |
| 207 | .quad 1b,ia32_badarg |
| 208 | .previous |
| 209 | GET_THREAD_INFO(%r10) |
Andi Kleen | bf2fcc6 | 2006-01-11 22:44:06 +0100 | [diff] [blame] | 210 | orl $TS_COMPAT,threadinfo_status(%r10) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 211 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 212 | CFI_REMEMBER_STATE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | jnz cstar_tracesys |
| 214 | cstar_do_call: |
Andi Kleen | 67d53ea | 2006-04-07 19:50:31 +0200 | [diff] [blame] | 215 | cmpl $IA32_NR_syscalls-1,%eax |
| 216 | ja ia32_badsys |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 | IA32_ARG_FIXUP 1 |
| 218 | call *ia32_sys_call_table(,%rax,8) |
| 219 | movq %rax,RAX-ARGOFFSET(%rsp) |
| 220 | GET_THREAD_INFO(%r10) |
| 221 | cli |
| 222 | testl $_TIF_ALLWORK_MASK,threadinfo_flags(%r10) |
| 223 | jnz int_ret_from_sys_call |
Andi Kleen | bf2fcc6 | 2006-01-11 22:44:06 +0100 | [diff] [blame] | 224 | andl $~TS_COMPAT,threadinfo_status(%r10) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | RESTORE_ARGS 1,-ARG_SKIP,1,1,1 |
| 226 | movl RIP-ARGOFFSET(%rsp),%ecx |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 227 | CFI_REGISTER rip,rcx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | movl EFLAGS-ARGOFFSET(%rsp),%r11d |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 229 | /*CFI_REGISTER rflags,r11*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 230 | movl RSP-ARGOFFSET(%rsp),%esp |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 231 | CFI_RESTORE rsp |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 | swapgs |
| 233 | sysretl |
| 234 | |
| 235 | cstar_tracesys: |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 236 | CFI_RESTORE_STATE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | SAVE_REST |
| 238 | CLEAR_RREGS |
| 239 | movq $-ENOSYS,RAX(%rsp) /* really needed? */ |
| 240 | movq %rsp,%rdi /* &pt_regs -> arg1 */ |
| 241 | call syscall_trace_enter |
| 242 | LOAD_ARGS ARGOFFSET /* reload args from stack in case ptrace changed it */ |
| 243 | RESTORE_REST |
| 244 | movl RSP-ARGOFFSET(%rsp), %r8d |
| 245 | /* no need to do an access_ok check here because r8 has been |
| 246 | 32bit zero extended */ |
| 247 | 1: movl (%r8),%r9d |
| 248 | .section __ex_table,"a" |
| 249 | .quad 1b,ia32_badarg |
| 250 | .previous |
| 251 | jmp cstar_do_call |
| 252 | |
| 253 | ia32_badarg: |
| 254 | movq $-EFAULT,%rax |
| 255 | jmp ia32_sysret |
| 256 | CFI_ENDPROC |
| 257 | |
| 258 | /* |
| 259 | * Emulated IA32 system calls via int 0x80. |
| 260 | * |
| 261 | * Arguments: |
| 262 | * %eax System call number. |
| 263 | * %ebx Arg1 |
| 264 | * %ecx Arg2 |
| 265 | * %edx Arg3 |
| 266 | * %esi Arg4 |
| 267 | * %edi Arg5 |
| 268 | * %ebp Arg6 [note: not saved in the stack frame, should not be touched] |
| 269 | * |
| 270 | * Notes: |
| 271 | * Uses the same stack frame as the x86-64 version. |
| 272 | * All registers except %eax must be saved (but ptrace may violate that) |
| 273 | * Arguments are zero extended. For system calls that want sign extension and |
| 274 | * take long arguments a wrapper is needed. Most calls can just be called |
| 275 | * directly. |
| 276 | * Assumes it is only called from user space and entered with interrupts off. |
| 277 | */ |
| 278 | |
| 279 | ENTRY(ia32_syscall) |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 280 | CFI_STARTPROC simple |
| 281 | CFI_DEF_CFA rsp,SS+8-RIP |
| 282 | /*CFI_REL_OFFSET ss,SS-RIP*/ |
| 283 | CFI_REL_OFFSET rsp,RSP-RIP |
| 284 | /*CFI_REL_OFFSET rflags,EFLAGS-RIP*/ |
| 285 | /*CFI_REL_OFFSET cs,CS-RIP*/ |
| 286 | CFI_REL_OFFSET rip,RIP-RIP |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | swapgs |
| 288 | sti |
| 289 | movl %eax,%eax |
| 290 | pushq %rax |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 291 | CFI_ADJUST_CFA_OFFSET 8 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | cld |
| 293 | /* note the registers are not zero extended to the sf. |
| 294 | this could be a problem. */ |
| 295 | SAVE_ARGS 0,0,1 |
| 296 | GET_THREAD_INFO(%r10) |
Andi Kleen | bf2fcc6 | 2006-01-11 22:44:06 +0100 | [diff] [blame] | 297 | orl $TS_COMPAT,threadinfo_status(%r10) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) |
| 299 | jnz ia32_tracesys |
| 300 | ia32_do_syscall: |
Andi Kleen | 67d53ea | 2006-04-07 19:50:31 +0200 | [diff] [blame] | 301 | cmpl $(IA32_NR_syscalls-1),%eax |
| 302 | ja ia32_badsys |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | IA32_ARG_FIXUP |
| 304 | call *ia32_sys_call_table(,%rax,8) # xxx: rip relative |
| 305 | ia32_sysret: |
| 306 | movq %rax,RAX-ARGOFFSET(%rsp) |
| 307 | jmp int_ret_from_sys_call |
| 308 | |
| 309 | ia32_tracesys: |
| 310 | SAVE_REST |
| 311 | movq $-ENOSYS,RAX(%rsp) /* really needed? */ |
| 312 | movq %rsp,%rdi /* &pt_regs -> arg1 */ |
| 313 | call syscall_trace_enter |
| 314 | LOAD_ARGS ARGOFFSET /* reload args from stack in case ptrace changed it */ |
| 315 | RESTORE_REST |
| 316 | jmp ia32_do_syscall |
| 317 | |
| 318 | ia32_badsys: |
| 319 | movq $0,ORIG_RAX-ARGOFFSET(%rsp) |
| 320 | movq $-ENOSYS,RAX-ARGOFFSET(%rsp) |
| 321 | jmp int_ret_from_sys_call |
| 322 | |
| 323 | ni_syscall: |
| 324 | movq %rax,%rdi |
| 325 | jmp sys32_ni_syscall |
| 326 | |
| 327 | quiet_ni_syscall: |
| 328 | movq $-ENOSYS,%rax |
| 329 | ret |
| 330 | CFI_ENDPROC |
| 331 | |
| 332 | .macro PTREGSCALL label, func, arg |
| 333 | .globl \label |
| 334 | \label: |
| 335 | leaq \func(%rip),%rax |
| 336 | leaq -ARGOFFSET+8(%rsp),\arg /* 8 for return address */ |
| 337 | jmp ia32_ptregs_common |
| 338 | .endm |
| 339 | |
Jan Beulich | 2765130 | 2006-01-11 22:41:59 +0100 | [diff] [blame] | 340 | CFI_STARTPROC32 |
Jan Beulich | 7effaa8 | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 341 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi |
| 343 | PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi |
| 344 | PTREGSCALL stub32_sigaltstack, sys32_sigaltstack, %rdx |
| 345 | PTREGSCALL stub32_sigsuspend, sys32_sigsuspend, %rcx |
| 346 | PTREGSCALL stub32_execve, sys32_execve, %rcx |
| 347 | PTREGSCALL stub32_fork, sys_fork, %rdi |
| 348 | PTREGSCALL stub32_clone, sys32_clone, %rdx |
| 349 | PTREGSCALL stub32_vfork, sys_vfork, %rdi |
| 350 | PTREGSCALL stub32_iopl, sys_iopl, %rsi |
| 351 | PTREGSCALL stub32_rt_sigsuspend, sys_rt_sigsuspend, %rdx |
| 352 | |
| 353 | ENTRY(ia32_ptregs_common) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | popq %r11 |
Jan Beulich | 2765130 | 2006-01-11 22:41:59 +0100 | [diff] [blame] | 355 | CFI_ENDPROC |
| 356 | CFI_STARTPROC32 simple |
| 357 | CFI_DEF_CFA rsp,SS+8-ARGOFFSET |
| 358 | CFI_REL_OFFSET rax,RAX-ARGOFFSET |
| 359 | CFI_REL_OFFSET rcx,RCX-ARGOFFSET |
| 360 | CFI_REL_OFFSET rdx,RDX-ARGOFFSET |
| 361 | CFI_REL_OFFSET rsi,RSI-ARGOFFSET |
| 362 | CFI_REL_OFFSET rdi,RDI-ARGOFFSET |
| 363 | CFI_REL_OFFSET rip,RIP-ARGOFFSET |
| 364 | /* CFI_REL_OFFSET cs,CS-ARGOFFSET*/ |
| 365 | /* CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/ |
| 366 | CFI_REL_OFFSET rsp,RSP-ARGOFFSET |
| 367 | /* CFI_REL_OFFSET ss,SS-ARGOFFSET*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 368 | SAVE_REST |
| 369 | call *%rax |
| 370 | RESTORE_REST |
| 371 | jmp ia32_sysret /* misbalances the return cache */ |
| 372 | CFI_ENDPROC |
| 373 | |
Arjan van de Ven | bb152f5 | 2006-01-06 00:12:05 -0800 | [diff] [blame] | 374 | .section .rodata,"a" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 375 | .align 8 |
| 376 | .globl ia32_sys_call_table |
| 377 | ia32_sys_call_table: |
| 378 | .quad sys_restart_syscall |
| 379 | .quad sys_exit |
| 380 | .quad stub32_fork |
| 381 | .quad sys_read |
| 382 | .quad sys_write |
Miklos Szeredi | e922efc | 2005-09-06 15:18:25 -0700 | [diff] [blame] | 383 | .quad compat_sys_open /* 5 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 384 | .quad sys_close |
| 385 | .quad sys32_waitpid |
| 386 | .quad sys_creat |
| 387 | .quad sys_link |
| 388 | .quad sys_unlink /* 10 */ |
| 389 | .quad stub32_execve |
| 390 | .quad sys_chdir |
| 391 | .quad compat_sys_time |
| 392 | .quad sys_mknod |
| 393 | .quad sys_chmod /* 15 */ |
| 394 | .quad sys_lchown16 |
| 395 | .quad quiet_ni_syscall /* old break syscall holder */ |
| 396 | .quad sys_stat |
| 397 | .quad sys32_lseek |
| 398 | .quad sys_getpid /* 20 */ |
| 399 | .quad compat_sys_mount /* mount */ |
| 400 | .quad sys_oldumount /* old_umount */ |
| 401 | .quad sys_setuid16 |
| 402 | .quad sys_getuid16 |
| 403 | .quad compat_sys_stime /* stime */ /* 25 */ |
| 404 | .quad sys32_ptrace /* ptrace */ |
| 405 | .quad sys_alarm |
| 406 | .quad sys_fstat /* (old)fstat */ |
| 407 | .quad sys_pause |
| 408 | .quad compat_sys_utime /* 30 */ |
| 409 | .quad quiet_ni_syscall /* old stty syscall holder */ |
| 410 | .quad quiet_ni_syscall /* old gtty syscall holder */ |
| 411 | .quad sys_access |
| 412 | .quad sys_nice |
| 413 | .quad quiet_ni_syscall /* 35 */ /* old ftime syscall holder */ |
| 414 | .quad sys_sync |
| 415 | .quad sys32_kill |
| 416 | .quad sys_rename |
| 417 | .quad sys_mkdir |
| 418 | .quad sys_rmdir /* 40 */ |
| 419 | .quad sys_dup |
| 420 | .quad sys32_pipe |
| 421 | .quad compat_sys_times |
| 422 | .quad quiet_ni_syscall /* old prof syscall holder */ |
| 423 | .quad sys_brk /* 45 */ |
| 424 | .quad sys_setgid16 |
| 425 | .quad sys_getgid16 |
| 426 | .quad sys_signal |
| 427 | .quad sys_geteuid16 |
| 428 | .quad sys_getegid16 /* 50 */ |
| 429 | .quad sys_acct |
| 430 | .quad sys_umount /* new_umount */ |
| 431 | .quad quiet_ni_syscall /* old lock syscall holder */ |
| 432 | .quad compat_sys_ioctl |
| 433 | .quad compat_sys_fcntl64 /* 55 */ |
| 434 | .quad quiet_ni_syscall /* old mpx syscall holder */ |
| 435 | .quad sys_setpgid |
| 436 | .quad quiet_ni_syscall /* old ulimit syscall holder */ |
| 437 | .quad sys32_olduname |
| 438 | .quad sys_umask /* 60 */ |
| 439 | .quad sys_chroot |
| 440 | .quad sys32_ustat |
| 441 | .quad sys_dup2 |
| 442 | .quad sys_getppid |
| 443 | .quad sys_getpgrp /* 65 */ |
| 444 | .quad sys_setsid |
| 445 | .quad sys32_sigaction |
| 446 | .quad sys_sgetmask |
| 447 | .quad sys_ssetmask |
| 448 | .quad sys_setreuid16 /* 70 */ |
| 449 | .quad sys_setregid16 |
| 450 | .quad stub32_sigsuspend |
| 451 | .quad compat_sys_sigpending |
| 452 | .quad sys_sethostname |
| 453 | .quad compat_sys_setrlimit /* 75 */ |
| 454 | .quad compat_sys_old_getrlimit /* old_getrlimit */ |
| 455 | .quad compat_sys_getrusage |
| 456 | .quad sys32_gettimeofday |
| 457 | .quad sys32_settimeofday |
| 458 | .quad sys_getgroups16 /* 80 */ |
| 459 | .quad sys_setgroups16 |
| 460 | .quad sys32_old_select |
| 461 | .quad sys_symlink |
| 462 | .quad sys_lstat |
| 463 | .quad sys_readlink /* 85 */ |
| 464 | #ifdef CONFIG_IA32_AOUT |
| 465 | .quad sys_uselib |
| 466 | #else |
| 467 | .quad quiet_ni_syscall |
| 468 | #endif |
| 469 | .quad sys_swapon |
| 470 | .quad sys_reboot |
| 471 | .quad compat_sys_old_readdir |
| 472 | .quad sys32_mmap /* 90 */ |
| 473 | .quad sys_munmap |
| 474 | .quad sys_truncate |
| 475 | .quad sys_ftruncate |
| 476 | .quad sys_fchmod |
| 477 | .quad sys_fchown16 /* 95 */ |
| 478 | .quad sys_getpriority |
| 479 | .quad sys_setpriority |
| 480 | .quad quiet_ni_syscall /* old profil syscall holder */ |
| 481 | .quad compat_sys_statfs |
| 482 | .quad compat_sys_fstatfs /* 100 */ |
| 483 | .quad sys_ioperm |
| 484 | .quad compat_sys_socketcall |
| 485 | .quad sys_syslog |
| 486 | .quad compat_sys_setitimer |
| 487 | .quad compat_sys_getitimer /* 105 */ |
| 488 | .quad compat_sys_newstat |
| 489 | .quad compat_sys_newlstat |
| 490 | .quad compat_sys_newfstat |
| 491 | .quad sys32_uname |
| 492 | .quad stub32_iopl /* 110 */ |
| 493 | .quad sys_vhangup |
| 494 | .quad quiet_ni_syscall /* old "idle" system call */ |
| 495 | .quad sys32_vm86_warning /* vm86old */ |
| 496 | .quad compat_sys_wait4 |
| 497 | .quad sys_swapoff /* 115 */ |
| 498 | .quad sys32_sysinfo |
| 499 | .quad sys32_ipc |
| 500 | .quad sys_fsync |
| 501 | .quad stub32_sigreturn |
| 502 | .quad stub32_clone /* 120 */ |
| 503 | .quad sys_setdomainname |
| 504 | .quad sys_uname |
| 505 | .quad sys_modify_ldt |
Stephen Rothwell | 3158e94 | 2006-03-26 01:37:29 -0800 | [diff] [blame] | 506 | .quad compat_sys_adjtimex |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 507 | .quad sys32_mprotect /* 125 */ |
| 508 | .quad compat_sys_sigprocmask |
| 509 | .quad quiet_ni_syscall /* create_module */ |
| 510 | .quad sys_init_module |
| 511 | .quad sys_delete_module |
| 512 | .quad quiet_ni_syscall /* 130 get_kernel_syms */ |
| 513 | .quad sys_quotactl |
| 514 | .quad sys_getpgid |
| 515 | .quad sys_fchdir |
| 516 | .quad quiet_ni_syscall /* bdflush */ |
| 517 | .quad sys_sysfs /* 135 */ |
| 518 | .quad sys_personality |
| 519 | .quad quiet_ni_syscall /* for afs_syscall */ |
| 520 | .quad sys_setfsuid16 |
| 521 | .quad sys_setfsgid16 |
| 522 | .quad sys_llseek /* 140 */ |
| 523 | .quad compat_sys_getdents |
| 524 | .quad compat_sys_select |
| 525 | .quad sys_flock |
| 526 | .quad sys_msync |
| 527 | .quad compat_sys_readv /* 145 */ |
| 528 | .quad compat_sys_writev |
| 529 | .quad sys_getsid |
| 530 | .quad sys_fdatasync |
| 531 | .quad sys32_sysctl /* sysctl */ |
| 532 | .quad sys_mlock /* 150 */ |
| 533 | .quad sys_munlock |
| 534 | .quad sys_mlockall |
| 535 | .quad sys_munlockall |
| 536 | .quad sys_sched_setparam |
| 537 | .quad sys_sched_getparam /* 155 */ |
| 538 | .quad sys_sched_setscheduler |
| 539 | .quad sys_sched_getscheduler |
| 540 | .quad sys_sched_yield |
| 541 | .quad sys_sched_get_priority_max |
| 542 | .quad sys_sched_get_priority_min /* 160 */ |
| 543 | .quad sys_sched_rr_get_interval |
| 544 | .quad compat_sys_nanosleep |
| 545 | .quad sys_mremap |
| 546 | .quad sys_setresuid16 |
| 547 | .quad sys_getresuid16 /* 165 */ |
| 548 | .quad sys32_vm86_warning /* vm86 */ |
| 549 | .quad quiet_ni_syscall /* query_module */ |
| 550 | .quad sys_poll |
| 551 | .quad compat_sys_nfsservctl |
| 552 | .quad sys_setresgid16 /* 170 */ |
| 553 | .quad sys_getresgid16 |
| 554 | .quad sys_prctl |
| 555 | .quad stub32_rt_sigreturn |
| 556 | .quad sys32_rt_sigaction |
| 557 | .quad sys32_rt_sigprocmask /* 175 */ |
| 558 | .quad sys32_rt_sigpending |
| 559 | .quad compat_sys_rt_sigtimedwait |
| 560 | .quad sys32_rt_sigqueueinfo |
| 561 | .quad stub32_rt_sigsuspend |
| 562 | .quad sys32_pread /* 180 */ |
| 563 | .quad sys32_pwrite |
| 564 | .quad sys_chown16 |
| 565 | .quad sys_getcwd |
| 566 | .quad sys_capget |
| 567 | .quad sys_capset |
| 568 | .quad stub32_sigaltstack |
| 569 | .quad sys32_sendfile |
| 570 | .quad quiet_ni_syscall /* streams1 */ |
| 571 | .quad quiet_ni_syscall /* streams2 */ |
| 572 | .quad stub32_vfork /* 190 */ |
| 573 | .quad compat_sys_getrlimit |
| 574 | .quad sys32_mmap2 |
| 575 | .quad sys32_truncate64 |
| 576 | .quad sys32_ftruncate64 |
| 577 | .quad sys32_stat64 /* 195 */ |
| 578 | .quad sys32_lstat64 |
| 579 | .quad sys32_fstat64 |
| 580 | .quad sys_lchown |
| 581 | .quad sys_getuid |
| 582 | .quad sys_getgid /* 200 */ |
| 583 | .quad sys_geteuid |
| 584 | .quad sys_getegid |
| 585 | .quad sys_setreuid |
| 586 | .quad sys_setregid |
| 587 | .quad sys_getgroups /* 205 */ |
| 588 | .quad sys_setgroups |
| 589 | .quad sys_fchown |
| 590 | .quad sys_setresuid |
| 591 | .quad sys_getresuid |
| 592 | .quad sys_setresgid /* 210 */ |
| 593 | .quad sys_getresgid |
| 594 | .quad sys_chown |
| 595 | .quad sys_setuid |
| 596 | .quad sys_setgid |
| 597 | .quad sys_setfsuid /* 215 */ |
| 598 | .quad sys_setfsgid |
| 599 | .quad sys_pivot_root |
| 600 | .quad sys_mincore |
| 601 | .quad sys_madvise |
| 602 | .quad compat_sys_getdents64 /* 220 getdents64 */ |
| 603 | .quad compat_sys_fcntl64 |
| 604 | .quad quiet_ni_syscall /* tux */ |
| 605 | .quad quiet_ni_syscall /* security */ |
| 606 | .quad sys_gettid |
| 607 | .quad sys_readahead /* 225 */ |
| 608 | .quad sys_setxattr |
| 609 | .quad sys_lsetxattr |
| 610 | .quad sys_fsetxattr |
| 611 | .quad sys_getxattr |
| 612 | .quad sys_lgetxattr /* 230 */ |
| 613 | .quad sys_fgetxattr |
| 614 | .quad sys_listxattr |
| 615 | .quad sys_llistxattr |
| 616 | .quad sys_flistxattr |
| 617 | .quad sys_removexattr /* 235 */ |
| 618 | .quad sys_lremovexattr |
| 619 | .quad sys_fremovexattr |
| 620 | .quad sys_tkill |
| 621 | .quad sys_sendfile64 |
| 622 | .quad compat_sys_futex /* 240 */ |
| 623 | .quad compat_sys_sched_setaffinity |
| 624 | .quad compat_sys_sched_getaffinity |
| 625 | .quad sys32_set_thread_area |
| 626 | .quad sys32_get_thread_area |
| 627 | .quad compat_sys_io_setup /* 245 */ |
| 628 | .quad sys_io_destroy |
| 629 | .quad compat_sys_io_getevents |
| 630 | .quad compat_sys_io_submit |
| 631 | .quad sys_io_cancel |
| 632 | .quad sys_fadvise64 /* 250 */ |
| 633 | .quad quiet_ni_syscall /* free_huge_pages */ |
| 634 | .quad sys_exit_group |
| 635 | .quad sys32_lookup_dcookie |
| 636 | .quad sys_epoll_create |
| 637 | .quad sys_epoll_ctl /* 255 */ |
| 638 | .quad sys_epoll_wait |
| 639 | .quad sys_remap_file_pages |
| 640 | .quad sys_set_tid_address |
Christoph Hellwig | 3a0f69d | 2006-01-09 20:52:08 -0800 | [diff] [blame] | 641 | .quad compat_sys_timer_create |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 642 | .quad compat_sys_timer_settime /* 260 */ |
| 643 | .quad compat_sys_timer_gettime |
| 644 | .quad sys_timer_getoverrun |
| 645 | .quad sys_timer_delete |
| 646 | .quad compat_sys_clock_settime |
| 647 | .quad compat_sys_clock_gettime /* 265 */ |
| 648 | .quad compat_sys_clock_getres |
| 649 | .quad compat_sys_clock_nanosleep |
| 650 | .quad compat_sys_statfs64 |
| 651 | .quad compat_sys_fstatfs64 |
| 652 | .quad sys_tgkill /* 270 */ |
| 653 | .quad compat_sys_utimes |
| 654 | .quad sys32_fadvise64_64 |
| 655 | .quad quiet_ni_syscall /* sys_vserver */ |
| 656 | .quad sys_mbind |
| 657 | .quad compat_sys_get_mempolicy /* 275 */ |
| 658 | .quad sys_set_mempolicy |
| 659 | .quad compat_sys_mq_open |
| 660 | .quad sys_mq_unlink |
| 661 | .quad compat_sys_mq_timedsend |
| 662 | .quad compat_sys_mq_timedreceive /* 280 */ |
| 663 | .quad compat_sys_mq_notify |
| 664 | .quad compat_sys_mq_getsetattr |
Eric W. Biederman | 5234f5e | 2005-06-25 14:58:02 -0700 | [diff] [blame] | 665 | .quad compat_sys_kexec_load /* reserved for kexec */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 666 | .quad compat_sys_waitid |
Robert Love | 725b38ab | 2005-07-25 15:19:29 -0400 | [diff] [blame] | 667 | .quad quiet_ni_syscall /* 285: sys_altroot */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 668 | .quad sys_add_key |
| 669 | .quad sys_request_key |
| 670 | .quad sys_keyctl |
Robert Love | 725b38ab | 2005-07-25 15:19:29 -0400 | [diff] [blame] | 671 | .quad sys_ioprio_set |
| 672 | .quad sys_ioprio_get /* 290 */ |
| 673 | .quad sys_inotify_init |
| 674 | .quad sys_inotify_add_watch |
| 675 | .quad sys_inotify_rm_watch |
Christoph Lameter | 3974388 | 2006-01-08 01:00:51 -0800 | [diff] [blame] | 676 | .quad sys_migrate_pages |
Ulrich Drepper | a60fc51 | 2006-01-18 17:43:56 -0800 | [diff] [blame] | 677 | .quad compat_sys_openat /* 295 */ |
| 678 | .quad sys_mkdirat |
| 679 | .quad sys_mknodat |
| 680 | .quad sys_fchownat |
Andrew Morton | 3833a70 | 2006-02-01 03:04:32 -0800 | [diff] [blame] | 681 | .quad compat_sys_futimesat |
Ulrich Drepper | cff2b76 | 2006-02-11 17:55:47 -0800 | [diff] [blame] | 682 | .quad sys32_fstatat /* 300 */ |
Ulrich Drepper | a60fc51 | 2006-01-18 17:43:56 -0800 | [diff] [blame] | 683 | .quad sys_unlinkat |
| 684 | .quad sys_renameat |
| 685 | .quad sys_linkat |
| 686 | .quad sys_symlinkat |
| 687 | .quad sys_readlinkat /* 305 */ |
| 688 | .quad sys_fchmodat |
| 689 | .quad sys_faccessat |
Andi Kleen | b8feb47 | 2006-04-07 19:50:34 +0200 | [diff] [blame] | 690 | .quad quiet_ni_syscall /* pselect6 for now */ |
| 691 | .quad quiet_ni_syscall /* ppoll for now */ |
Andi Kleen | 4b88f09 | 2006-02-09 00:35:50 +0100 | [diff] [blame] | 692 | .quad sys_unshare /* 310 */ |
Ingo Molnar | 8fdd6c6 | 2006-03-27 01:16:26 -0800 | [diff] [blame] | 693 | .quad compat_sys_set_robust_list |
| 694 | .quad compat_sys_get_robust_list |
Andi Kleen | b8feb47 | 2006-04-07 19:50:34 +0200 | [diff] [blame] | 695 | .quad sys_splice |
| 696 | .quad sys_sync_file_range |
Andi Kleen | f1233ab | 2006-04-18 12:35:19 +0200 | [diff] [blame] | 697 | .quad sys_tee |
Andi Kleen | d261020 | 2006-05-01 12:15:48 -0700 | [diff] [blame] | 698 | .quad compat_sys_vmsplice |
Christoph Lameter | 1b2db9f | 2006-06-23 02:03:56 -0700 | [diff] [blame] | 699 | .quad compat_sys_move_pages |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 700 | ia32_syscall_end: |