lkml.org 
[lkml]   [2004]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH] Interrupt entry CONFIG_FRAME_POINTER fix
From
 On x86_64, rbp isn't saved on entering interrupt handler even when
CONFIG_FRAME_POINTER is turned on. This breaks profile_pc()
(resulting in oops) which uses regs->rbp to track back to the original
stack. Save full stack when CONFIG_FRAME_POINTER is specified.

--
tejun

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/09/12 16:38:06+09:00 tj@htj.dyndns.org
# On x86_64, rbp isn't saved on entering interrupt handler even when
# CONFIG_FRAME_POINTER is turned on. This breaks profile_pc() which
# uses regs->rbp to track back to the original stack. Save full stack
# when CONFIG_FRAME_POINTER is specified.
#
# arch/x86_64/kernel/entry.S
# 2004/09/12 16:37:55+09:00 tj@htj.dyndns.org +10 -4
# On x86_64, rbp isn't saved on entering interrupt handler even when
# CONFIG_FRAME_POINTER is turned on. This breaks profile_pc() which
# uses regs->rbp to track back to the original stack. Save full stack
# when CONFIG_FRAME_POINTER is specified.
#
diff -Nru a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
--- a/arch/x86_64/kernel/entry.S 2004-09-12 18:05:16 +09:00
+++ b/arch/x86_64/kernel/entry.S 2004-09-12 18:05:16 +09:00
@@ -410,8 +410,8 @@
CFI_REL_OFFSET rsp,(RSP-ORIG_RAX)
CFI_REL_OFFSET rip,(RIP-ORIG_RAX)
cld
-#ifdef CONFIG_DEBUG_INFO
- SAVE_ALL
+#if defined(CONFIG_DEBUG_INFO)
+ SAVE_ALL
movq %rsp,%rdi
/*
* Setup a stack frame pointer. This allows gdb to trace
@@ -419,10 +419,16 @@
*/
movq %rsp,%rbp
CFI_DEF_CFA_REGISTER rbp
-#else
+#elif defined(CONFIG_FRAME_POINTER)
+ /* Save full stack frame such that interrupt handlers can trace
+ * back to the original stack using regs->rbp. Currently,
+ * profile_pc() uses it when CONFIG_SMP is also turned on. */
+ SAVE_ALL
+ movq %rsp,%rdi
+#else
SAVE_ARGS
leaq -ARGOFFSET(%rsp),%rdi # arg1 for handler
-#endif
+#endif
testl $3,CS(%rdi)
je 1f
swapgs
\
 
 \ /
  Last update: 2005-03-22 14:06    [from the cache]
©2003-2011 Jasper Spaans