Re: How to read register values

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

 



On Fri, Aug 12, 2005 at 09:06:22PM +0700, Nguyen Anh Phu wrote:
> On 8/12/05, Erik Mouw <J.A.K.Mouw@xxxxxxxxxxxxxx> wrote:
> > On Fri, Aug 12, 2005 at 08:53:36PM +0700, Nguyen Anh Phu wrote:
> > > if I don't use kernel module, how do I read registers of threads in
> > > current process?
> > 
> > In userland you could use gdb.
> > 
> 
> Is there anyway to read them inside the program?

With some inline assembly. On x86, you could try something like:

  int cs_val;

  asm("mov %%cs, %0": "=r"(cs_val));

I haven't tested this, so I have no idea if I have the inline assembly
syntax correct.

BTW, this kind of stuff is not useful from within a program. A running
program will modify its own registers. Why do you think this can be
useful for you?


Erik

-- 
Erik Mouw
J.A.K.Mouw@xxxxxxxxxxxxxx  mouw@xxxxxxxxxxxx

Attachment: signature.asc
Description: Digital signature


[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