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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>

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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux