Re: runtimeimage of kernel module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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).

-Ravi.

> The value for the new task's ESP is somehow
> passed
> into the sys_fork() call in the pt_regs struct. I
> don't
> understand how that makes sense; it seems
> self-evident that
> the kernel must set the new task's ESP to the top of
> the
> allocated kernel stack, not to some apparently
> arbitrary
> value passed in by the caller of sys_fork() (which
> of course
> is, ultimately, a user task in most cases).
> 
> Thanks,
> 
> -- Joe
 


__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
--
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/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux