diff options
Diffstat (limited to 'arch/x86/ia32/ia32entry.S')
-rw-r--r-- | arch/x86/ia32/ia32entry.S | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S index 74619c4f9fda..581b0568fe19 100644 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S | |||
@@ -21,8 +21,8 @@ | |||
21 | #define __AUDIT_ARCH_LE 0x40000000 | 21 | #define __AUDIT_ARCH_LE 0x40000000 |
22 | 22 | ||
23 | #ifndef CONFIG_AUDITSYSCALL | 23 | #ifndef CONFIG_AUDITSYSCALL |
24 | #define sysexit_audit int_ret_from_sys_call | 24 | #define sysexit_audit ia32_ret_from_sys_call |
25 | #define sysretl_audit int_ret_from_sys_call | 25 | #define sysretl_audit ia32_ret_from_sys_call |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #define IA32_NR_syscalls ((ia32_syscall_end - ia32_sys_call_table)/8) | 28 | #define IA32_NR_syscalls ((ia32_syscall_end - ia32_sys_call_table)/8) |
@@ -39,12 +39,12 @@ | |||
39 | .endm | 39 | .endm |
40 | 40 | ||
41 | /* clobbers %eax */ | 41 | /* clobbers %eax */ |
42 | .macro CLEAR_RREGS _r9=rax | 42 | .macro CLEAR_RREGS offset=0, _r9=rax |
43 | xorl %eax,%eax | 43 | xorl %eax,%eax |
44 | movq %rax,R11(%rsp) | 44 | movq %rax,\offset+R11(%rsp) |
45 | movq %rax,R10(%rsp) | 45 | movq %rax,\offset+R10(%rsp) |
46 | movq %\_r9,R9(%rsp) | 46 | movq %\_r9,\offset+R9(%rsp) |
47 | movq %rax,R8(%rsp) | 47 | movq %rax,\offset+R8(%rsp) |
48 | .endm | 48 | .endm |
49 | 49 | ||
50 | /* | 50 | /* |
@@ -172,6 +172,10 @@ sysexit_from_sys_call: | |||
172 | movl RIP-R11(%rsp),%edx /* User %eip */ | 172 | movl RIP-R11(%rsp),%edx /* User %eip */ |
173 | CFI_REGISTER rip,rdx | 173 | CFI_REGISTER rip,rdx |
174 | RESTORE_ARGS 1,24,1,1,1,1 | 174 | RESTORE_ARGS 1,24,1,1,1,1 |
175 | xorq %r8,%r8 | ||
176 | xorq %r9,%r9 | ||
177 | xorq %r10,%r10 | ||
178 | xorq %r11,%r11 | ||
175 | popfq | 179 | popfq |
176 | CFI_ADJUST_CFA_OFFSET -8 | 180 | CFI_ADJUST_CFA_OFFSET -8 |
177 | /*CFI_RESTORE rflags*/ | 181 | /*CFI_RESTORE rflags*/ |
@@ -200,9 +204,9 @@ sysexit_from_sys_call: | |||
200 | movl RDI-ARGOFFSET(%rsp),%r8d /* reload 5th syscall arg */ | 204 | movl RDI-ARGOFFSET(%rsp),%r8d /* reload 5th syscall arg */ |
201 | .endm | 205 | .endm |
202 | 206 | ||
203 | .macro auditsys_exit exit,ebpsave=RBP | 207 | .macro auditsys_exit exit |
204 | testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10) | 208 | testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10) |
205 | jnz int_ret_from_sys_call | 209 | jnz ia32_ret_from_sys_call |
206 | TRACE_IRQS_ON | 210 | TRACE_IRQS_ON |
207 | sti | 211 | sti |
208 | movl %eax,%esi /* second arg, syscall return value */ | 212 | movl %eax,%esi /* second arg, syscall return value */ |
@@ -213,13 +217,13 @@ sysexit_from_sys_call: | |||
213 | call audit_syscall_exit | 217 | call audit_syscall_exit |
214 | GET_THREAD_INFO(%r10) | 218 | GET_THREAD_INFO(%r10) |
215 | movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall return value */ | 219 | movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall return value */ |
216 | movl \ebpsave-ARGOFFSET(%rsp),%ebp /* reload user register value */ | ||
217 | movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi | 220 | movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi |
218 | cli | 221 | cli |
219 | TRACE_IRQS_OFF | 222 | TRACE_IRQS_OFF |
220 | testl %edi,TI_flags(%r10) | 223 | testl %edi,TI_flags(%r10) |
221 | jnz int_with_check | 224 | jz \exit |
222 | jmp \exit | 225 | CLEAR_RREGS -ARGOFFSET |
226 | jmp int_with_check | ||
223 | .endm | 227 | .endm |
224 | 228 | ||
225 | sysenter_auditsys: | 229 | sysenter_auditsys: |
@@ -329,6 +333,9 @@ sysretl_from_sys_call: | |||
329 | CFI_REGISTER rip,rcx | 333 | CFI_REGISTER rip,rcx |
330 | movl EFLAGS-ARGOFFSET(%rsp),%r11d | 334 | movl EFLAGS-ARGOFFSET(%rsp),%r11d |
331 | /*CFI_REGISTER rflags,r11*/ | 335 | /*CFI_REGISTER rflags,r11*/ |
336 | xorq %r10,%r10 | ||
337 | xorq %r9,%r9 | ||
338 | xorq %r8,%r8 | ||
332 | TRACE_IRQS_ON | 339 | TRACE_IRQS_ON |
333 | movl RSP-ARGOFFSET(%rsp),%esp | 340 | movl RSP-ARGOFFSET(%rsp),%esp |
334 | CFI_RESTORE rsp | 341 | CFI_RESTORE rsp |
@@ -343,7 +350,7 @@ cstar_auditsys: | |||
343 | jmp cstar_dispatch | 350 | jmp cstar_dispatch |
344 | 351 | ||
345 | sysretl_audit: | 352 | sysretl_audit: |
346 | auditsys_exit sysretl_from_sys_call, RCX /* user %ebp in RCX slot */ | 353 | auditsys_exit sysretl_from_sys_call |
347 | #endif | 354 | #endif |
348 | 355 | ||
349 | cstar_tracesys: | 356 | cstar_tracesys: |
@@ -353,7 +360,7 @@ cstar_tracesys: | |||
353 | #endif | 360 | #endif |
354 | xchgl %r9d,%ebp | 361 | xchgl %r9d,%ebp |
355 | SAVE_REST | 362 | SAVE_REST |
356 | CLEAR_RREGS r9 | 363 | CLEAR_RREGS 0, r9 |
357 | movq $-ENOSYS,RAX(%rsp) /* ptrace can change this for a bad syscall */ | 364 | movq $-ENOSYS,RAX(%rsp) /* ptrace can change this for a bad syscall */ |
358 | movq %rsp,%rdi /* &pt_regs -> arg1 */ | 365 | movq %rsp,%rdi /* &pt_regs -> arg1 */ |
359 | call syscall_trace_enter | 366 | call syscall_trace_enter |
@@ -425,6 +432,8 @@ ia32_do_call: | |||
425 | call *ia32_sys_call_table(,%rax,8) # xxx: rip relative | 432 | call *ia32_sys_call_table(,%rax,8) # xxx: rip relative |
426 | ia32_sysret: | 433 | ia32_sysret: |
427 | movq %rax,RAX-ARGOFFSET(%rsp) | 434 | movq %rax,RAX-ARGOFFSET(%rsp) |
435 | ia32_ret_from_sys_call: | ||
436 | CLEAR_RREGS -ARGOFFSET | ||
428 | jmp int_ret_from_sys_call | 437 | jmp int_ret_from_sys_call |
429 | 438 | ||
430 | ia32_tracesys: | 439 | ia32_tracesys: |
@@ -442,8 +451,8 @@ END(ia32_syscall) | |||
442 | 451 | ||
443 | ia32_badsys: | 452 | ia32_badsys: |
444 | movq $0,ORIG_RAX-ARGOFFSET(%rsp) | 453 | movq $0,ORIG_RAX-ARGOFFSET(%rsp) |
445 | movq $-ENOSYS,RAX-ARGOFFSET(%rsp) | 454 | movq $-ENOSYS,%rax |
446 | jmp int_ret_from_sys_call | 455 | jmp ia32_sysret |
447 | 456 | ||
448 | quiet_ni_syscall: | 457 | quiet_ni_syscall: |
449 | movq $-ENOSYS,%rax | 458 | movq $-ENOSYS,%rax |