Commit bcddc015 authored by Jan Beulich's avatar Jan Beulich Committed by Andi Kleen

[PATCH] x86-64: miscellaneous entry.S adjustments

This patch:
- makes ret_from_sys_call no longer global (all external users were
  previously switched to use int_ret_from_sys_call)
- adjusts placement of a CFI_{REMEMBER,RESTORE}_STATE pair to better
  fit logic flow
- eliminates an unnecessary pair of CFI_{REMEMBER,RESTORE}_STATE
- glues together function- and unwinder-wise the previously separate
  system_call and int_ret_from_sys_call function fragments
Signed-off-by: default avatarJan Beulich <jbeulich@novell.com>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
parent da68933e
...@@ -230,7 +230,6 @@ ENTRY(system_call) ...@@ -230,7 +230,6 @@ ENTRY(system_call)
CFI_REL_OFFSET rip,RIP-ARGOFFSET CFI_REL_OFFSET rip,RIP-ARGOFFSET
GET_THREAD_INFO(%rcx) GET_THREAD_INFO(%rcx)
testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%rcx) testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%rcx)
CFI_REMEMBER_STATE
jnz tracesys jnz tracesys
cmpq $__NR_syscall_max,%rax cmpq $__NR_syscall_max,%rax
ja badsys ja badsys
...@@ -241,7 +240,6 @@ ENTRY(system_call) ...@@ -241,7 +240,6 @@ ENTRY(system_call)
* Syscall return path ending with SYSRET (fast path) * Syscall return path ending with SYSRET (fast path)
* Has incomplete stack frame and undefined top of stack. * Has incomplete stack frame and undefined top of stack.
*/ */
.globl ret_from_sys_call
ret_from_sys_call: ret_from_sys_call:
movl $_TIF_ALLWORK_MASK,%edi movl $_TIF_ALLWORK_MASK,%edi
/* edi: flagmask */ /* edi: flagmask */
...@@ -251,8 +249,8 @@ sysret_check: ...@@ -251,8 +249,8 @@ sysret_check:
TRACE_IRQS_OFF TRACE_IRQS_OFF
movl threadinfo_flags(%rcx),%edx movl threadinfo_flags(%rcx),%edx
andl %edi,%edx andl %edi,%edx
CFI_REMEMBER_STATE
jnz sysret_careful jnz sysret_careful
CFI_REMEMBER_STATE
/* /*
* sysretq will re-enable interrupts: * sysretq will re-enable interrupts:
*/ */
...@@ -265,10 +263,10 @@ sysret_check: ...@@ -265,10 +263,10 @@ sysret_check:
swapgs swapgs
sysretq sysretq
CFI_RESTORE_STATE
/* Handle reschedules */ /* Handle reschedules */
/* edx: work, edi: workmask */ /* edx: work, edi: workmask */
sysret_careful: sysret_careful:
CFI_RESTORE_STATE
bt $TIF_NEED_RESCHED,%edx bt $TIF_NEED_RESCHED,%edx
jnc sysret_signal jnc sysret_signal
TRACE_IRQS_ON TRACE_IRQS_ON
...@@ -306,7 +304,6 @@ badsys: ...@@ -306,7 +304,6 @@ badsys:
/* Do syscall tracing */ /* Do syscall tracing */
tracesys: tracesys:
CFI_RESTORE_STATE
SAVE_REST SAVE_REST
movq $-ENOSYS,RAX(%rsp) movq $-ENOSYS,RAX(%rsp)
FIXUP_TOP_OF_STACK %rdi FIXUP_TOP_OF_STACK %rdi
...@@ -322,32 +319,13 @@ tracesys: ...@@ -322,32 +319,13 @@ tracesys:
call *sys_call_table(,%rax,8) call *sys_call_table(,%rax,8)
1: movq %rax,RAX-ARGOFFSET(%rsp) 1: movq %rax,RAX-ARGOFFSET(%rsp)
/* Use IRET because user could have changed frame */ /* Use IRET because user could have changed frame */
jmp int_ret_from_sys_call
CFI_ENDPROC
END(system_call)
/* /*
* Syscall return path ending with IRET. * Syscall return path ending with IRET.
* Has correct top of stack, but partial stack frame. * Has correct top of stack, but partial stack frame.
*/ */
ENTRY(int_ret_from_sys_call) .globl int_ret_from_sys_call
CFI_STARTPROC simple int_ret_from_sys_call:
CFI_SIGNAL_FRAME
CFI_DEF_CFA rsp,SS+8-ARGOFFSET
/*CFI_REL_OFFSET ss,SS-ARGOFFSET*/
CFI_REL_OFFSET rsp,RSP-ARGOFFSET
/*CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/
/*CFI_REL_OFFSET cs,CS-ARGOFFSET*/
CFI_REL_OFFSET rip,RIP-ARGOFFSET
CFI_REL_OFFSET rdx,RDX-ARGOFFSET
CFI_REL_OFFSET rcx,RCX-ARGOFFSET
CFI_REL_OFFSET rax,RAX-ARGOFFSET
CFI_REL_OFFSET rdi,RDI-ARGOFFSET
CFI_REL_OFFSET rsi,RSI-ARGOFFSET
CFI_REL_OFFSET r8,R8-ARGOFFSET
CFI_REL_OFFSET r9,R9-ARGOFFSET
CFI_REL_OFFSET r10,R10-ARGOFFSET
CFI_REL_OFFSET r11,R11-ARGOFFSET
cli cli
TRACE_IRQS_OFF TRACE_IRQS_OFF
testl $3,CS-ARGOFFSET(%rsp) testl $3,CS-ARGOFFSET(%rsp)
...@@ -394,8 +372,6 @@ int_very_careful: ...@@ -394,8 +372,6 @@ int_very_careful:
popq %rdi popq %rdi
CFI_ADJUST_CFA_OFFSET -8 CFI_ADJUST_CFA_OFFSET -8
andl $~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edi andl $~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edi
cli
TRACE_IRQS_OFF
jmp int_restore_rest jmp int_restore_rest
int_signal: int_signal:
...@@ -411,7 +387,7 @@ int_restore_rest: ...@@ -411,7 +387,7 @@ int_restore_rest:
TRACE_IRQS_OFF TRACE_IRQS_OFF
jmp int_with_check jmp int_with_check
CFI_ENDPROC CFI_ENDPROC
END(int_ret_from_sys_call) END(system_call)
/* /*
* Certain special system calls that need to save a complete full stack frame. * Certain special system calls that need to save a complete full stack frame.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment