summaryrefslogtreecommitdiff
path: root/arch/arm/oprofile
diff options
context:
space:
mode:
authorOleg Strikov <ostrikov@nvidia.com>2011-02-28 22:19:48 +0300
committerRohan Somvanshi <rsomvanshi@nvidia.com>2012-04-25 07:05:08 -0700
commit6b9bd6f6e4315a4413359a479d6bc3c0236600d4 (patch)
tree90b89b2a9f82bf5a9bdd769144cb2772b61acac2 /arch/arm/oprofile
parent7704ad9bb06b97de75437700dc08549c99d16f0c (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>
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 4e0a371630b3..485e58bf7f49 100644
--- a/arch/arm/oprofile/common.c
+++ b/arch/arm/oprofile/common.c
@@ -58,6 +58,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
@@ -69,6 +76,7 @@ struct frame_tail {
unsigned long sp;
unsigned long lr;
} __attribute__((packed));
+#endif
static struct frame_tail* user_backtrace(struct frame_tail *tail)
{
@@ -84,15 +92,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;