Skip to contentSkip to conversation

x86-64: add unwind annotations to early_idt_handler

PATCH In review Jan Beulich 2 participants 3 messages Mar 12, 2009 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86-64: add unwind annotations to early_idt_handler

---
 arch/x86/kernel/head_64.S |   13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/x86/kernel/head_64.S +13 -0
@@ -280,6 +280,8 @@ early_idt_handlers:
 
 ENTRY(early_idt_handler)
 #ifdef CONFIG_EARLY_PRINTK
+#include <asm/calling.h>
+#include <asm/dwarf2.h>
 	cmpl $2,early_recursion_flag(%rip)
 	jz  1f
 	incl early_recursion_flag(%rip)
@@ -295,6 +297,16 @@ ENTRY(early_idt_handler)
 	testl $0x27d00,%eax
 	je 0f
 	popq %r8		# get error code
+
+	CFI_STARTPROC	simple
+	CFI_SIGNAL_FRAME
+	CFI_DEF_CFA	rsp, SS+8-RIP
+#	CFI_REL_OFFSET	ss, SS-RIP
+	CFI_REL_OFFSET	rsp, RSP-RIP
+#	CFI_REL_OFFSET	rflags, EFLAGS-RIP
+#	CFI_REL_OFFSET	cs, CS-RIP
+	CFI_REL_OFFSET	rip, RIP-RIP
+
 0:	movq 0(%rsp),%rcx	# get ip
 	movq 8(%rsp),%rdx	# get cs
 	xorl %eax,%eax
@@ -308,6 +320,7 @@ ENTRY(early_idt_handler)
 	movq 0(%rsp),%rsi	# get rip again
 	call __print_symbol
 #endif
+	CFI_ENDPROC
 #endif /* EARLY_PRINTK */
 1:	hlt
 	jmp 1b
#1 lore raw
Quoted 22 lines · Jan Beulich
---
 arch/x86/kernel/head_64.S |   13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/x86/kernel/head_64.S +2 -0
@@ -280,6 +280,8 @@ early_idt_handlers:
 
 ENTRY(early_idt_handler)
 #ifdef CONFIG_EARLY_PRINTK
+#include <asm/calling.h>
+#include <asm/dwarf2.h>
 	cmpl $2,early_recursion_flag(%rip)
 	jz  1f
 	incl early_recursion_flag(%rip)
@@ -295,6 +297,16 @@ ENTRY(early_idt_handler)
 	testl $0x27d00,%eax
 	je 0f
 	popq %r8		# get error code

arch/x86/kernel/head_64.S ENTRY(early_idt_handler) · line 309

Quoted 10 lines
arch/x86/kernel/head_64.S +10 -0
+
+	CFI_STARTPROC	simple
+	CFI_SIGNAL_FRAME
+	CFI_DEF_CFA	rsp, SS+8-RIP
+#	CFI_REL_OFFSET	ss, SS-RIP
+	CFI_REL_OFFSET	rsp, RSP-RIP
+#	CFI_REL_OFFSET	rflags, EFLAGS-RIP
+#	CFI_REL_OFFSET	cs, CS-RIP
+	CFI_REL_OFFSET	rip, RIP-RIP
+

This too is too ugly - there should be a structured macro that expresses this - instead of open-coded CFI details. This is a regular x86 entry layout with a lot of commonalities with other entry points.

Ingo

#2 lore raw
Quoted 13 lines
Quoted 1 line
Quoted 1 line

Ingo Molnar <[email protected]> 12.03.09 11:53 >>>

Quoted 11 lines · Jan Beulich
arch/x86/kernel/head_64.S +7 -0
@@ -295,6 +297,16 @@ ENTRY(early_idt_handler)
 	testl $0x27d00,%eax
 	je 0f
 	popq %r8		# get error code
+
+	CFI_STARTPROC	simple
+	CFI_SIGNAL_FRAME
+	CFI_DEF_CFA	rsp, SS+8-RIP
+#	CFI_REL_OFFSET	ss, SS-RIP
+	CFI_REL_OFFSET	rsp, RSP-RIP
+#	CFI_REL_OFFSET	rflags, EFLAGS-RIP
Quoted 8 lines

arch/x86/kernel/head_64.S ENTRY(early_idt_handler) · line 309

Quoted 3 lines
arch/x86/kernel/head_64.S +3 -0
+#	CFI_REL_OFFSET	cs, CS-RIP
+	CFI_REL_OFFSET	rip, RIP-RIP
+

This too is too ugly - there should be a structured macro that expresses this - instead of open-coded CFI details. This is a regular x86 entry layout with a lot of commonalities with other entry points.

I can certainly do that, but it'll introduce yet another patch dependency (with the patch fixing the entry_64.S annotations), as it would mean moving out some of the macros from entry_64.S to one of the headers. That means I'll first have to get clarification on where you want to go with these annotations altogether.

Jan