Shrinking the x86 stack
Posted Dec 15, 2002 11:48 UTC (Sun) by
rwmj (guest, #5474)
In reply to:
Shrinking the x86 stack by cpeterso
Parent article:
Shrinking the x86 stack
I can't comment on other architectures, but on the x86, the 8 KB (2 page)
area actually has two purposes. It contains the (fixed-size) task_struct
at the bottom end, and the kernel stack growing down from the top end.
On x86, the pseudo-variable "current" which points to the current process's
task_struct is actually an assembly macro which does (roughly)
%esp & ~8KB
The observation is that since every process has an 8 KB block, aligned
to 8 KB, to find the address of task_struct, one just needs to round down
the stack pointer to the nearest 8 KB-aligned address.
This article didn't make clear what happened to task_struct. Is it still
there? Or somewhere else?
(
Log in to post comments)