I am trying to use the pt_regs
struct to get and set registers such as eax
, but compilation errors tell me that pt_regs
has no such member eax
.
However, I am able to get the ax
register. Can anybody tell me what is happening?
I am using 32-bit Ubuntu linux with the 3.0.0
kernel. Thank you again.
Take a look at the definition of struct pt_regs
in arch/x86/include/asm/ptrace.h.
Notice #ifndef __KERNEL__
stuff there, it means that the definition of that structure is different for kernel-mode and user-mode code.
For the kernel code, pt_regs::ax
is probably the value you need. It should contain the value of %eax
on a 32-bit system and %rax
on a 64-bit one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With