lkml.org 
[lkml]   [2015]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 17/37] x86, pkeys: add functions to fetch PKRU
From
Date
On 11/27/2015 01:51 AM, Thomas Gleixner wrote:
> On Mon, 16 Nov 2015, Dave Hansen wrote:
>> +#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
>> +static inline u32 __read_pkru(void)
>> +{
>> + unsigned int eax, edx;
>> + unsigned int ecx = 0;
>> + unsigned int pkru;
>> +
>> + asm volatile(".byte 0x0f,0x01,0xee\n\t"
>> + : "=a" (eax), "=d" (edx)
>> + : "c" (ecx));
>> + pkru = eax;
>> + return pkru;
>
> Wouldn't a simple 'return eax;' be sufficient?

Yes. I wanted to make it clear that EAX specifically was where the data
we want was ending up. But, I guess the "=a" does that equally well.

I'll fix it up.

Also, looking at this, it also deserves a mention that this is the
"rdpkru" instruction. Otherwise, it's hard to figure out what
instruction this is.



\
 
 \ /
  Last update: 2015-11-30 17:21    [W:0.295 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site