Better HN
topnewbestaskshowjobs
Log inSign up

emoemwin-asm

9 karma · joined Aug 7, 2023 (3y ago) · 1 submissions

Submissions

comment 3y ago · link · parent

The Microsoft code leak mentioned by one of the comments has been out there for years so might as well paste it here so cut down on some of the speculation? Fair use - commercial value is zero, historical value for analysis and criticism is high.

The relevant code comments seems to be

"Fix timing problem??"

and

"486 bug - must wait till after last "out f0" to clear fp exceptions or IGNNE# will be permanently active."

    public __fpIRQ13
    __fpIRQ13:
     cli
    
     WASTE_TIME  70
    
     push    ax
     xor     al, al
     NULL_JMP
     out     0f0h, al        ; reset busy line.
     NULL_JMP
     mov     al, 65h
     NULL_JMP
     out     0a0h, al        ; EOI slave irq 5
     NULL_JMP
     mov     al, 62h
     NULL_JMP
     out     20h, al         ; EOI master irq 2
     NULL_JMP
     pop     ax
    
    
     sub     sp, 2
    
     push    bp
     mov     bp, sp
    
     fnstsw  [bp+2]
     WASTE_TIME
     push    ax
     xor     al, al
     NULL_JMP
     out     0f0h, al        ; reset busy line.
     NULL_JMP
     pop     ax
    
     pop     bp
    
    ;       fnclex                  ; 486 bug - must wait till after last
        ; "out f0" to clear fp exceptions
        ; or IGNNE# will be permanently active.
     WASTE_TIME
     push    ax
     xor     al, al
     NULL_JMP
     out     0f0h, al        ; reset busy line.
     NULL_JMP
     pop     ax
    
    ;       fnclex                  ; 486 bug - must wait till after last
        ; "out f0" to clear fp exceptions
        ; or IGNNE# will be permanently active.
     WASTE_TIME
     push    ax
     xor     al, al
     NULL_JMP
     out     0f0h, al        ; reset busy line.
     NULL_JMP
     pop     ax
    
     fnclex                  ;Now this is safe.
     WASTE_TIME 70           ;Fix timing problem??
    
     jmp     __FPEXCEPTION87P