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

Re: [Xen-devel] [PATCH v5 08/12] x86/hyperv: provide Hyper-V hypercall functions



On Fri, Jan 31, 2020 at 03:24:07PM +0100, Jan Beulich wrote:
> On 29.01.2020 21:20, Wei Liu wrote:
> > I tried using the asm(".equ ..") trick but hit a problem with %c again.
> > 
> > mm.c:5736:5: error: invalid 'asm': operand is not a condition code, invalid 
> > operand code 'c'
> >                asm ( ".equ HV_HCALL_PAGE, %c0; .global HV_HCALL_PAGE"
> 
> Would you mind also indicating what the input operand actually
> was? According to my looking at gcc sources when you first
> mentioned this (on irc iirc), much depends on it actually be
> recognizable as a constant by the compiler.

Something along the line:

  asm ( ".equ HV_HCALL_PAGE, %c0; .global HV_HCALL_PAGE"
       :: "i" (__fix_x_to_virt(FIX_X_HV...))


> 
> > +static inline uint64_t hv_do_hypercall(uint64_t control, paddr_t 
> > input_addr,
> > +                                       paddr_t output_addr)
> > +{
> > +    uint64_t status;
> > +    register unsigned long r8 asm("r8") = output_addr;
> 
> I guess strictly speaking this wants to be asm ( "r8" ),
> albeit I now realize that I've similarly not played by style
> in alternative_callN(). In the end I guess - either way.

OK. I can fix this.

> 
> > +    asm volatile ( "call hv_hcall_page"
> > +                   : "=a" (status), "+c" (control),
> > +                     "+d" (input_addr) ASM_CALL_CONSTRAINT
> > +                   : "r" (r8)
> 
> Why "+c" and "+d" but just "r"? If r8 gets treated differently
> from rcx and rdx, please attach a brief comment.
> 

Off the top of my head: r8 will not be modified by Hyper-V, while others
may.

Wei.


> Jan

_______________________________________________
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®.