lkml.org 
[lkml]   [2016]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [tip:x86/mm] x86/mm: Add INVPCID helpers
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.

\
 
 \ /
  Last update: 2016-02-10 15:01    [W:0.126 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site