All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: add .size directive to indirect thunk generation macro
@ 2018-02-23 10:24 Jan Beulich
  2018-02-23 11:09 ` Andrew Cooper
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2018-02-23 10:24 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper

Not adding .type, as these are neither functions nor objects.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/indirect-thunk.S
+++ b/xen/arch/x86/indirect-thunk.S
@@ -41,6 +41,7 @@ ENTRY(__x86_indirect_thunk_\reg)
         ALTERNATIVE_2 __stringify(IND_THUNK_RETPOLINE \reg),              \
         __stringify(IND_THUNK_LFENCE \reg), X86_FEATURE_IND_THUNK_LFENCE, \
         __stringify(IND_THUNK_JMP \reg),    X86_FEATURE_IND_THUNK_JMP
+        .size __x86_indirect_thunk_\reg, . - __x86_indirect_thunk_\reg
 .endm
 
 /* Instantiate GEN_INDIRECT_THUNK for each register except %rsp. */




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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86: add .size directive to indirect thunk generation macro
  2018-02-23 10:24 [PATCH] x86: add .size directive to indirect thunk generation macro Jan Beulich
@ 2018-02-23 11:09 ` Andrew Cooper
  2018-02-23 11:17   ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2018-02-23 11:09 UTC (permalink / raw)
  To: Jan Beulich, xen-devel

On 23/02/18 10:24, Jan Beulich wrote:
> Not adding .type, as these are neither functions nor objects.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

@function is for executable code in general.  It is not restricted to
C's idea of function.

This is how GCC writes a repoline thunk:

    .section   
.text.__x86_indirect_thunk_rax,"axG",@progbits,__x86_indirect_thunk_rax,comdat
    .globl    __x86_indirect_thunk_rax
    .hidden    __x86_indirect_thunk_rax
    .type    __x86_indirect_thunk_rax, @function
__x86_indirect_thunk_rax:
.LFB1:
    .cfi_startproc
    call    .LIND1
.LIND0:
    lfence
    jmp    .LIND0
.LIND1:
    mov    %rax, (%rsp)
    ret
    .cfi_endproc


>
> --- a/xen/arch/x86/indirect-thunk.S
> +++ b/xen/arch/x86/indirect-thunk.S
> @@ -41,6 +41,7 @@ ENTRY(__x86_indirect_thunk_\reg)
>          ALTERNATIVE_2 __stringify(IND_THUNK_RETPOLINE \reg),              \
>          __stringify(IND_THUNK_LFENCE \reg), X86_FEATURE_IND_THUNK_LFENCE, \
>          __stringify(IND_THUNK_JMP \reg),    X86_FEATURE_IND_THUNK_JMP

Newline please.

> +        .size __x86_indirect_thunk_\reg, . - __x86_indirect_thunk_\reg

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>, ideally with a
.type as well.

>  .endm
>  
>  /* Instantiate GEN_INDIRECT_THUNK for each register except %rsp. */
>
>
>


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86: add .size directive to indirect thunk generation macro
  2018-02-23 11:09 ` Andrew Cooper
@ 2018-02-23 11:17   ` Jan Beulich
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2018-02-23 11:17 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: xen-devel

>>> On 23.02.18 at 12:09, <andrew.cooper3@citrix.com> wrote:
> On 23/02/18 10:24, Jan Beulich wrote:
>> Not adding .type, as these are neither functions nor objects.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> @function is for executable code in general.  It is not restricted to
> C's idea of function.

Oh, indeed, I forgot that the spec says "or other executable code".

Jan


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-23 11:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-23 10:24 [PATCH] x86: add .size directive to indirect thunk generation macro Jan Beulich
2018-02-23 11:09 ` Andrew Cooper
2018-02-23 11:17   ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.