Re: [tip:x86/mm] x86/mm: Add INVPCID helpers

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

 



Hi,

On Wed, 10 Feb 2016, Borislav Petkov wrote:

> --- a/arch/x86/include/asm/tlbflush.h
> +++ b/arch/x86/include/asm/tlbflush.h
> @@ -23,7 +23,7 @@ static inline void __invpcid(unsigned long pcid, unsigned long addr,
>  	 * invpcid (%rcx), %rax in long mode.
>  	 */
>  	asm volatile (".byte 0x66, 0x0f, 0x38, 0x82, 0x01"
> -		      : : "m" (desc), "a" (type), "c" (desc) : "memory");
> +		      : : "m" (*desc), "a" (type), "c" (desc) : "memory");

That still doesn't do what you want.  Arrays in C are funny.  *desc is 
exactly equivalent to desc[0], _not_ to the whole array, indeed there's no 
C syntax to name an lvalue of array type in normal expressions.  You need 
to jump through hoops for this:

  "m" (*(struct {unsigned long x[2];} *)desc)

It'd probably be easier to simply declare the descriptor as a struct, 
rather than an array, then the original syntax would have been mostly 
correct:

  struct {u64 d[2];} desc = { pcid, addr };
  asm ... "m" (desc), "c" (&desc)


Ciao,
Michael.
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux