[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: runtimeimage of kernel module
Ravi K wrote:
>
> Hi,
> The code in copy_thread() which sets the ESP is like
> this:
>
> childregs = ((struct pt_regs *) (THREAD_SIZE +
> unsigned long) p)) - 1;
> ...
> ...
> p->thread.esp = (unsigned long) childregs;
>
> The value of THREAD_SIZE is 8192. So, effectively the
> ESP is set to (p + 8191), which is top of the
> allocated kernel stack.
> From what I understand, the esp value passed in
> pt_regs is the task's user-mode stack pointer
> (probably used when switching back to user-mode).
Thank you, that makes perfect sense!
Cheers,
-- Joe
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
IRC Channel: irc.openprojects.net / #kernelnewbies
Web Page: http://www.kernelnewbies.org/