[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: Kernel stack
On Thu, Jun 15, 2000 at 11:49:39AM +0530, jsojan@xxxxxxxxxx wrote:
> I haven't been able to figure out about how the kernel stack is
> maintained. From what I read, each task_struct has pointers to both the the
> kernel stack and process stack, but both these stacks are with respect to a
> process. what happens during a hardware interrupt?....where is the stack
> in this case as we enter the kernel mode without a valid "current"
> do we "steal" the kernel stack of a process or is there a separate stack to
> deal with this?
There is no such thing as a global kernel stack. Each process has it's
own user stack and a kernel stack. On Linux, this kernel stack is in
the same page as the task struct. In fact, if you look at the #define
for "current", you'll see that current is computed by using some bit
shifting on kernel's %esp.
There is a valid "current" pointer at all times. During interrupts, the
kernel uses the stack of the currently executing process.