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.