kdq@demott.COM (Kevin D. Quitt) (03/13/90)
I recently posted about a problem I had involving some old utilities based on MetaWare's library. These programs worked on 8088,6,Vxx, and 286 machines, but crashed on certain 386 based machines. I received some information about what might have been the cause - which after mush chasing my tail, turned out to be correct. I would like to credit where it's due, but I've lost the gentleman's information (sorry). Originally the problem seemed to be related to clones. Compaqs and other top machines were able to run the programs, but as it turns out, there is a 1:1 correlation between machines that have 387s and those that will run the programs. The better machines were also unable to run the programs when the 387s were pulled. In any case, the problem code is listed below (generated by sourcer). The program crashes at the fldcw instruction. I have my patch now - I just don't call the subroutine (since the utilities do no math). But the question remains: why does this hang the 386, and not any of the other processors? 0079 DB E3 fninit ; Initialize math uP 007B 33 C0 xor ax,ax 007D A3 001E mov data_134,ax 0080 B1 0F mov cl,0Fh 0082 D3 E8 shr ax,cl ; Shift w/zeros fill 0084 D9 3E 001E fnstcw data_134 ; Store control word 0088 D3 E8 shr ax,cl 008A D3 E8 shr ax,cl 008C 0B 06 001E or ax,data_134 ; (82B3:001E=0) 0090 74 0E jz short loc_1021 0092 9B- 2E: D9 2E 00A4 fldcw cs:data_256 ; (=3FFh) Load control word 0098 C7 06 001E 0001 mov data_134,1 009E EB 03 jmp short loc_ret_1022 loc_1021: 00A0 A3 001E mov data_134,ax loc_ret_1022: 00A3 C3 retn data_256: 00A4 03FF dw 3FFh ; xref 0094 -- Kevin D. Quitt Manager, Software Development DeMott Electronics Co. VOICE (818) 988-4975 14707 Keswick St. FAX (818) 997-1190 Van Nuys, CA 91405-1266 MODEM (818) 997-4496 Telebit PEP last 34 12 N 118 27 W srhqla!demott!kdq kdq@demott.com "Next time, Jack, write a God-damned memo!" - Jack Ryan