05fb981def3770824ffbb5a33841d4392bd7e862
[reactos.git] / reactos / ntoskrnl / rtl / i386 / stack.S
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
14 EXTERN _KePrefetchNTAGranularity:DWORD
15
16 /* FUNCTIONS *****************************************************************/
17 .code
18
19 PUBLIC _RtlpGetStackLimits@8
20 _RtlpGetStackLimits@8:
21
22 /* Get the current thread */
23 mov eax, [fs:KPCR_CURRENT_THREAD]
24
25 /* Get the stack limits */
26 mov ecx, [eax+KTHREAD_STACK_LIMIT]
27 mov edx, [eax+KTHREAD_INITIAL_STACK]
28 sub edx, SIZEOF_FX_SAVE_AREA
29
30 /* Return them */
31 mov eax, [esp+4]
32 mov [eax], ecx
33
34 mov eax, [esp+8]
35 mov [eax], edx
36
37 /* return */
38 ret 8
39
40
41 PUBLIC @RtlPrefetchMemoryNonTemporal@8
42 @RtlPrefetchMemoryNonTemporal@8:
43
44 /*
45 * Kernel will overwrite this to 'nop' during init
46 * if prefetchnta is available. Slight optimization
47 * as compared to checking KeI386XMMIPresent for every call.
48 */
49 ret
50
51 /* Get granularity */
52 mov eax, [_KePrefetchNTAGranularity]
53
54 /* Prefetch this line */
55 FetchLine:
56 prefetchnta byte ptr [ecx]
57
58 /* Update address and count */
59 add ecx, eax
60 sub edx, eax
61
62 /* Keep looping for the next line, or return if done */
63 ja FetchLine
64 ret
65
66 END