[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1337852636.9783.89.camel@laptop>
Date: Thu, 24 May 2012 11:43:56 +0200
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Jiri Olsa <jolsa@...hat.com>
Cc: acme@...hat.com, mingo@...e.hu, paulus@...ba.org,
cjashfor@...ux.vnet.ibm.com, fweisbec@...il.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 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 :/
--
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