Re: question on 'current' task macro, init_task

David S. Miller (davem@jenolan.rutgers.edu)
Sun, 17 Aug 1997 22:07:41 -0400


Date: Sun, 17 Aug 1997 18:54:36 -0700 (PDT)
From: Darin Johnson <darin@connectnet.com>

I'm baffled by the i386 'current' macro. It appears to just take
the stack pointer and round it down to the next 8K alignment. How
can this work if the stack is larger than 8K and far removed from
the task_struct? Or is current only used for the kernel threads?

Kernel stack is only for the kernel. On nearly all architectures
things look like:

kernel stack -------------------------
| PAGE 2 |
-------------------------
| PAGE 1 |
| ... bottom of kstack |
| struct task_struct |
current --> -------------------------

Later,
David "Sparc" Miller
davem@caip.rutgers.edu