All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Chipounov <vitaly.chipounov@epfl.ch>
To: Max Filippov <jcmvbkbc@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] x86: Fixed incorrect segment base address addition
Date: Tue, 03 Jul 2012 00:09:13 +0200	[thread overview]
Message-ID: <4FF21C09.5090005@epfl.ch> (raw)
In-Reply-To: <CAMo8BfL2d+eR4Sq0x76Dr9o_A-gNzrOt+FEj2mq+S3yz5bBxyQ@mail.gmail.com>

Max,

On 02.07.2012 17:18, Max Filippov wrote:
> On Mon, Jul 2, 2012 at 2:29 PM, Vitaly Chipounov
> <vitaly.chipounov@epfl.ch> wrote:
>> An instruction with address and segment size override triggers the bug.
>> inc dword ptr gs:260h[ebx*4] gets incorrectly translated to:
>> (uint32_t)(gs.base + ebx * 4 + 0x260)
>> instead of
>> gs.base + (uint32_t)(ebx * 4 + 0x260)
> Do I understand it right that this fixes address calculation for
> 64-bit mode but breaks it for compatibility mode?

You are right, it indeed breaks compatibility mode. Thanks for the
reference from the Intel manual.

I will send an updated patch.

Vitaly

>> Signed-off-by: Vitaly Chipounov <vitaly.chipounov@epfl.ch>
>> ---
>>  target-i386/translate.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/target-i386/translate.c b/target-i386/translate.c
>> index a902f4a..9ca7375 100644
>> --- a/target-i386/translate.c
>> +++ b/target-i386/translate.c
>> @@ -459,10 +459,10 @@ static inline void gen_op_movl_A0_seg(int reg)
>>  static inline void gen_op_addl_A0_seg(int reg)
>>  {
>>      tcg_gen_ld_tl(cpu_tmp0, cpu_env, offsetof(CPUX86State, segs[reg].base));
>> -    tcg_gen_add_tl(cpu_A0, cpu_A0, cpu_tmp0);
>>  #ifdef TARGET_X86_64
>>      tcg_gen_andi_tl(cpu_A0, cpu_A0, 0xffffffff);
>>  #endif
>> +    tcg_gen_add_tl(cpu_A0, cpu_A0, cpu_tmp0);
>>  }
>>
>>  #ifdef TARGET_X86_64
>> --
>> 1.7.4.1
>>
>>
>
>

  reply	other threads:[~2012-07-02 22:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-02 10:29 [Qemu-devel] [PATCH] x86: Fixed incorrect segment base address addition Vitaly Chipounov
2012-07-02 15:18 ` Max Filippov
2012-07-02 22:09   ` Vitaly Chipounov [this message]
2012-07-02 22:20   ` [Qemu-devel] [PATCH v2] x86: Fixed incorrect segment base address addition in 64-bits mode Vitaly Chipounov
2012-07-03 12:52     ` Max Filippov
2012-07-29  9:38     ` Blue Swirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FF21C09.5090005@epfl.ch \
    --to=vitaly.chipounov@epfl.ch \
    --cc=jcmvbkbc@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.