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

Re: [Xen-devel] [PATCH 8/18 V2]: PVH xen: domain creation code changes



On Tue, 26 Mar 2013 07:39:51 +0000
"Jan Beulich" <JBeulich@xxxxxxxx> wrote:

> >>> On 26.03.13 at 02:29, Mukesh Rathor <mukesh.rathor@xxxxxxxxxx>
> >>> wrote:
> > On Mon, 18 Mar 2013 11:57:43 +0000
> > "Jan Beulich" <JBeulich@xxxxxxxx> wrote:
> > 
> >> >>> On 16.03.13 at 01:36, Mukesh Rathor <mukesh.rathor@xxxxxxxxxx>
> >> >>> wrote:
> > Hmm... at a loss. The only think I'm able to come up with here is
> > paranthesis around regs, and spaces in the if statement. Both vcpu
> > and regs are used only once.
> 
> Not really - vcpu is, but regs has one path where it gets evaluated,
> and one path where it doesn't get used.
> 
> Btw, no matter whether there are other precedents, I do think that
> the use of STR() here is misguided too - #name seems like the way
> to go to me. STR() really is needed when you want the argument to
> be further macro expanded before getting converted to a string,
> but here you want the exact opposite - the guarantee that no
> macro expansion happens (or else the "regs->name" use would
> break).

Got it, thanks a lot. 

#define read_segment_register(vcpu, regs, name)                   \
({  u16 __sel;                                                    \
    struct cpu_user_regs *_regs = (regs);                         \
                                                                  \
    if ( is_pvh_vcpu(vcpu) )                                      \
        __sel = _regs->name;                                      \
    else                                                          \
        asm volatile ( "movw %%" #name ",%0" : "=r" (__sel) );    \
    __sel;                                                        \
})


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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