Re: kernel stack challenge

From: Muli Ben-Yehuda
Date: Sun Apr 04 2004 - 13:46:20 EST


On Sun, Apr 04, 2004 at 11:24:38AM -0700, Sergiy Lozovsky wrote:

> I wonder how it is possible to access task struct
> having current stack pointer. %esp points at the
> middle of the stack (when we are in the kernel) when
> interrupt occures.

Look at the curren()t and get_current() macros. Basically, the stack
is page aligned, so with the proper masking of %esp you can get to the
bottom of the stack.

See http://www.kernelnewbies.org/faq/, "how does get_current work?".

Cheers,
Muli
--
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/

Attachment: signature.asc
Description: Digital signature