3 ms·
This is the Intel recommended exception handler: • Store the NPX environment (control, status, and tag words, operand and instruction pointers) as it existed a
by projektfu 3y ago
This is the Intel recommended exception handler:
• Store the NPX environment (control, status, and tag words, operand and instruction pointers) as it existed at the time of the exception.
• Clear the exception bits in the status word.
• Enable interrupts on the CPU.
• Identify the exception by examining the status and control words in the save environment.
• Take some system-dependent action to rectify the exception.
• Return to the interrupted program and resume normal execution.
and one of the examples for writing the handler is this:
SAVE_ENVIRONMENT PROC
;
; SAVE CPU REGISTERS, ALLOCATE STACK SPACE FOR 80287 ENVIRONMENT
PUSH BP
MOV BP,SP
SUB SP, 14
; SAVE ENVIRONMENT, WAIT FOR COMPLETION,
; ENABLE CPU INTERRUPTS
FNSTENV [BP-14]
FWAIT
STI
;
; APPLICATION EXCEPTION-HANDLING CODE GOES HERE
;
; CLEAR EXCEPTION FLAGS IN STATUS WORD
; RESTORE MODIFIED
; ENVIRONMENT IMAGE
MOV BYTE PTR [BP-12] , 0H
FLDENV [BP-14]
; DE-ALLOCATE STACK SPACE, RESTORE CPU REGISTERS
MOV SP,BP
POP BP
;
; RETURN TO INTERRUPTED CALCULATION
IRET
SAVE_ENVIRONMENT ENDP
Make of that as you like. I am somewhat curious about what happened here.