[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: runtimeimage of kernel module
The pts_regs are used because of the way the i386+ does a context switch
from PL3 to PL0 . So the cpu is told that the bottom of the
structure(address of xss) is the stack top when a context switch occurs .the
CPU pushes the registers for us upto IP and after that the kernel pushes the
rest of the registers to store the context of a process.
This way we dont have to allocate a TSS descriptor for each process.
anurekh
----- Original Message -----
From: "A. Supreeth Reddy" <supreeth.reddy@wipro.com>
To: "Joseph A Knapka" <jknapka@earthlink.net>; "Anumula Venkat"
<anumulavenkat@yahoo.com>; "kernelnewbies" <kernelnewbies@nl.linux.org>
Sent: Wednesday, December 05, 2001 11:57 AM
Subject: RE: runtimeimage of kernel module
> Hi Joe,
> I know that pt_regs is like below. But I have to look where the stack is
> allocated. [Taken from ptrace.h]
>
> /* this struct defines the way the registers are stored on the
> stack during a system call. */
>
> struct pt_regs {
> long ebx;
> long ecx;
> long edx;
> long esi;
> long edi;
> long ebp;
> long eax;
> int xds;
> int xes;
> long orig_eax;
> long eip;
> int xcs;
> long eflags;
> long esp;
> int xss;
> };
>
> rgds,
>
> -Sup
>
> % -----Original Message-----
> % From: kernelnewbies-bounce@nl.linux.org
> % [mailto:kernelnewbies-bounce@nl.linux.org]On Behalf Of Joseph A Knapka
> % Sent: Wednesday, December 05, 2001 5:35 AM
> % To: Anumula Venkat; kernelnewbies
> % Subject: Re: runtimeimage of kernel module
> %
> %
> % Anumula Venkat wrote:
> % >
> % > Can u please tell me where does the kernel stack lie.
> % > And how to get access to it.
> % >
> % > Regards
> % > Venkat
> %
> % I believe the kernel stack for a task is located on either
> % the page above or the page below the task struct. Well, I
> % used to believe that. After looking at do_fork() and
> % sys_clone(), it appears the location of the new stack is
> % actually being passed into sys_clone() in the pt_regs
> % argument?!?!? That's very weird; the kernel has to allocate
> % space for a new task's stack somewhere.
> %
> % In fact I notice all the sys_*() functions get a pt_regs
> % argument; where does that come from, what does it mean?
> % I'm not sufficiently clueful about gas assembler syntax
> % to have any idea what the code in entry.S (system_call)
> % is doing.
> %
> % Can anyone clarify how this works?
> %
> % 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/
> %
>
>
--
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/