How to print kernel stack's lower and upper address in linux for each process process
You may want to understand into the current_stack_pointer()
code. (for the slightly older kernels, now the stack size has been increased to 16K)
The kernel stack starts on top of the page and increases downwards, %esp
on x86 points (or %rsp on x86_64) to the bottom of stack. You can also derive the current macro as follows
current macro == current_thread_info(%esp)->task
current->pid == (current_thread_info(%esp)->task)->pid
As you know the bottom of the stack, you need to add/subtract the number of pages to get the top of the kernel stack (using %esp or %rsp depends on your arch).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.