|
|
|
Re: bad asm goto ? | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
On Mon, Oct 25, 2010 at 3:39 PM, Dave Jones <davej@xxxxxxxxxx> wrote:
> I tried unwinding some of the nested macros, and came up with ..
>
> # define __ASM_FORM(x) " " #x " "
> # define JUMP_LABEL_INITIAL_NOP ".byte 0xe9 \n\t .long 0\n\t"
> # define __ASM_SEL(a,b) __ASM_FORM(b)
> #define _ASM_PTR __ASM_SEL(.long, .quad)
>
> # define JUMP_LABEL(key, label) \
> do { \
> asm goto("1:" \
> JUMP_LABEL_INITIAL_NOP \
> ".pushsection __jump_table, \"a\" \n\t"\
> _ASM_PTR "1b, %l[" #label "], %c0 \n\t" \
> ".popsection \n\t" \
> : : "i" (key) : : label); \
> } while (0)
>
> int main(int argc, char *argv[])
> {
> JUMP_LABEL("1", do_trace );
> return 1;
> do_trace:
> return 0;
> }
>
Thanks, I got this example working for me too. You are right, sparse is
choking on it. Let me take a look tonight.
Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Newbies FAQ] [Kernel List] [Site Home] [IETF Annouce] [DCCP] [Netdev] [Networking] [Security] [Bugtraq] [Photo] [Yosemite] [MIPS Linux] [ARM Linux] [Linux Security] [Linux RAID] [Linux SCSI] [DDR & Rambus] [Trinity Fuzzer Tool]