Re: Protected mode transitions and big real mode... still an issue

Guillaume Thouvenin
2008-05-15T07:49:34Z

On Thu, 15 May 2008 10:33:38 +0300
Avi Kivity <avi@qumranet.com> wrote:

> Marcelo Tosatti wrote:
> > 1) add is storing the result in the wrong register
> >
> > 6486: 66 64 89 3e 72 01 mov %edi,%fs:0x172
> > 648c: 66 be 8d 03 00 00 mov $0x38d,%esi
> > 6492: 66 c1 e6 04 shl $0x4,%esi
> > 6496: 66 b8 98 0a 00 00 mov $0xa98,%eax
> > 649c: 66 03 f0 add %eax,%esi
> >
> > The destination for the add is "%esi", but the emulation stores the
> > result in eax, because:
> >
> > if ((c->d & ModRM) && c->modrm_mod == 3) {
> > u8 reg;
> > c->dst.bytes = (c->d & ByteOp) ? 1 : c->op_bytes;
> > c->dst.ptr = decode_register(c->modrm_rm, c->regs, c->d & ByteOp);
> > }
> >
> > modrm_reg contains "6", which is the correct register index, but
> > modrm_rm contains 0, so the result is stored in "eax" (see hack).
> >
>
> What version are you looking at? Current code doesn't have exactly this.

It's in my patch. I added this because in gfxboot code there is an
instruction "add %eax, %esp" that needs to be emulated and with the
normal path, if I remember well, we have c->dst.bytes == 0 and thus,
the emulate_2op_SrcV() function just do nothing.

Regards,
Guillaume

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.