xref: /reactos/ntoskrnl/rtl/i386/prefetch.S (revision 32d615fc)
1/*
2 * COPYRIGHT:       See COPYING in the top level directory
3 * PROJECT:         ReactOS Kernel
4 * FILE:            ntoskrnl/rtl/i386/stack.S
5 * PURPOSE:         Stack Support for RTL
6 * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
7 */
8
9/* INCLUDES ******************************************************************/
10
11#include <asm.inc>
12#include <ks386.inc>
13
14EXTERN _KePrefetchNTAGranularity:DWORD
15
16/* FUNCTIONS *****************************************************************/
17.code
18
19PUBLIC @RtlPrefetchMemoryNonTemporal@8
20@RtlPrefetchMemoryNonTemporal@8:
21
22    /*
23     * Kernel will overwrite this to 'nop' during init
24     * if prefetchnta is available. Slight optimization
25     * as compared to checking KeI386XMMIPresent for every call.
26     */
27    ret
28
29    /* Get granularity */
30    mov eax, [_KePrefetchNTAGranularity]
31
32    /* Prefetch this line */
33FetchLine:
34    prefetchnta byte ptr [ecx]
35
36    /* Update address and count */
37    add ecx, eax
38    sub edx, eax
39
40    /* Keep looping for the next line, or return if done */
41    ja FetchLine
42    ret
43
44END
45