Author: sginsberg
Date: Tue Sep 1 19:51:52 2015
New Revision: 68903
URL:
http://svn.reactos.org/svn/reactos?rev=68903&view=rev
Log:
- 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".
Modified:
trunk/reactos/lib/rtl/i386/rtlmem.s
trunk/reactos/ntoskrnl/include/internal/amd64/ke.h
trunk/reactos/ntoskrnl/include/internal/i386/ke.h
trunk/reactos/ntoskrnl/ke/i386/kiinit.c
trunk/reactos/ntoskrnl/rtl/i386/stack.S
Modified: trunk/reactos/lib/rtl/i386/rtlmem.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/i386/rtlmem.s?rev=…
==============================================================================
--- trunk/reactos/lib/rtl/i386/rtlmem.s [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/i386/rtlmem.s [iso-8859-1] Tue Sep 1 19:51:52 2015
@@ -16,7 +16,6 @@
PUBLIC _RtlFillMemoryUlong@12
PUBLIC _RtlMoveMemory@12
PUBLIC _RtlZeroMemory@8
-PUBLIC @RtlPrefetchMemoryNonTemporal@8
/* FUNCTIONS *****************************************************************/
.code
@@ -328,35 +327,4 @@
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
Modified: trunk/reactos/ntoskrnl/include/internal/amd64/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/amd64/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/amd64/ke.h [iso-8859-1] Tue Sep 1 19:51:52
2015
@@ -81,7 +81,6 @@
} KI_INTERRUPT_DISPATCH_ENTRY, *PKI_INTERRUPT_DISPATCH_ENTRY;
#include <poppack.h>
-extern ULONG Ke386CacheAlignment;
extern ULONG KeI386NpxPresent;
extern ULONG KeI386XMMIPresent;
extern ULONG KeI386FxsrPresent;
Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/ke.h [iso-8859-1] Tue Sep 1 19:51:52
2015
@@ -529,7 +529,6 @@
extern ULONG KiMXCsrMask;
extern ULONG KeI386CpuType;
extern ULONG KeI386CpuStep;
-extern ULONG Ke386CacheAlignment;
extern ULONG KiFastSystemCallDisable;
extern UCHAR KiDebugRegisterTrapOffsets[9];
extern UCHAR KiDebugRegisterContextOffsets[9];
Modified: trunk/reactos/ntoskrnl/ke/i386/kiinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/kiinit.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/kiinit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/kiinit.c [iso-8859-1] Tue Sep 1 19:51:52 2015
@@ -162,7 +162,7 @@
/* FIXME: Implement and enable XMM Page Zeroing for Mm */
/* Patch the RtlPrefetchMemoryNonTemporal routine to enable it */
- *(PCHAR)RtlPrefetchMemoryNonTemporal = 0x90;
+ *(PCHAR)RtlPrefetchMemoryNonTemporal = 0x90; // NOP
}
}
Modified: trunk/reactos/ntoskrnl/rtl/i386/stack.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/rtl/i386/stack.S?…
==============================================================================
--- trunk/reactos/ntoskrnl/rtl/i386/stack.S [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/rtl/i386/stack.S [iso-8859-1] Tue Sep 1 19:51:52 2015
@@ -10,6 +10,8 @@
#include <asm.inc>
#include <ks386.inc>
+
+EXTERN _KePrefetchNTAGranularity:DWORD
/* FUNCTIONS *****************************************************************/
.code
@@ -35,4 +37,30 @@
/* 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