Machine-independant handling of registers set with ptrace is tough.

Etienne Robillard granted14 at
Mon Jan 31 21:48:55 CET 2005

Dear list,

I'm actively into the process of hatching at the
Fiasco-UX source-code, and have found the ptrace(2)
interface to be quite entertaining.

Firstly, the naming convention (ptrace macros) differs
from Linux to FreeBSD. However, its relatively trivial
to fix (thx to Alexander Julliard), by adding
something like:


Secondly, a lot of things is done in `Usermode.cpp' 
in order to manipulate user-visible register set.
In particular, I have to trust the effectiveness and
the reliability of the following constructor:

// save it to <machine/reg.h>
struct user_regs_struct regs;
regs.xfs = context->uc_mcontext.gregs[REG_FS] 

In comparison, the FreeBSD kernel implements 
the ptrace(2) proc_[read/write]_register(proc,regs)   
for doing this kind of stuff, but its not even 
close to be a member of uc_mcontext.

All in all, it would be nice to know how (and why)
this is done on different arch, and finally if the
uc_mcontext.gregs constructor is the sole
alternative to registers translation.


Post your free ad now!

More information about the l4-hackers mailing list