Commit 5b75a6af authored by Will Deacon's avatar Will Deacon

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: default avatarJean Pihet <jean.pihet@linaro.org>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent 85487edd
...@@ -24,6 +24,12 @@ u64 perf_reg_value(struct pt_regs *regs, int idx) ...@@ -24,6 +24,12 @@ u64 perf_reg_value(struct pt_regs *regs, int idx)
return regs->compat_lr; 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]; return regs->regs[idx];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment