RtlCopyMemoryNonTemporal
VOID __stdcall RtlCopyMemoryNonTemporal(VOID *Destination, const VOID *Source, SIZE_T Length){
signed __int64 v3;
char *v4;
char *v5;
__int64 v6;
signed __int64 v7;
__m128i v8;
__m128i v9;
bool v10;
SIZE_T v11;
bool v12;
v3 = (_BYTE *)Source - (_BYTE *)Destination;
if( Length >= 0x4F )
{
if( ((unsigned __int8)Destination & 0xF) != 0 )
{
v4 = (char *)Destination + Length;
_mm_stream_si32((int *)Destination, *(_QWORD *)((char *)Destination + v3));
if( ((unsigned __int8)Destination & 8) == 0 )
_mm_stream_si32((int *)Destination + 2, *(_QWORD *)((char *)Destination + v3 + 8));
Destination = (VOID *)(((unsigned __int64)Destination + 16) & 0xFFFFFFFFFFFFFFF0ui64);
Length = v4 - (_BYTE *)Destination;
}
do
{
v5 = (char *)Destination;
v6 = 16i64;
v10 = Length < 0x400;
Length -= 1024i64;
if( v10 )
{
v11 = Length + 1024;
v6 = v11 >> 6;
Length = v11 & 0x3F;
}
do
{
_mm_prefetchnta(&v5[v3]);
v5 += 64;
--v6;
}
while( v6 );
v7 = v5 - (_BYTE *)Destination;
do
{
v8 = _mm_loadu_si128((const __m128i *)((char *)Destination + v3 + 16));
_mm_stream_si128((__m128i *)Destination, _mm_loadu_si128((const __m128i *)((char *)Destination + v3)));
_mm_stream_si128((__m128i *)Destination + 1, v8);
Destination = (char *)Destination + 64;
v9 = _mm_loadu_si128((const __m128i *)((char *)Destination + v3 - 16));
_mm_stream_si128((__m128i *)Destination - 2, _mm_loadu_si128((const __m128i *)((char *)Destination + v3 - 32)));
_mm_stream_si128((__m128i *)Destination - 1, v9);
v7 -= 64i64;
}
while( v7 );
}
while( Length >= 0x40 );
}
else if( Length < 8 )
{
for( ; Length; --Length )
{
*(_BYTE *)Destination = *((_BYTE *)Destination + v3);
Destination = (char *)Destination + 1;
}
return;
}
while( 1 )
{
v12 = Length <= 8;
Length -= 8i64;
if( v12 )
break;
_mm_stream_si32((int *)Destination, *(_QWORD *)((char *)Destination + v3));
Destination = (char *)Destination + 8;
}
_mm_stream_si32((int *)((char *)Destination + Length), *(_QWORD *)((char *)Destination + Length + v3));
_mm_sfence();
}Referenced by:
HviCopyMemoryNonTemporal
MmCopyToCachedPage
RtlWriteNonVolatileMemory