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

Re: [Xen-devel] [PATCH V6 2/5] x86/hvm: pkeys, add pkeys support for guest_walk_tables



>>> On 27.01.16 at 04:18, <huaitong.han@xxxxxxxxx> wrote:
> On Mon, 2016-01-25 at 08:46 -0700, Jan Beulich wrote:
> 
>> > > > On 19.01.16 at 08:30, <huaitong.han@xxxxxxxxx> wrote:
>> 
>> 
>> > +    write_cr4(cr4 | X86_CR4_PKE);
>> > +    asm volatile (".byte 0x0f,0x01,0xee"
>> > +        : "=a" (pkru) : "c" (0) : "dx");
>> > +    write_cr4(cr4);
>> 
>> I think you will want to abstract out the actual writing of CR4 from
>> write_cr4(), as updating this_cpu(cr4) back and forth is quite
>> pointless here.
>> 
> Updating this_cpu(cr4) back and forth is pointless, but using 
> "asm volatile ( "mov %0,%%cr4" : : "r" (val) )" directly here is also
> bad code style, as there are two places you can update cr4 directly.

Not sure what two places you refer to, but note that I specifically
said "abstract out", not "use inline assembly directly".

Jan


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