Commit df5d1874 authored by Jan Beulich's avatar Jan Beulich Committed by Ingo Molnar

x86: Use {push,pop}{l,q}_cfi in more places

... plus additionally introduce {push,pop}f{l,q}_cfi. All in the
hope that the code becomes better readable this way (it gets
quite a bit smaller in any case).
Signed-off-by: default avatarJan Beulich <jbeulich@novell.com>
Acked-by: default avatarAlexander van Heukelum <heukelum@fastmail.fm>
LKML-Reference: <4C7FBDA40200007800013FAF@vpn.id2.novell.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent a34107b5
...@@ -89,6 +89,16 @@ ...@@ -89,6 +89,16 @@
CFI_ADJUST_CFA_OFFSET -8 CFI_ADJUST_CFA_OFFSET -8
.endm .endm
.macro pushfq_cfi
pushfq
CFI_ADJUST_CFA_OFFSET 8
.endm
.macro popfq_cfi
popfq
CFI_ADJUST_CFA_OFFSET -8
.endm
.macro movq_cfi reg offset=0 .macro movq_cfi reg offset=0
movq %\reg, \offset(%rsp) movq %\reg, \offset(%rsp)
CFI_REL_OFFSET \reg, \offset CFI_REL_OFFSET \reg, \offset
...@@ -109,6 +119,16 @@ ...@@ -109,6 +119,16 @@
CFI_ADJUST_CFA_OFFSET -4 CFI_ADJUST_CFA_OFFSET -4
.endm .endm
.macro pushfl_cfi
pushfl
CFI_ADJUST_CFA_OFFSET 4
.endm
.macro popfl_cfi
popfl
CFI_ADJUST_CFA_OFFSET -4
.endm
.macro movl_cfi reg offset=0 .macro movl_cfi reg offset=0
movl %\reg, \offset(%esp) movl %\reg, \offset(%esp)
CFI_REL_OFFSET \reg, \offset CFI_REL_OFFSET \reg, \offset
......
This diff is collapsed.
...@@ -213,23 +213,17 @@ ENDPROC(native_usergs_sysret64) ...@@ -213,23 +213,17 @@ ENDPROC(native_usergs_sysret64)
.macro FAKE_STACK_FRAME child_rip .macro FAKE_STACK_FRAME child_rip
/* push in order ss, rsp, eflags, cs, rip */ /* push in order ss, rsp, eflags, cs, rip */
xorl %eax, %eax xorl %eax, %eax
pushq $__KERNEL_DS /* ss */ pushq_cfi $__KERNEL_DS /* ss */
CFI_ADJUST_CFA_OFFSET 8
/*CFI_REL_OFFSET ss,0*/ /*CFI_REL_OFFSET ss,0*/
pushq %rax /* rsp */ pushq_cfi %rax /* rsp */
CFI_ADJUST_CFA_OFFSET 8
CFI_REL_OFFSET rsp,0 CFI_REL_OFFSET rsp,0
pushq $X86_EFLAGS_IF /* eflags - interrupts on */ pushq_cfi $X86_EFLAGS_IF /* eflags - interrupts on */
CFI_ADJUST_CFA_OFFSET 8
/*CFI_REL_OFFSET rflags,0*/ /*CFI_REL_OFFSET rflags,0*/
pushq $__KERNEL_CS /* cs */ pushq_cfi $__KERNEL_CS /* cs */
CFI_ADJUST_CFA_OFFSET 8
/*CFI_REL_OFFSET cs,0*/ /*CFI_REL_OFFSET cs,0*/
pushq \child_rip /* rip */ pushq_cfi \child_rip /* rip */
CFI_ADJUST_CFA_OFFSET 8
CFI_REL_OFFSET rip,0 CFI_REL_OFFSET rip,0
pushq %rax /* orig rax */ pushq_cfi %rax /* orig rax */
CFI_ADJUST_CFA_OFFSET 8
.endm .endm
.macro UNFAKE_STACK_FRAME .macro UNFAKE_STACK_FRAME
...@@ -398,10 +392,8 @@ ENTRY(ret_from_fork) ...@@ -398,10 +392,8 @@ ENTRY(ret_from_fork)
LOCK ; btr $TIF_FORK,TI_flags(%r8) LOCK ; btr $TIF_FORK,TI_flags(%r8)
push kernel_eflags(%rip) pushq_cfi kernel_eflags(%rip)
CFI_ADJUST_CFA_OFFSET 8 popfq_cfi # reset kernel eflags
popf # reset kernel eflags
CFI_ADJUST_CFA_OFFSET -8
call schedule_tail # rdi: 'prev' task parameter call schedule_tail # rdi: 'prev' task parameter
...@@ -521,11 +513,9 @@ sysret_careful: ...@@ -521,11 +513,9 @@ sysret_careful:
jnc sysret_signal jnc sysret_signal
TRACE_IRQS_ON TRACE_IRQS_ON
ENABLE_INTERRUPTS(CLBR_NONE) ENABLE_INTERRUPTS(CLBR_NONE)
pushq %rdi pushq_cfi %rdi
CFI_ADJUST_CFA_OFFSET 8
call schedule call schedule
popq %rdi popq_cfi %rdi
CFI_ADJUST_CFA_OFFSET -8
jmp sysret_check jmp sysret_check
/* Handle a signal */ /* Handle a signal */
...@@ -634,11 +624,9 @@ int_careful: ...@@ -634,11 +624,9 @@ int_careful:
jnc int_very_careful jnc int_very_careful
TRACE_IRQS_ON TRACE_IRQS_ON
ENABLE_INTERRUPTS(CLBR_NONE) ENABLE_INTERRUPTS(CLBR_NONE)
pushq %rdi pushq_cfi %rdi
CFI_ADJUST_CFA_OFFSET 8
call schedule call schedule
popq %rdi popq_cfi %rdi
CFI_ADJUST_CFA_OFFSET -8
DISABLE_INTERRUPTS(CLBR_NONE) DISABLE_INTERRUPTS(CLBR_NONE)
TRACE_IRQS_OFF TRACE_IRQS_OFF
jmp int_with_check jmp int_with_check
...@@ -652,12 +640,10 @@ int_check_syscall_exit_work: ...@@ -652,12 +640,10 @@ int_check_syscall_exit_work:
/* Check for syscall exit trace */ /* Check for syscall exit trace */
testl $_TIF_WORK_SYSCALL_EXIT,%edx testl $_TIF_WORK_SYSCALL_EXIT,%edx
jz int_signal jz int_signal
pushq %rdi pushq_cfi %rdi
CFI_ADJUST_CFA_OFFSET 8
leaq 8(%rsp),%rdi # &ptregs -> arg1 leaq 8(%rsp),%rdi # &ptregs -> arg1
call syscall_trace_leave call syscall_trace_leave
popq %rdi popq_cfi %rdi
CFI_ADJUST_CFA_OFFSET -8
andl $~(_TIF_WORK_SYSCALL_EXIT|_TIF_SYSCALL_EMU),%edi andl $~(_TIF_WORK_SYSCALL_EXIT|_TIF_SYSCALL_EMU),%edi
jmp int_restore_rest jmp int_restore_rest
...@@ -765,8 +751,7 @@ vector=FIRST_EXTERNAL_VECTOR ...@@ -765,8 +751,7 @@ vector=FIRST_EXTERNAL_VECTOR
.if vector <> FIRST_EXTERNAL_VECTOR .if vector <> FIRST_EXTERNAL_VECTOR
CFI_ADJUST_CFA_OFFSET -8 CFI_ADJUST_CFA_OFFSET -8
.endif .endif
1: pushq $(~vector+0x80) /* Note: always in signed byte range */ 1: pushq_cfi $(~vector+0x80) /* Note: always in signed byte range */
CFI_ADJUST_CFA_OFFSET 8
.if ((vector-FIRST_EXTERNAL_VECTOR)%7) <> 6 .if ((vector-FIRST_EXTERNAL_VECTOR)%7) <> 6
jmp 2f jmp 2f
.endif .endif
...@@ -821,6 +806,7 @@ ret_from_intr: ...@@ -821,6 +806,7 @@ ret_from_intr:
TRACE_IRQS_OFF TRACE_IRQS_OFF
decl PER_CPU_VAR(irq_count) decl PER_CPU_VAR(irq_count)
leaveq leaveq
CFI_RESTORE rbp
CFI_DEF_CFA_REGISTER rsp CFI_DEF_CFA_REGISTER rsp
CFI_ADJUST_CFA_OFFSET -8 CFI_ADJUST_CFA_OFFSET -8
exit_intr: exit_intr:
...@@ -902,11 +888,9 @@ retint_careful: ...@@ -902,11 +888,9 @@ retint_careful:
jnc retint_signal jnc retint_signal
TRACE_IRQS_ON TRACE_IRQS_ON
ENABLE_INTERRUPTS(CLBR_NONE) ENABLE_INTERRUPTS(CLBR_NONE)
pushq %rdi pushq_cfi %rdi
CFI_ADJUST_CFA_OFFSET 8
call schedule call schedule
popq %rdi popq_cfi %rdi
CFI_ADJUST_CFA_OFFSET -8
GET_THREAD_INFO(%rcx) GET_THREAD_INFO(%rcx)
DISABLE_INTERRUPTS(CLBR_NONE) DISABLE_INTERRUPTS(CLBR_NONE)
TRACE_IRQS_OFF TRACE_IRQS_OFF
...@@ -955,8 +939,7 @@ END(common_interrupt) ...@@ -955,8 +939,7 @@ END(common_interrupt)
.macro apicinterrupt num sym do_sym .macro apicinterrupt num sym do_sym
ENTRY(\sym) ENTRY(\sym)
INTR_FRAME INTR_FRAME
pushq $~(\num) pushq_cfi $~(\num)
CFI_ADJUST_CFA_OFFSET 8
interrupt \do_sym interrupt \do_sym
jmp ret_from_intr jmp ret_from_intr
CFI_ENDPROC CFI_ENDPROC
...@@ -1138,16 +1121,14 @@ zeroentry simd_coprocessor_error do_simd_coprocessor_error ...@@ -1138,16 +1121,14 @@ zeroentry simd_coprocessor_error do_simd_coprocessor_error
/* edi: new selector */ /* edi: new selector */
ENTRY(native_load_gs_index) ENTRY(native_load_gs_index)
CFI_STARTPROC CFI_STARTPROC
pushf pushfq_cfi
CFI_ADJUST_CFA_OFFSET 8
DISABLE_INTERRUPTS(CLBR_ANY & ~CLBR_RDI) DISABLE_INTERRUPTS(CLBR_ANY & ~CLBR_RDI)
SWAPGS SWAPGS
gs_change: gs_change:
movl %edi,%gs movl %edi,%gs
2: mfence /* workaround */ 2: mfence /* workaround */
SWAPGS SWAPGS
popf popfq_cfi
CFI_ADJUST_CFA_OFFSET -8
ret ret
CFI_ENDPROC CFI_ENDPROC
END(native_load_gs_index) END(native_load_gs_index)
...@@ -1214,8 +1195,7 @@ END(kernel_execve) ...@@ -1214,8 +1195,7 @@ END(kernel_execve)
/* Call softirq on interrupt stack. Interrupts are off. */ /* Call softirq on interrupt stack. Interrupts are off. */
ENTRY(call_softirq) ENTRY(call_softirq)
CFI_STARTPROC CFI_STARTPROC
push %rbp pushq_cfi %rbp
CFI_ADJUST_CFA_OFFSET 8
CFI_REL_OFFSET rbp,0 CFI_REL_OFFSET rbp,0
mov %rsp,%rbp mov %rsp,%rbp
CFI_DEF_CFA_REGISTER rbp CFI_DEF_CFA_REGISTER rbp
...@@ -1224,6 +1204,7 @@ ENTRY(call_softirq) ...@@ -1224,6 +1204,7 @@ ENTRY(call_softirq)
push %rbp # backlink for old unwinder push %rbp # backlink for old unwinder
call __do_softirq call __do_softirq
leaveq leaveq
CFI_RESTORE rbp
CFI_DEF_CFA_REGISTER rsp CFI_DEF_CFA_REGISTER rsp
CFI_ADJUST_CFA_OFFSET -8 CFI_ADJUST_CFA_OFFSET -8
decl PER_CPU_VAR(irq_count) decl PER_CPU_VAR(irq_count)
......
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