misc: tegra-profiler: backtracing for Thumb code
Igor Nabirushkin [Sun, 13 Oct 2013 17:45:06 +0000 (21:45 +0400)]
Tegra Profiler: add backtracing for Thumb code

Bug 1387645

Change-Id: I748d00b673ce7949ac8c3323d6d7f2672d210c03
Signed-off-by: Igor Nabirushkin <inabirushkin@nvidia.com>
Reviewed-on: http://git-master/r/298737
Reviewed-by: Daniel Horowitz <dhorowitz@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Maxim Morin <mmorin@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

drivers/misc/tegra-profiler/backtrace.c
drivers/misc/tegra-profiler/version.h

index b89acea..6ac559d 100644 (file)
@@ -67,7 +67,7 @@ user_backtrace(unsigned long __user *tail,
                return NULL;
 
        if (!check_vma_address(value, stack_vma)) {
-               /* clang's frame */
+               /* gcc thumb/clang frame */
                value_fp = value;
 
                if (check_vma_address((unsigned long)(tail + 1), stack_vma))
@@ -77,7 +77,7 @@ user_backtrace(unsigned long __user *tail,
                                              sizeof(unsigned long)))
                        return NULL;
        } else {
-               /* gcc's frame */
+               /* gcc arm frame */
                if (__copy_from_user_inatomic(&value_fp, tail - 1,
                                              sizeof(unsigned long)))
                        return NULL;
@@ -116,9 +116,10 @@ quadd_get_user_callchain(struct pt_regs *regs,
                return 0;
 
        if (thumb_mode(regs))
-               return 0;
+               fp = regs->ARM_r7;
+       else
+               fp = regs->ARM_fp;
 
-       fp = regs->ARM_fp;
        sp = regs->ARM_sp;
        pc = regs->ARM_pc;
 
@@ -133,8 +134,12 @@ quadd_get_user_callchain(struct pt_regs *regs,
                                      sizeof(unsigned long)))
                return 0;
 
-       if (reg > fp &&
-           !check_vma_address(reg, vma)) {
+       if (thumb_mode(regs)) {
+               if (reg <= fp || check_vma_address(reg, vma))
+                       return 0;
+       } else if (reg > fp &&
+                 !check_vma_address(reg, vma)) {
+               /* fp --> fp prev */
                unsigned long value;
                int read_lr = 0;
 
index b494054..1b2ecc0 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef __QUADD_VERSION_H
 #define __QUADD_VERSION_H
 
-#define QUADD_MODULE_VERSION           "1.35"
+#define QUADD_MODULE_VERSION           "1.36"
 #define QUADD_MODULE_BRANCH            "Dev"
 
 #endif /* __QUADD_VERSION_H */