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:
#ifndef PTRACE_PEEKTEXT #define PTRACE_PEEKTEXT PT_READ_D #endif
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.
Cheers, Etienne
______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca