qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: ~vilenka <vilen.kamalov@gmail.com>, qemu-devel@nongnu.org
Cc: philmd@linaro.org, pbonzini@redhat.com
Subject: Re: [PATCH qemu 1/1] target/i386: Fix gen_shift_rm_T1, wrong eflags calculation
Date: Thu, 23 Feb 2023 12:23:47 -1000	[thread overview]
Message-ID: <8ab70d13-c7c2-692d-9c3b-aba49181bf1e@linaro.org> (raw)
In-Reply-To: <167718710208.23058.11278141733696221981-1@git.sr.ht>

On 2/23/23 11:13, ~vilenka wrote:
> From: Vilen Kamalov <vilen.kamalov@gmail.com>
> 
> gen_shift_rm_T1 in the uses wrong tmp0 register, eflags calculation uses tmp4 at target/i386/tcg/translate.c, line 5488
> `tcg_gen_mov_tl(cpu_cc_src, s->tmp4);`
> 
> QEMU fails to pass int3 in next sample, vs real cpu
> -------------
> push rcx
> mov dword ptr [rsp], 010000000h
> mov rcx, 01eh
> sar dword ptr [rsp], cl
> jnc pass1
> int 3
> pass1:
> mov dword ptr [rsp], 0ffffffffh
> mov rcx, 01eh
> sar dword ptr [rsp], cl
> jc pass2
> int 3
> pass2:
> pop rcx
> -------------

Rewritten as a standalone test:

int main()
{
     unsigned m = 0x10000000;
     unsigned char c = 0x1e;

     m = 0x10000000u;
     asm volatile("sarl %1, %0; jnc 1f; ud2; 1:" : "+m"(m) : "c"(0x1e));

     m = 0xffffffffu;
     asm volatile("sarl %1, %0; jc 1f; ud2; 1:" : "+m"(m) : "c"(0x1e));

     return 0;
}

This test passes for me, for both qemu-i386 and qemu-x86_64.
So, I don't see your reported failure at all.


r~



      parent reply	other threads:[~2023-02-23 22:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-23 21:18 [PATCH qemu 0/1] [bugfix] gen_shift_rm_T1 uses wrong tmp0 register ~vilenka
2023-02-23 21:13 ` [PATCH qemu 1/1] target/i386: Fix gen_shift_rm_T1, wrong eflags calculation ~vilenka
2023-02-23 22:01   ` Richard Henderson
2023-02-23 22:13     ` Vilen Kamalov
2023-02-23 22:19       ` Vilen Kamalov
2023-02-23 22:23   ` Richard Henderson [this message]

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=8ab70d13-c7c2-692d-9c3b-aba49181bf1e@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vilen.kamalov@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).