qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 41/60] target-i386: Create gen_lea_v_seg


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v2 41/60] target-i386: Create gen_lea_v_seg
Date: Thu, 26 Dec 2013 21:31:06 +0000

On 26 December 2013 21:27, Peter Maydell <address@hidden> wrote:

> Why is it OK to skip the addition of the base address for ES
> (in the movl_A0_EDI case) when the comment for addseg says
> it only applies to CS/DS/ES?

Scratch that, misread of the comment. addseg applies to DS/ES/SS.

> Why is it not OK to skip the addition
> of the base address for CS/DS/ES if it was specified by an
> override prefix rather than being the default for the insn?

This still applies though.

> It seems to me that we ought to try to get this code to a
> point where it looks more like:
>     if (ovr_seg < 0) {
>         ovr_seg = def_seg;
>     }
>     emit code to get address;
>     if (!segment_base_guaranteed_zero(s, ovr_seg)) {
>         emit code to add base to address;
>     }
>
> where segment_base_guaranteed_zero() is a helper
> function like:
> bool segment_base_guaranteed_zero(s, seg) {
>       /* Return true if we can guarantee at translate time that
>        * the base address of the specified segment is zero
>        * (and thus can skip emitting code to add it)
>        */
>       return (!s->addseg &&
>           (seg == R_CS || seg == R_DS || seg == R_SS));

s/R_CS/R_ES/;

> }

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]