3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * PURPOSE: Stack checker
6 * FILE: lib/ntdll/rtl/i386/chkstk.s
7 * PROGRAMER: KJK::Hyperion <noog@libero.it>
14 _chkstk() is called by all stack allocations of more than 4 KB. It grows the
15 stack in areas of 4 KB each, trying to access each area. This ensures that the
16 guard page for the stack is hit, and the stack growing triggered
21 /* EAX = size to be allocated */
22 /* save the ECX register */
25 /* ECX = top of the previous stack frame */
28 /* probe the desired memory, page by page */
35 /* raise the top of the stack by a page and probe */
39 /* loop if still more than a page must be probed */
46 /* raise the top of the stack by EAX bytes (size % 4096) and probe */
50 /* EAX = top of the stack */
53 /* allocate the memory */
59 /* restore the return address */