Re: How to know the address ranges of kernel stacks, for user processes and kernel threads?

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 30 Jan 2015 10:20:43 -0500
On 1/28/15 7:54 PM, Yue Chen wrote:
> How can we know the kernel stack ranges for user process and kernel threads
> under FreeBSD x86_64?
> 
> It seems that each kernel stack has two pages (IA-32) to use. Does x86_64
> still have two pages or more? And how can we find the address of these two
> pages from a kernel module?

In 'struct thread' there is td_kstack_pages and td_kstack.  If you grep
for those and see where they are initialized that will lead you to find
in the source what the defaults are for amd64 (and you can also use
those in your kernel module).  Note that some kthreads have a different
sized stack, so using the members in struct thread is probably what you
want to do regardless.

-- 
John Baldwin
Received on Fri Jan 30 2015 - 14:20:40 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:55 UTC