[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120607094624.GB19842@somewhere.redhat.com>
Date: Thu, 7 Jun 2012 11:46:29 +0200
From: Frederic Weisbecker <fweisbec@...il.com>
To: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Jiri Olsa <jolsa@...hat.com>, acme@...hat.com, mingo@...e.hu,
paulus@...ba.org, cjashfor@...ux.vnet.ibm.com, eranian@...gle.com,
gorcunov@...nvz.org, tzanussi@...il.com, mhiramat@...hat.com,
robert.richter@....com, fche@...hat.com,
linux-kernel@...r.kernel.org, masami.hiramatsu.pt@...achi.com,
drepper@...il.com, asharma@...com, benjamin.redelings@...cent.org
Subject: Re: [PATCH 01/16] perf: Unified API to record selective sets of arch
registers
On Thu, May 24, 2012 at 11:43:56AM +0200, Peter Zijlstra wrote:
> On Wed, 2012-05-23 at 21:32 +0200, Jiri Olsa wrote:
> > +static inline u64 perf_reg_value(struct pt_regs *regs, int idx)
> > +{
> > + switch (idx) {
> > + case PERF_X86_32_REG_EAX:
> > + return regs->ax;
> > + case PERF_X86_32_REG_EBX:
> > + return regs->bx;
> > + case PERF_X86_32_REG_ECX:
> > + return regs->cx;
> > + case PERF_X86_32_REG_EDX:
> > + return regs->dx;
> > + case PERF_X86_32_REG_ESI:
> > + return regs->si;
> > + case PERF_X86_32_REG_EDI:
> > + return regs->di;
> > + case PERF_X86_32_REG_EBP:
> > + return regs->bp;
> > + case PERF_X86_32_REG_ESP:
> > + return regs->sp;
> > + case PERF_X86_32_REG_EIP:
> > + return regs->ip;
> > + case PERF_X86_32_REG_FLAGS:
> > + return regs->flags;
> > + case PERF_X86_32_REG_CS:
> > + return regs->cs;
> > + case PERF_X86_32_REG_DS:
> > + return regs->ds;
> > + case PERF_X86_32_REG_ES:
> > + return regs->es;
> > + case PERF_X86_32_REG_FS:
> > + return regs->fs;
> > + case PERF_X86_32_REG_GS:
> > + return regs->gs;
> > + }
> > +
> > + return 0;
> > +}
>
> This is just sad... is there really no saner way to write this? I
> suppose you're going to iterate your sample_regs bitmap and call this
> function for every bit. GCC isn't known to generate particularly sane
> code for switches :/
>
Do you think that compat regs are always a subset of native regs in all
archs as in x86? Sounds logic but I'm asking just in case. If so then yeah
this should work.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists