From 352ea45a7229df8f5ae83c0757f6d426ba0f41b5 Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Tue, 7 Jan 2014 13:47:25 +0100 Subject: perf callchain: Add mask into struct regs_dump Adding mask info into struct regs_dump to make the registers information compact. The mask was always passed along, so logically the mask info fits more into the struct regs_dump. Signed-off-by: Jiri Olsa Acked-by: Jean Pihet Cc: Adrian Hunter Cc: Corey Ashford Cc: David Ahern Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Jean Pihet Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1389098853-14466-9-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/unwind.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'tools/perf/util/unwind.c') diff --git a/tools/perf/util/unwind.c b/tools/perf/util/unwind.c index 3b7018102dfb..720a4cae6004 100644 --- a/tools/perf/util/unwind.c +++ b/tools/perf/util/unwind.c @@ -86,7 +86,6 @@ struct unwind_info { struct perf_sample *sample; struct machine *machine; struct thread *thread; - u64 sample_uregs; }; #define dw_read(ptr, type, end) ({ \ @@ -391,16 +390,16 @@ static int access_dso_mem(struct unwind_info *ui, unw_word_t addr, return !(size == sizeof(*data)); } -static int reg_value(unw_word_t *valp, struct regs_dump *regs, int id, - u64 sample_regs) +static int reg_value(unw_word_t *valp, struct regs_dump *regs, int id) { int i, idx = 0; + u64 mask = regs->mask; - if (!(sample_regs & (1 << id))) + if (!(mask & (1 << id))) return -EINVAL; for (i = 0; i < id; i++) { - if (sample_regs & (1 << i)) + if (mask & (1 << i)) idx++; } @@ -424,8 +423,7 @@ static int access_mem(unw_addr_space_t __maybe_unused as, return 0; } - ret = reg_value(&start, &ui->sample->user_regs, PERF_REG_SP, - ui->sample_uregs); + ret = reg_value(&start, &ui->sample->user_regs, PERF_REG_SP); if (ret) return ret; @@ -475,7 +473,7 @@ static int access_reg(unw_addr_space_t __maybe_unused as, if (id < 0) return -EINVAL; - ret = reg_value(valp, &ui->sample->user_regs, id, ui->sample_uregs); + ret = reg_value(valp, &ui->sample->user_regs, id); if (ret) { pr_err("unwind: can't read reg %d\n", regnum); return ret; @@ -572,13 +570,11 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb, int unwind__get_entries(unwind_entry_cb_t cb, void *arg, struct machine *machine, struct thread *thread, - u64 sample_uregs, struct perf_sample *data, - int max_stack) + struct perf_sample *data, int max_stack) { unw_word_t ip; struct unwind_info ui = { .sample = data, - .sample_uregs = sample_uregs, .thread = thread, .machine = machine, }; @@ -587,7 +583,7 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg, if (!data->user_regs.regs) return -EINVAL; - ret = reg_value(&ip, &data->user_regs, PERF_REG_IP, sample_uregs); + ret = reg_value(&ip, &data->user_regs, PERF_REG_IP); if (ret) return ret; -- cgit v1.2.3-59-g8ed1b