public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Question] How get instruction pointer of user space ???
@ 2005-08-31  9:59 liyu@WAN
  2005-08-31 12:23 ` Gaurav Dhiman
  0 siblings, 1 reply; 2+ messages in thread
From: liyu@WAN @ 2005-08-31  9:59 UTC (permalink / raw)
  To: LKML

Hi everyone:

    I am implemnting one ioctl() in one character device.

    That need know instruction pointer of user space. I am on i386 
platform.
I can sure I am in process context. and enter kernel by system call way.

    As I known, in default case, each task have one kernel stack, its length
is THREAD_SIZE(2 pages),  and current_thread_info() is at its top. the
struct pt_regs is at bottom of this stack.

    so I write the code like here:

    pt_regs = ((struct pt_regs *)(THREAD_SIZE + current_thread_info()))+1;
    return pt_regs->eip;

    but it do not work! even, I get segment fault and kernel Oops at 
sometime.
   
    Also, I am sure current_thread_info() return right value of current 
user task.

    Any idea on here?

    thanks


                                                                   sailor.






   





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-08-31 12:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-31  9:59 [Question] How get instruction pointer of user space ??? liyu@WAN
2005-08-31 12:23 ` Gaurav Dhiman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox