qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Chen Gang <chengang@emindsoft.com.cn>
Cc: qemu-devel@nongnu.org, Chen Gang <gang.chen.5i5j@gmail.com>,
	ehabkost@redhat.com, rth@twiddle.net
Subject: Re: [PATCH] target: i386: Check float overflow about register stack
Date: Mon, 24 Feb 2020 13:43:52 +0100	[thread overview]
Message-ID: <487e94c0-ccdf-2317-9ee2-6674aaed0aa8@redhat.com> (raw)
In-Reply-To: <22cf9eb4-7d48-5eb1-5d4e-38d83c0a3f40@emindsoft.com.cn>

On 22/02/20 13:25, Chen Gang wrote:
> On 2020/2/22 下午3:37, Paolo Bonzini wrote:
>> On 22/02/20 03:10, Chen Gang wrote:
>>> Set C1 to 1 if stack overflow occurred; set to 0 otherwise".
>>>
>>> In helper_fxam_ST0, I guess, we need "env->fpus |= 0x200" (but I don't
>>> know wheter it will be conflict with SIGND(temp)). And we have to still
>>> need foverflow, because all env->fptags being 0 doesn't mean overflow.
>>
>> No, you need to add "env->fpus |= 0x200" and "env->fpus &= ~0x200"
>> directly to fpush, fpop, etc.
>>
> 
> OK. The content below is my next TODO, welcome your opinions.
> 
> When overflow occurs, for me, we need keep everything no touch except
> set C1 flag.

No, push will overwrite the top entry if there is overflow.

> In fxam, we don't clear C1, but keep no touch for clearning
> C1 in another places.

FXAM is neither push nor pop, it just detects an empty slot via fptags.
 FXAM should be okay with my patch.

> When underflow occurs, for me, we need keep everything no touch except
> set env->fpstt 8, so the next consecutive fpop/f[i]stp* can be checked
> easier, and the next fpush/f[i]ld* can work well in normal.
> For fxam, we check env->fpstt == 8 and env->fptags for empty. And when
> env->fpstt is 8, it need be set 7 before used in fincstp and ffree_STN.

I don't think you need env->fpstt to be set to 8 in any case.  Also, pop
must mark ST(0) as empty always, even if underflow occurs, and also
clear C1 if underflow occurs.

Paolo



  reply	other threads:[~2020-02-24 12:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-21  3:45 [PATCH] target: i386: Check float overflow about register stack chengang
2020-02-21  8:58 ` Paolo Bonzini
2020-02-21 14:09   ` Chen Gang
2020-02-21 16:18     ` Paolo Bonzini
2020-02-22  2:10       ` Chen Gang
2020-02-22  2:27         ` Chen Gang
2020-02-22  7:37         ` Paolo Bonzini
2020-02-22 12:25           ` Chen Gang
2020-02-24 12:43             ` Paolo Bonzini [this message]
2020-02-25  1:22               ` Chen Gang

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=487e94c0-ccdf-2317-9ee2-6674aaed0aa8@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=chengang@emindsoft.com.cn \
    --cc=ehabkost@redhat.com \
    --cc=gang.chen.5i5j@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).