summaryrefslogtreecommitdiffstats
path: root/runtime/unwind/x86_64.h
diff options
context:
space:
mode:
authorMartin Hunt <hunt@redhat.com>2008-04-09 17:02:40 -0400
committerMartin Hunt <hunt@redhat.com>2008-04-09 17:02:40 -0400
commitb53c1feef55dc74501a90257e4beff6c1a9cf03b (patch)
treec7434cf54ae9cc8d7cb898f030f419737fb13a6c /runtime/unwind/x86_64.h
parent404bf86f4c825eafe4ad9f34f676c0e37464cfe7 (diff)
downloadsystemtap-steved-b53c1feef55dc74501a90257e4beff6c1a9cf03b.tar.gz
systemtap-steved-b53c1feef55dc74501a90257e4beff6c1a9cf03b.tar.xz
systemtap-steved-b53c1feef55dc74501a90257e4beff6c1a9cf03b.zip
Fixes for 2.6.25 pt_regs changes.
Diffstat (limited to 'runtime/unwind/x86_64.h')
-rw-r--r--runtime/unwind/x86_64.h43
1 files changed, 41 insertions, 2 deletions
diff --git a/runtime/unwind/x86_64.h b/runtime/unwind/x86_64.h
index 48838490..5eb3a58f 100644
--- a/runtime/unwind/x86_64.h
+++ b/runtime/unwind/x86_64.h
@@ -33,8 +33,13 @@ struct unwind_frame_info
unsigned call_frame:1;
};
+#ifdef STAPCONF_X86_UNIREGS
+#define UNW_PC(frame) (frame)->regs.ip
+#define UNW_SP(frame) (frame)->regs.sp
+#else
#define UNW_PC(frame) (frame)->regs.rip
#define UNW_SP(frame) (frame)->regs.rsp
+#endif /* STAPCONF_X86_UNIREGS */
#if 0 /* STP_USE_FRAME_POINTER */
/* Frame pointers not implemented in x86_64 currently */
@@ -54,6 +59,26 @@ struct unwind_frame_info
not desirable. */
#define STACK_LIMIT(ptr) (((ptr) - 1) & ~(THREAD_SIZE - 1))
+#ifdef STAPCONF_X86_UNIREGS
+#define UNW_REGISTER_INFO \
+ PTREGS_INFO(ax), \
+ PTREGS_INFO(dx), \
+ PTREGS_INFO(cx), \
+ PTREGS_INFO(bx), \
+ PTREGS_INFO(si), \
+ PTREGS_INFO(di), \
+ PTREGS_INFO(bp), \
+ PTREGS_INFO(sp), \
+ PTREGS_INFO(r8), \
+ PTREGS_INFO(r9), \
+ PTREGS_INFO(r10), \
+ PTREGS_INFO(r11), \
+ PTREGS_INFO(r12), \
+ PTREGS_INFO(r13), \
+ PTREGS_INFO(r14), \
+ PTREGS_INFO(r15), \
+ PTREGS_INFO(ip)
+#else
#define UNW_REGISTER_INFO \
PTREGS_INFO(rax), \
PTREGS_INFO(rdx), \
@@ -72,6 +97,7 @@ struct unwind_frame_info
PTREGS_INFO(r14), \
PTREGS_INFO(r15), \
PTREGS_INFO(rip)
+#endif /* STAPCONF_X86_UNIREGS */
#define UNW_DEFAULT_RA(raItem, dataAlign) \
((raItem).where == Memory && \
@@ -89,11 +115,18 @@ static inline void arch_unw_init_blocked(struct unwind_frame_info *info)
extern const char thread_return[];
memset(&info->regs, 0, sizeof(info->regs));
- info->regs.rip = (unsigned long)thread_return;
info->regs.cs = __KERNEL_CS;
+ info->regs.ss = __KERNEL_DS;
+
+#ifdef STAPCONF_X86_UNIREGS
+ info->regs.ip = (unsigned long)thread_return;
+ __get_user(info->regs.bp, (unsigned long *)info->task->thread.sp);
+ info->regs.sp = info->task->thread.sp;
+#else
+ info->regs.rip = (unsigned long)thread_return;
__get_user(info->regs.rbp, (unsigned long *)info->task->thread.rsp);
info->regs.rsp = info->task->thread.rsp;
- info->regs.ss = __KERNEL_DS;
+#endif
}
static inline int arch_unw_user_mode(const struct unwind_frame_info *info)
@@ -102,10 +135,16 @@ static inline int arch_unw_user_mode(const struct unwind_frame_info *info)
are properly annotated (and tracked in UNW_REGISTER_INFO). */
return user_mode(&info->regs);
#else
+#ifdef STAPCONF_X86_UNIREGS
+ return (long)info->regs.ip >= 0
+ || (info->regs.ip >= VSYSCALL_START && info->regs.ip < VSYSCALL_END)
+ || (long)info->regs.sp >= 0;
+#else
return (long)info->regs.rip >= 0
|| (info->regs.rip >= VSYSCALL_START && info->regs.rip < VSYSCALL_END)
|| (long)info->regs.rsp >= 0;
#endif
+#endif
}
#endif /* _STP_X86_64_UNWIND_H */