[PATCH 3/6] reliable stack trace support (x86-64 IRQ stackadjustment)

From: Jan Beulich
Date: Mon May 22 2006 - 09:16:08 EST


Change the switching to/from the IRQ stack so that unwind annotations can
be added for it without requiring CFA expressions.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: unwind-2.6.17-rc4/arch/x86_64/kernel/entry.S
===================================================================
--- unwind-2.6.17-rc4.orig/arch/x86_64/kernel/entry.S 2006-05-22 15:01:04.000000000 +0200
+++ unwind-2.6.17-rc4/arch/x86_64/kernel/entry.S 2006-05-22 15:01:07.000000000 +0200
@@ -483,16 +483,21 @@ ENTRY(stub_rt_sigreturn)
#else
SAVE_ARGS
leaq -ARGOFFSET(%rsp),%rdi # arg1 for handler
-#endif
+#ifdef CONFIG_UNWIND_INFO
+ pushq %rbp
+ CFI_ADJUST_CFA_OFFSET 8
+ CFI_REL_OFFSET rbp, 0
+ movq %rsp,%rbp
+ CFI_DEF_CFA_REGISTER rbp
+#endif
+#endif
testl $3,CS(%rdi)
je 1f
swapgs
1: incl %gs:pda_irqcount # RED-PEN should check preempt count
- movq %gs:pda_irqstackptr,%rax
- cmoveq %rax,%rsp /*todo This needs CFI annotation! */
+ cmoveq %gs:pda_irqstackptr,%rsp
+#if !defined(CONFIG_DEBUG_INFO) && !defined(CONFIG_UNWIND_INFO)
pushq %rdi # save old stack
-#ifndef CONFIG_DEBUG_INFO
- CFI_ADJUST_CFA_OFFSET 8
#endif
call \func
.endm
@@ -502,17 +507,24 @@ ENTRY(common_interrupt)
interrupt do_IRQ
/* 0(%rsp): oldrsp-ARGOFFSET */
ret_from_intr:
+#if !defined(CONFIG_DEBUG_INFO) && !defined(CONFIG_UNWIND_INFO)
popq %rdi
-#ifndef CONFIG_DEBUG_INFO
- CFI_ADJUST_CFA_OFFSET -8
#endif
cli
decl %gs:pda_irqcount
#ifdef CONFIG_DEBUG_INFO
- movq RBP(%rdi),%rbp
+ movq %rbp, %rsp
CFI_DEF_CFA_REGISTER rsp
+ movq RBP(%rsp),%rbp
+ addq $ARG_OFFSET, %rsp
+ CFI_ADJUST_CFA_OFFSET -ARG_OFFSET
+#elif defined(CONFIG_UNWIND_INFO)
+ leaveq
+ CFI_DEF_CFA_REGISTER rsp
+ CFI_ADJUST_CFA_OFFSET -8
+#else
+ leaq ARGOFFSET(%rdi),%rsp
#endif
- leaq ARGOFFSET(%rdi),%rsp /*todo This needs CFI annotation! */
exit_intr:
GET_THREAD_INFO(%rcx)
testl $3,CS-ARGOFFSET(%rsp)


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/