summaryrefslogtreecommitdiff
path: root/arch/arm/oprofile
diff options
context:
space:
mode:
authorOleg Strikov <ostrikov@nvidia.com>2011-02-28 22:19:48 +0300
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 12:09:12 -0700
commit0a569972e6ff100ec15be6e6f020f6cee76b62c9 (patch)
tree8cf9355b179cd4de71a3efd20cc080a672e8129a /arch/arm/oprofile
parent0c20de25b84638d0e1713251e5bd21fe49a3d0ff (diff)
arm: oprofile: backtracing support for Android
The stack frame for Android is slightly different than that used for vanilla Linux. Bug 935536 Signed-off-by: Ryan V. Bissell <rbissell@nvidia.com> Reviewed-on: http://git-master/r/82600 (cherry picked from commit bb6d1e211bdb41c129ee17489814327d7d8d2fb8) Change-Id: Ie0e924d45398c7def58e3722035911d905614b6f Reviewed-on: http://git-master/r/89507 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Oleg Strikov <ostrikov@nvidia.com> Reviewed-by: Janne Hellsten <jhellsten@nvidia.com> Tested-by: Ryan Bissell <rbissell@nvidia.com> Rebase-Id: Rce070449baa974dc64a07c692afe5a33b116c4d6
Diffstat (limited to 'arch/arm/oprofile')
-rw-r--r--arch/arm/oprofile/common.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c
index 99c63d4b6af8..7c6fcd3e5e61 100644
--- a/arch/arm/oprofile/common.c
+++ b/arch/arm/oprofile/common.c
@@ -69,6 +69,13 @@ static int report_trace(struct stackframe *frame, void *d)
return *depth == 0;
}
+#ifdef CONFIG_ANDROID
+/* Android has a different stack frame than Linux */
+struct frame_tail {
+ unsigned long fp;
+ unsigned long lr;
+} __attribute__((packed));
+#else
/*
* The registers we're interested in are at the end of the variable
* length saved register structure. The fp points at the end of this
@@ -80,6 +87,7 @@ struct frame_tail {
unsigned long sp;
unsigned long lr;
} __attribute__((packed));
+#endif
static struct frame_tail* user_backtrace(struct frame_tail *tail)
{
@@ -95,15 +103,29 @@ static struct frame_tail* user_backtrace(struct frame_tail *tail)
/* frame pointers should strictly progress back up the stack
* (towards higher addresses) */
+#ifdef CONFIG_ANDROID
+ if (tail >= (struct frame_tail *) buftail[0].fp)
+#else
if (tail + 1 >= buftail[0].fp)
+#endif
return NULL;
+#ifdef CONFIG_ANDROID
+ /* Android has a different stack frame than Linux */
+ return (struct frame_tail *) (buftail[0].fp - sizeof(unsigned long));
+#else
return buftail[0].fp-1;
+#endif
}
static void arm_backtrace(struct pt_regs * const regs, unsigned int depth)
{
+#ifdef CONFIG_ANDROID
+ struct frame_tail *tail = (struct frame_tail *)
+ (regs->ARM_fp - sizeof(unsigned long));
+#else
struct frame_tail *tail = ((struct frame_tail *) regs->ARM_fp) - 1;
+#endif
if (!user_mode(regs)) {
struct stackframe frame;