- Move misplaced RtlPrefetchMemoryNonTemporal from rtl into kernel where it belongs (it only exists as an export for use by drivers to safely try to use prefetchnta even if it may not be available). Use existing global KePrefetchNTAGranularity that is set to the correct value via cpuid instead of hardcoded "Ke386CacheAlignment".

svn path=/trunk/; revision=68903
This commit is contained in:
Stefan Ginsberg 2015-09-01 19:51:52 +00:00
parent fb17ced703
commit eebbf23330
5 changed files with 29 additions and 35 deletions

View file

@ -16,7 +16,6 @@ PUBLIC _RtlFillMemory@12
PUBLIC _RtlFillMemoryUlong@12
PUBLIC _RtlMoveMemory@12
PUBLIC _RtlZeroMemory@8
PUBLIC @RtlPrefetchMemoryNonTemporal@8
/* FUNCTIONS *****************************************************************/
.code
@ -328,35 +327,4 @@ _RtlMoveMemory@12:
dec edi
jmp .CopyDownBytes
@RtlPrefetchMemoryNonTemporal@8:
/*
* Overwritten by ntoskrnl/ke/i386/kernel.c if SSE is supported
* (see Ki386SetProcessorFeatures())
*/
ret
/* Get granularity */
mov eax, [_Ke386CacheAlignment]
FetchLine:
/* Prefetch this line */
prefetchnta byte ptr [ecx]
/* Update address and count */
add ecx, eax
sub edx, eax
/* Keep looping for the next line, or return if done */
ja FetchLine
ret
/* FIXME: HACK */
_Ke386CacheAlignment:
.long 64
END

View file

@ -81,7 +81,6 @@ typedef struct _KI_INTERRUPT_DISPATCH_ENTRY
} KI_INTERRUPT_DISPATCH_ENTRY, *PKI_INTERRUPT_DISPATCH_ENTRY;
#include <poppack.h>
extern ULONG Ke386CacheAlignment;
extern ULONG KeI386NpxPresent;
extern ULONG KeI386XMMIPresent;
extern ULONG KeI386FxsrPresent;

View file

@ -529,7 +529,6 @@ extern ULONG KeI386FxsrPresent;
extern ULONG KiMXCsrMask;
extern ULONG KeI386CpuType;
extern ULONG KeI386CpuStep;
extern ULONG Ke386CacheAlignment;
extern ULONG KiFastSystemCallDisable;
extern UCHAR KiDebugRegisterTrapOffsets[9];
extern UCHAR KiDebugRegisterContextOffsets[9];

View file

@ -162,7 +162,7 @@ KiInitMachineDependent(VOID)
/* FIXME: Implement and enable XMM Page Zeroing for Mm */
/* Patch the RtlPrefetchMemoryNonTemporal routine to enable it */
*(PCHAR)RtlPrefetchMemoryNonTemporal = 0x90;
*(PCHAR)RtlPrefetchMemoryNonTemporal = 0x90; // NOP
}
}

View file

@ -11,6 +11,8 @@
#include <asm.inc>
#include <ks386.inc>
EXTERN _KePrefetchNTAGranularity:DWORD
/* FUNCTIONS *****************************************************************/
.code
@ -35,4 +37,30 @@ _RtlpGetStackLimits@8:
/* return */
ret 8
PUBLIC @RtlPrefetchMemoryNonTemporal@8
@RtlPrefetchMemoryNonTemporal@8:
/*
* Kernel will overwrite this to 'nop' during init
* if prefetchnta is available. Slight optimization
* as compared to checking KeI386XMMIPresent for every call.
*/
ret
/* Get granularity */
mov eax, [_KePrefetchNTAGranularity]
/* Prefetch this line */
FetchLine:
prefetchnta byte ptr [ecx]
/* Update address and count */
add ecx, eax
sub edx, eax
/* Keep looping for the next line, or return if done */
ja FetchLine
ret
END