Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1280026

Re: [PATCH 17/37] x86, pkeys: add functions to fetch PKRU

From Dave Hansen <dave@sr71.net>
Newsgroups linux.kernel
Subject Re: [PATCH 17/37] x86, pkeys: add functions to fetch PKRU
Date 2015-11-30 17:00 +0100
Message-ID <qAz1U-5xV-17@gated-at.bofh.it> (permalink)
References <qvFhE-7YL-5@gated-at.bofh.it> <qvFrj-82I-5@gated-at.bofh.it> <qznYR-18E-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 17/37] x86, pkeys: add functions to fetch PKRU Dave Hansen <dave@sr71.net> - 2015-11-17 04:50 +0100
  Re: [PATCH 17/37] x86, pkeys: add functions to fetch PKRU Thomas Gleixner <tglx@linutronix.de> - 2015-11-27 11:00 +0100
    Re: [PATCH 17/37] x86, pkeys: add functions to fetch PKRU Dave Hansen <dave@sr71.net> - 2015-11-30 17:00 +0100

csiph-web