diff options
author | Jan Beulich <JBeulich@suse.com> | 2011-09-28 11:57:52 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-09-28 13:04:52 -0400 |
commit | eab9e6137f237681a04649e786cc4d942bedd6d1 (patch) | |
tree | 8ab92f349f7bc33a9b0f1e93cd81ac0609157389 | |
parent | e05139f2569ecf699b229a6473a86cdffed62956 (diff) |
x86-64: Fix CFI data for interrupt frames
The patch titled "x86: Don't use frame pointer to save old stack
on irq entry" did not properly adjust CFI directives, so this
patch is a follow-up to that one.
With the old stack pointer no longer stored in a callee-saved
register (plus some offset), we now have to use a CFA expression
to describe the memory location where it is being found. This
requires the use of .cfi_escape (allowing arbitrary byte streams
to be emitted into .eh_frame), as there is no
.cfi_def_cfa_expression (which also cannot reasonably be
expected, as it would require a full expression parser).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/4E8360200200007800058467@nat28.tlf.novell.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/include/asm/dwarf2.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/entry_64.S | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/arch/x86/include/asm/dwarf2.h b/arch/x86/include/asm/dwarf2.h index 326099199318..f6f15986df6c 100644 --- a/arch/x86/include/asm/dwarf2.h +++ b/arch/x86/include/asm/dwarf2.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #define CFI_REMEMBER_STATE .cfi_remember_state | 27 | #define CFI_REMEMBER_STATE .cfi_remember_state |
28 | #define CFI_RESTORE_STATE .cfi_restore_state | 28 | #define CFI_RESTORE_STATE .cfi_restore_state |
29 | #define CFI_UNDEFINED .cfi_undefined | 29 | #define CFI_UNDEFINED .cfi_undefined |
30 | #define CFI_ESCAPE .cfi_escape | ||
30 | 31 | ||
31 | #ifdef CONFIG_AS_CFI_SIGNAL_FRAME | 32 | #ifdef CONFIG_AS_CFI_SIGNAL_FRAME |
32 | #define CFI_SIGNAL_FRAME .cfi_signal_frame | 33 | #define CFI_SIGNAL_FRAME .cfi_signal_frame |
@@ -68,6 +69,7 @@ | |||
68 | #define CFI_REMEMBER_STATE cfi_ignore | 69 | #define CFI_REMEMBER_STATE cfi_ignore |
69 | #define CFI_RESTORE_STATE cfi_ignore | 70 | #define CFI_RESTORE_STATE cfi_ignore |
70 | #define CFI_UNDEFINED cfi_ignore | 71 | #define CFI_UNDEFINED cfi_ignore |
72 | #define CFI_ESCAPE cfi_ignore | ||
71 | #define CFI_SIGNAL_FRAME cfi_ignore | 73 | #define CFI_SIGNAL_FRAME cfi_ignore |
72 | 74 | ||
73 | #endif | 75 | #endif |
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index 6419bb05ecd5..faf8d5e74b0b 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -331,10 +331,15 @@ ENDPROC(native_usergs_sysret64) | |||
331 | 1: incl PER_CPU_VAR(irq_count) | 331 | 1: incl PER_CPU_VAR(irq_count) |
332 | jne 2f | 332 | jne 2f |
333 | mov PER_CPU_VAR(irq_stack_ptr),%rsp | 333 | mov PER_CPU_VAR(irq_stack_ptr),%rsp |
334 | EMPTY_FRAME 0 | 334 | CFI_DEF_CFA_REGISTER rsi |
335 | 335 | ||
336 | 2: /* Store previous stack value */ | 336 | 2: /* Store previous stack value */ |
337 | pushq %rsi | 337 | pushq %rsi |
338 | CFI_ESCAPE 0x0f /* DW_CFA_def_cfa_expression */, 6, \ | ||
339 | 0x77 /* DW_OP_breg7 */, 0, \ | ||
340 | 0x06 /* DW_OP_deref */, \ | ||
341 | 0x08 /* DW_OP_const1u */, SS+8-RBP, \ | ||
342 | 0x22 /* DW_OP_plus */ | ||
338 | /* We entered an interrupt context - irqs are off: */ | 343 | /* We entered an interrupt context - irqs are off: */ |
339 | TRACE_IRQS_OFF | 344 | TRACE_IRQS_OFF |
340 | .endm | 345 | .endm |
@@ -788,7 +793,6 @@ END(interrupt) | |||
788 | subq $ORIG_RAX-RBP, %rsp | 793 | subq $ORIG_RAX-RBP, %rsp |
789 | CFI_ADJUST_CFA_OFFSET ORIG_RAX-RBP | 794 | CFI_ADJUST_CFA_OFFSET ORIG_RAX-RBP |
790 | SAVE_ARGS_IRQ | 795 | SAVE_ARGS_IRQ |
791 | PARTIAL_FRAME 0 | ||
792 | call \func | 796 | call \func |
793 | .endm | 797 | .endm |
794 | 798 | ||
@@ -813,10 +817,10 @@ ret_from_intr: | |||
813 | 817 | ||
814 | /* Restore saved previous stack */ | 818 | /* Restore saved previous stack */ |
815 | popq %rsi | 819 | popq %rsi |
816 | leaq 16(%rsi), %rsp | 820 | CFI_DEF_CFA_REGISTER rsi |
817 | 821 | leaq ARGOFFSET-RBP(%rsi), %rsp | |
818 | CFI_DEF_CFA_REGISTER rsp | 822 | CFI_DEF_CFA_REGISTER rsp |
819 | CFI_ADJUST_CFA_OFFSET -16 | 823 | CFI_ADJUST_CFA_OFFSET RBP-ARGOFFSET |
820 | 824 | ||
821 | exit_intr: | 825 | exit_intr: |
822 | GET_THREAD_INFO(%rcx) | 826 | GET_THREAD_INFO(%rcx) |