qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] target: i386: Check float overflow about register stack


From: Paolo Bonzini
Subject: Re: [PATCH] target: i386: Check float overflow about register stack
Date: Mon, 24 Feb 2020 13:43:52 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

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 via email to

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