[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 3/7] x86/alt: Clean up the assembly used to generate alternatives



On 23/02/18 15:12, Jan Beulich wrote:
>>>> On 23.02.18 at 15:03, <andrew.cooper3@xxxxxxxxxx> wrote:
>> On 13/02/18 14:37, Jan Beulich wrote:
>>>  >>> On 12.02.18 at 12:23, <andrew.cooper3@xxxxxxxxxx> wrote:
>>>> --- a/xen/include/asm-x86/alternative-asm.h
>>>> +++ b/xen/include/asm-x86/alternative-asm.h
>>>> @@ -9,60 +9,67 @@
>>>>   * enough information for the alternatives patching code to patch an
>>>>   * instruction. See apply_alternatives().
>>>>   */
>>>> -.macro altinstruction_entry orig alt feature orig_len alt_len
>>>> +.macro altinstruction_entry orig repl feature orig_len repl_len
>>>>      .long \orig - .
>>>> -    .long \alt - .
>>>> +    .long \repl - .
>>>>      .word \feature
>>>>      .byte \orig_len
>>>> -    .byte \alt_len
>>>> +    .byte \repl_len
>>>>  .endm
>>>>  
>>>> +#define orig_len               (.L\@_orig_e       -     .L\@_orig_s)
>>>> +#define repl_len(nr)           (.L\@_repl_e\()nr  -     .L\@_repl_s\()nr)
>>>> +#define decl_repl(insn, nr)     .L\@_repl_s\()nr: insn; .L\@_repl_e\()nr:
>>> Wouldn't it work equally well but look slightly less odd if you used
>>> \(nr) instead of \()nr?
>> How would that work?  \() is the token separator.
> When there's nothing inside the parentheses, this construct
> can be used as a token separator, but that's not its main
> purpose. Instead \(<text>) means to take <text> literally,
> without e.g. expanding macro arguments inside it.

I've never come across it before, and I still can't find reference to it
in the as manual.

As for why not to use it, Clang has no idea what \(nr) means, meaning
that it doesn't expand the construct in the way you describe.  (Although
I see that GCC/AS do behave as you describe).

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.