{"action":"created","issue":{"url":"https://api.github.com/repos/open-watcom/open-watcom-v2/issues/141","labels_url":"https://api.github.com/repos/open-watcom/open-watcom-v2/issues/141/labels{/name}","comments_url":"https://api.github.com/repos/open-watcom/open-watcom-v2/issues/141/comments","events_url":"https://api.github.com/repos/open-watcom/open-watcom-v2/issues/141/events","html_url":"https://github.com/open-watcom/open-watcom-v2/issues/141","id":59249709,"number":141,"title":"__x87id FPU detection routine locks up on 8088 without FPU","user":{"login":"Scalibq","id":11231506,"avatar_url":"https://avatars.githubusercontent.com/u/11231506?v=3","gravatar_id":"","url":"https://api.github.com/users/Scalibq","html_url":"https://github.com/Scalibq","followers_url":"https://api.github.com/users/Scalibq/followers","following_url":"https://api.github.com/users/Scalibq/following{/other_user}","gists_url":"https://api.github.com/users/Scalibq/gists{/gist_id}","starred_url":"https://api.github.com/users/Scalibq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Scalibq/subscriptions","organizations_url":"https://api.github.com/users/Scalibq/orgs","repos_url":"https://api.github.com/users/Scalibq/repos","events_url":"https://api.github.com/users/Scalibq/events{/privacy}","received_events_url":"https://api.github.com/users/Scalibq/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/open-watcom/open-watcom-v2/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-02-27T15:22:28Z","updated_at":"2015-03-03T09:25:35Z","closed_at":null,"body":"This code in the __x87id proc in ini87086.asm will lock up on an 8088 without\r\nFPU:\r\n        sub     AX,AX\r\n        push    AX                      ; allocate space for status word\r\n        finit                           ; use default infinity mode\r\n        fstcw   word ptr [BP-2]         ; save control word\r\n        fwait\r\n        pop     AX\r\n        mov     AL,0\r\n        cmp     AH,3\r\n        jnz     nox87\r\n\r\nThe reason is that the fwaits will wait forever for the FPU to clear the bus.\r\nInstead, I suggest this method to detect an FPU on all systems (based on an\r\nexample from Intel):\r\n        fninit\r\n        mov     AX,5A5Ah\r\n        push    AX\r\n        fnstsw  word ptr [BP-2]\r\n        pop     AX\r\n        cmp     AL, 0\r\n        mov     AL, 0\r\n        jnz     nox87\r\n\r\nThe fninit is a 'bare' finit, without a wait prefix.\r\nIf there is no 8087, it will just do nothing.\r\nThen the fnstsw will store the status word, if there is an 8087... Else it does\r\nnothing.\r\nAfter the finit, the status word should always be 0. So, if the value is now 0,\r\nwe have an FPU, else we don't."},"comment":{"url":"https://api.github.com/repos/open-watcom/open-watcom-v2/issues/comments/76912494","html_url":"https://github.com/open-watcom/open-watcom-v2/issues/141#issuecomment-76912494","issue_url":"https://api.github.com/repos/open-watcom/open-watcom-v2/issues/141","id":76912494,"user":{"login":"jmalak","id":2017260,"avatar_url":"https://avatars.githubusercontent.com/u/2017260?v=3","gravatar_id":"","url":"https://api.github.com/users/jmalak","html_url":"https://github.com/jmalak","followers_url":"https://api.github.com/users/jmalak/followers","following_url":"https://api.github.com/users/jmalak/following{/other_user}","gists_url":"https://api.github.com/users/jmalak/gists{/gist_id}","starred_url":"https://api.github.com/users/jmalak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmalak/subscriptions","organizations_url":"https://api.github.com/users/jmalak/orgs","repos_url":"https://api.github.com/users/jmalak/repos","events_url":"https://api.github.com/users/jmalak/events{/privacy}","received_events_url":"https://api.github.com/users/jmalak/received_events","type":"User","site_admin":false},"created_at":"2015-03-03T09:25:34Z","updated_at":"2015-03-03T09:25:34Z","body":"I changed it only for consistency even if fwait has no impact to this problem."}}