Welcome! Log In Create A New Profile

where is the register sets of user space stored in kerne stack while after syscall

Posted by Aleaxander 
where is the register sets of user space stored in kerne stack while after syscall
October 16, 2009 06:13AM
Hi, all.
It's my first question asked here, so please pay some timewinking smiley

I mean how to get the address of struct pt_regs that stores the user space register's in kernel stack. I found a statement said:
Quote:
Register set is easy to do, as long as you know where it is. On Linux, there is a simple connection between the locations of process' task structure and its register set location:

Assuming struct task_struct *p is a pointer to the task structure, then the corresponding register set location is:

struct pt_regs *regs = ((struct pt_regs *)(2*PAGE_SIZE + (unsigned long)p)) - 1;

while, this code is written for v2.4 kernel, I don't think it wrok in the linux 2.6 kernel. So could some one to told me some to get the right place? (I know we can use the task pointer to find the kernel stack).

Thanks!
Author:

Your Email:


Subject:


Message: