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: Chen Gang
Subject: Re: [PATCH] target: i386: Check float overflow about register stack
Date: Sat, 22 Feb 2020 10:27:45 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

On 2020/2/22 上午10:10, Chen Gang wrote:
> On 2020/2/22 上午12:18, Paolo Bonzini wrote:
>> On 21/02/20 15:09, Chen Gang wrote:
>>>> -    /* XXX: test fptags too */
>>>> +    if (env->fptags[env->fpstt]) {
>>>> +        env->fpus |= 0x4100; /* Empty */
>>>> +        return;
>>>> +    }
>>>> +
>>> For fpop overflow, this fix is enough, but for me, we still need
>>> foverflow to check fpush/fld*_ST0 overflow.
>>>
>>> Don't you think we need check fpush/f[i]ld*_ST0 overflow?
>>
>> After fld/fild or any other push, FXAM ST0 should not return empty in my
>> opinion.
>>
> 
> OK, it sounds reasonable.
> 
> After check the intel document for f[i]ld* instructions, it says:
> 
>   "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.
> 

After read the document more about fstp* and fld* instructions, I find
that fstp* are also related with C1, and fld* will generate IS exception
when stack underflow or overflow occurred.

It seems more modifications should be done (but they will be several
patches).

Thanks.





reply via email to

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