summaryrefslogtreecommitdiff
path: root/arch/arm64
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2014-08-22 13:25:21 (GMT)
committerWill Deacon <will.deacon@arm.com>2014-08-28 19:01:50 (GMT)
commit5b75a6af11357813a7eeb4a29d0261adbbfab556 (patch)
treef9b1c90258e8e5bf43308ee76eb123860e313225 /arch/arm64
parent85487edd252fa04718dcd735bc0f41213bbb9546 (diff)
downloadlinux-5b75a6af11357813a7eeb4a29d0261adbbfab556.tar.xz
arm64: perf: don't rely on layout of pt_regs when grabbing sp or pc
The current perf_regs code relies on sp and pc sitting just off the end of the pt_regs->regs array. This is ugly and fragile, so this patch checks for these register explicitly and returns the appropriate field. Acked-by: Jean Pihet <jean.pihet@linaro.org> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64')
-rw-r--r--arch/arm64/kernel/perf_regs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/arm64/kernel/perf_regs.c b/arch/arm64/kernel/perf_regs.c
index 422ebd6..6762ad7 100644
--- a/arch/arm64/kernel/perf_regs.c
+++ b/arch/arm64/kernel/perf_regs.c
@@ -24,6 +24,12 @@ u64 perf_reg_value(struct pt_regs *regs, int idx)
return regs->compat_lr;
}
+ if ((u32)idx == PERF_REG_ARM64_SP)
+ return regs->sp;
+
+ if ((u32)idx == PERF_REG_ARM64_PC)
+ return regs->pc;
+
return regs->regs[idx];
}