How to find kernel stack size6/28/2023 ![]() See KeSetKernelStackSwapEnable for information on how to temporarily disable kernel stack paging for the current thread. Generally, the kernel-mode stack resides in memory, however it can occasionally be paged out if the thread enters a wait state that specifies user mode. However, nonpaged pool is also a limited system resource. Therefore, it is better for a driver to allocate system-space memory than to run out of kernel stack space. Running out of kernel stack space causes a fatal system error. Note that the size of the kernel-mode stack can vary among different hardware platforms and different versions of the operating system. You can call the IoGetStackLimits and IoGetRemainingStackSize routines to determine the kernel stack space that is available, or KeExpandKernelStackAndCallout to expand it. In other words, the call-tree structure of a driver should be relatively flat. Make sure that you limit the number of recursive calls that can occur, if you design a driver that has a recursive routine. ![]() To avoid running out of kernel-mode stack space, use the following design guidelines:Īvoid making deeply nested calls from one internal driver routine to another, if each routine passes data on the kernel stack. ![]() Therefore, when passing data to internal routines, drivers cannot pass large amounts of data on the kernel stack. The size of the kernel-mode stack is limited to approximately three pages.
0 Comments
Leave a Reply. |