Re: Kernel Stack

Brian Gerst (bgerst@quark.vpplus.com)
Fri, 09 Apr 1999 15:37:57 -0400


Richard B. Johnson wrote:
>
> On Fri, 9 Apr 1999, Brian Gerst wrote:
>
> > Livia Catarina Soares wrote:
> > > 1- Where is the kernel stack ??
> > > Is it above the address "0xC0000000" in the kernel memory ??
> >
> > There is one kernel stack for every user process, and it is mapped in
> > kernel memory (above PAGE_OFFSET). Note that even in an interrupt
> > context, the kernel stack of whatever user process was running is used.
> > ^^^^^^^^^^^^
>
> The kernel stack is a kernel stack. It is not associated with a
> user process. If this was not true, a user could crash the system.

You didn't read my post very carefully. Every process has 8k (2
consectutive pages on i386) of kernel memory allocated to it. This is
where the task struct resides, and what is left over is used for the
stack while the processor is in kernel mode. This has nothing to do
with the user mode stack, as the int $0x80 call (or any other interrupt)
switches %esp to the value that is saved in the TSS (which is part of
the task struct).

-- 

Brian Gerst

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/