Philip Lantz wrote:
> Lars Erdmann wrote:
> > And last but not least: is there something like:
> >
> > movnti eax,es:[bx]
> >
> > ?
> > If not, does anyone know an
> > equivalent for "movnti eax,es:[bx]" ?
>
> I was just talking to some experts about this very question a couple of
> weeks ago, and I believe the consensus was that there is no way to
> bypass the cache on a load.
I misremembered: movntdqa will do this. (Maybe the question was how to
do it without SSE*, in which case I was right.)
Another option is to use movnti to write to an address within the cache
line; this will force the cache line to be evicted (and written back, if
it is dirty). If you follow that with mfence, then a subsequent normal
read operation to an address within the same cache line is guaranteed to
come directly from the device. However, you could only use this if there
is an address in the relevant cache line that is safe to write to.
In other words:
movnti es:[bx+N], eax
mfence
mov eax, es:[bx]
where N and the initial value of eax are carefully chosen to be
innocuous, and [bx+N] is within the same cache line as [bx].
I'm not sure there are any advantages to using this approach over using
clflush.