kernel stack challenge
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 5 lines · Sergiy Lozovsky
This function doesn't work in the kernel (system hungs instantly when my function is called). Does antbody have any idea what the reason can be? Some special alignment? Special memory segment? In what direction should I look?
The kernel puts some data about the current task at the bottom of the stack and accesses that by referencing the stack pointer in "current". This is even used by interrupts.
-Andi
Thanks, Andi. That can be the case. Bad thing is that stack size is hardcoded all over the kernel.
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.
Serge.
Quoted 11 lines · --- Andi Kleen
Quoted 1 line · Sergiy Lozovsky
This function doesn't work in the kernel (system
hungs
Quoted 1 line
instantly when my function is called). Does
antbody
Quoted 2 lines
have any idea what the reason can be? Some special alignment? Special memory segment? In what
direction
Quoted 1 line
should I look?
Quoted 8 lines
The kernel puts some data about the current task at the bottom
of the stack and accesses that by referencing the stack pointer
in "current". This is even used by interrupts.-Andi
__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway
http://promotions.yahoo.com/design_giveaway/
Quoted 4 lines · Sergiy Lozovsky
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
Signature · 2 lines
Muli Ben-Yehuda http://www.mulix.org | http://mulix.livejournal.com/