This is the mail archive of the frysk@sources.redhat.com mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New method to get real length of register


On Wed, Aug 23, 2006 at 10:00:08PM +0200, Tim Moore wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Yao Qi wrote:
> > Register.getLength() now is not always equal to the real length of
> > that register.
> > 
> > On Ia32, segment register is 16-bit, instead of 32-bit.
> > On X86-64, fs, gs, and ss are 16-bit, instead of 64-bit.
> > On PPC64, xer and ccr are 32-bit, instead of 64-bit.
> > 
> > On 64-bit platforms(X86-64 and PPC64), linux kernel assumes these
> > registers as all 64-bit in order to simplify implementation(correct me
> > if I am wrong).  However, frysk should present the real length of the
> > registers to the users.  For example, in RegisterWindow, the real
> > length of register could be presented if we add "0" as prefix..
> > "0x0037" is better than "0x37", since it could tell user that this
> > register is 16-bit, and this would be more clear to display some flag
> > registers or condition register.
> > 
> > A new method getRealLength is added in Register, and mostly it is the
> > same as getLength, and getRealLength is overridden if they are
> > different.
> 
> Right now I can't think of a reason why getLength() shouldn't return the
> real length of the register. There isn't any requirement that the
> registers that are read and written be some fixed length;
Hi, Tim,
At first, I override getLength() to return the real length of the
register(as you suggested above), but the TestX8664Regs failed 
when reading the value of rdx.  However, I could not reproduce this
problem after I update these code. :(

> PtraceByteBuffer handles those details. It was just laziness (and
> reading the header files) that caused all those segment registers to not
> be they're proper lengths.
Register.get() could get the member length to do ptrace operations
with kernel, although member length is not the real length of
register, but it is the right length to kernel.

getLength() should return real length of register to tell the
outsiders.

For x86 and x86-64, all the segment registers are different from
others, so how about write a new class IA32SegmentRegister, which
extends IA32Register(EMT64SegmentRegister extends EMT64Register),
and override getLength() to return these real length.
Condation or status register makes troubles on PPC64, so a new class,
PPC64_32Register, could do the similar thing.

Here is an example in attachment.  Please review, and comments are
welcome.  If it is ok to you, I will send another formal patch with
changelog for x86/x86-64/ppc64.  If you could do it for x86-64, I do
not mind, :)

-- 
Yao Qi

Attachment: IsaIA32.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]