[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190801203614.GA16228@zn.tnic>
Date: Thu, 1 Aug 2019 22:36:14 +0200
From: Borislav Petkov <bp@...en8.de>
To: "Kirill A. Shutemov" <kirill@...temov.name>
Cc: "Luck, Tony" <tony.luck@...el.com>,
Alexey Dobriyan <adobriyan@...il.com>,
kirill.shutemov@...ux.intel.com, linux-kernel@...r.kernel.org,
jing.lin@...el.com, x86@...nel.org
Subject: Re: [PATCH] x86/asm: Add support for MOVDIR64B instruction
On Thu, Aug 01, 2019 at 11:28:08PM +0300, Kirill A. Shutemov wrote:
> On Thu, Aug 01, 2019 at 12:49:48PM -0700, Luck, Tony wrote:
> > On Thu, Aug 01, 2019 at 10:43:48PM +0300, Alexey Dobriyan wrote:
> > > > +static inline void movdir64b(void *dst, const void *src)
> > > > +{
> > > > + /* movdir64b [rdx], rax */
> > > > + asm volatile(".byte 0x66, 0x0f, 0x38, 0xf8, 0x02"
> > > > + : "=m" (*(char *)dst)
> > > ^^^^^^^^^^
> > >
> > > > + : "d" (src), "a" (dst));
> > > > +}
> > >
> > > Probably needs fake 64-byte type, so that compiler knows what is dirty.
> >
> > Would that be something like this?
> >
> > static inline void movdir64b(void *dst, const void *src)
> > {
> > struct dstbytes {
> > char pad[64];
> > };
> >
> > /* movdir64b [rdx], rax */
> > asm volatile(".byte 0x66, 0x0f, 0x38, 0xf8, 0x02"
> > : "=m" (*(struct dstbytes *)dst)
> > : "d" (src), "a" (dst));
> > }
> >
> > Or did you have something else in mind?
>
> Or should we add "memory" clobber instead, like we do for string
> operations?
I think Tony's in the right direction. We already do dst "sizing" like
that for the compiler in clwb().
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
Powered by blists - more mailing lists