This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC 11/13] mips64: Initial unwind support


Signed-off-by: Crestez Dan Leonard <cdleonard@gmail.com>
---
 runtime/linux/runtime.h |  2 +-
 runtime/unwind/mips64.h | 80 +++++++++++++++++++++++++++++++++++++++++++++++++
 runtime/unwind/unwind.h |  2 ++
 3 files changed, 83 insertions(+), 1 deletion(-)
 create mode 100644 runtime/unwind/mips64.h

diff --git a/runtime/linux/runtime.h b/runtime/linux/runtime.h
index 66710fc..bd45a80 100644
--- a/runtime/linux/runtime.h
+++ b/runtime/linux/runtime.h
@@ -157,7 +157,7 @@ static struct
    Only define STP_USE_DWARF_UNWINDER when STP_NEED_UNWIND_DATA,
    as set through a pragma:unwind in one of the [u]context-unwind.stp
    functions. */
-#if (defined(__arm__) || defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)) || defined (__s390x__)
+#if (defined(__arm__) || defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)) || defined (__s390x__) || defined(__mips64)
 #ifdef STP_NEED_UNWIND_DATA
 #ifndef STP_USE_DWARF_UNWINDER
 #define STP_USE_DWARF_UNWINDER
diff --git a/runtime/unwind/mips64.h b/runtime/unwind/mips64.h
new file mode 100644
index 0000000..562d12b
--- /dev/null
+++ b/runtime/unwind/mips64.h
@@ -0,0 +1,80 @@
+/* -*- linux-c -*-
+ *
+ * mips64 dwarf unwinder header file
+ *
+ * This file is part of systemtap, and is free software.  You can
+ * redistribute it and/or modify it under the terms of the GNU General
+ * Public License (GPL); either version 2, or (at your option) any
+ * later version.
+ */
+#ifndef _STP_MIPS64_UNWIND_H
+#define _STP_MIPS64_UNWIND_H
+
+#include <linux/sched.h>
+#include <asm/ptrace.h>
+
+#define _stp_get_unaligned(ptr) (*(ptr))
+
+#define UNW_PC(frame)        (frame)->regs.cp0_epc
+#define UNW_SP(frame)        (frame)->regs.regs[29]
+
+#define STACK_LIMIT(ptr)     (((ptr) - 1) & ~(THREAD_SIZE - 1))
+
+#define UNW_REGISTER_INFO \
+	PTREGS_INFO(regs[0]), \
+	PTREGS_INFO(regs[1]), \
+	PTREGS_INFO(regs[2]), \
+	PTREGS_INFO(regs[3]), \
+	PTREGS_INFO(regs[4]), \
+	PTREGS_INFO(regs[5]), \
+	PTREGS_INFO(regs[6]), \
+	PTREGS_INFO(regs[7]), \
+	PTREGS_INFO(regs[8]), \
+	PTREGS_INFO(regs[9]), \
+	PTREGS_INFO(regs[10]), \
+	PTREGS_INFO(regs[11]), \
+	PTREGS_INFO(regs[12]), \
+	PTREGS_INFO(regs[13]), \
+	PTREGS_INFO(regs[14]), \
+	PTREGS_INFO(regs[15]), \
+	PTREGS_INFO(regs[16]), \
+	PTREGS_INFO(regs[17]), \
+	PTREGS_INFO(regs[18]), \
+	PTREGS_INFO(regs[19]), \
+	PTREGS_INFO(regs[20]), \
+	PTREGS_INFO(regs[21]), \
+	PTREGS_INFO(regs[22]), \
+	PTREGS_INFO(regs[23]), \
+	PTREGS_INFO(regs[24]), \
+	PTREGS_INFO(regs[25]), \
+	PTREGS_INFO(regs[26]), \
+	PTREGS_INFO(regs[27]), \
+	PTREGS_INFO(regs[28]), \
+	PTREGS_INFO(regs[29]), \
+	PTREGS_INFO(regs[30]), \
+	PTREGS_INFO(regs[31]), \
+	PTREGS_INFO(cp0_status), \
+	PTREGS_INFO(hi), \
+	PTREGS_INFO(lo), \
+	PTREGS_INFO(cp0_epc)
+
+#define UNW_PC_IDX 35
+#define UNW_SP_IDX 29
+
+#define UNW_NR_REAL_REGS 36
+
+static inline void arch_unw_init_frame_info(struct unwind_frame_info *info,
+                                            /*const*/ struct pt_regs *regs,
+					    int sanitize)
+{
+	if (&info->regs == regs) { /* happens when unwinding kernel->user */
+		info->call_frame = 1;
+		return;
+	}
+
+	memset(info, 0, sizeof(*info));
+	/* XXX handle sanitize??? */
+	info->regs = *regs;
+}
+
+#endif /* _STP_MIPS64_UNWIND_H */
diff --git a/runtime/unwind/unwind.h b/runtime/unwind/unwind.h
index ea3f266..e8f6d7d 100644
--- a/runtime/unwind/unwind.h
+++ b/runtime/unwind/unwind.h
@@ -30,6 +30,8 @@ struct unwind_frame_info
 #include "s390x.h"
 #elif defined (__arm__)
 #include "arm.h"
+#elif defined (__mips64)
+#include "mips64.h"
 #else
 #error "Unsupported dwarf unwind architecture"
 #endif

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]