[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180518075853.GD12217@hirez.programming.kicks-ass.net>
Date: Fri, 18 May 2018 09:58:53 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Nadav Amit <namit@...are.com>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org, nadav.amit@...il.com,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [PATCH 2/6] x86: bug: prevent gcc distortions
On Thu, May 17, 2018 at 09:13:58AM -0700, Nadav Amit wrote:
> +asm(".macro __BUG_FLAGS ins:req file:req line:req flags:req size:req\n"
> + "1:\t \\ins\n\t"
> + ".pushsection __bug_table,\"aw\"\n"
> + "2:\t "__BUG_REL(1b) "\t# bug_entry::bug_addr\n\t"
> + __BUG_REL(\\file) "\t# bug_entry::file\n\t"
> + ".word \\line" "\t# bug_entry::line\n\t"
> + ".word \\flags" "\t# bug_entry::flags\n\t"
> + ".org 2b+\\size\n\t"
> + ".popsection\n\t"
> + ".endm");
> +
> +#define _BUG_FLAGS(ins, flags) \
> do { \
> + asm volatile("__BUG_FLAGS \"" ins "\" %c0 %c1 %c2 %c3" \
> + : : "i" (__FILE__), "i" (__LINE__), \
> + "i" (flags), \
> "i" (sizeof(struct bug_entry))); \
> } while (0)
This is an awesome hack, but is there really nothing we can do to make
it more readable? Esp, that global asm doing the macro definition is a
pain to read.
Also, can we pretty please used named operands in 'new' code?
Powered by blists - more mailing lists