change functionality of f68:15, f68:18

git-svn-id: svn://kolibrios.org@1075 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Galkov 2009-05-22 10:35:21 +00:00
parent 8d75380caf
commit d8f8c0faad
2 changed files with 28 additions and 7 deletions

View File

@ -42,6 +42,7 @@ include mdef.inc
datasegment datasegment
Save87 dd 0 Save87 dd 0
OldMask dd 0
enddata enddata
@ -56,13 +57,17 @@ defp __Init_FPE_handler
push EAX ; save registers push EAX ; save registers
push EBX ; ... push EBX ; ...
push ECX ; ... push ECX ; ...
push EDX ; ...
mov EAX, 68 mov EAX, 68
mov EBX, 15 mov EBX, 15
mov EDX, 10000h ; 1 shl 16 - #MF
lea ECX, __FPE2Handler_ lea ECX, __FPE2Handler_
int 40h ; set new #FPE handler int 40h ; set new exception handler
mov Save87, EAX ; save old handler mov Save87, EAX ; save old handler
mov OldMask,EBX ; save old mask
pop EDX ; ...
pop ECX ; ... pop ECX ; ...
pop EBX ; ... pop EBX ; ...
pop EAX ; ... pop EAX ; ...
@ -78,6 +83,7 @@ defp __Fini_FPE_handler
_endif ; endif _endif ; endif
push EAX ; save registers push EAX ; save registers
push EBX ; ... push EBX ; ...
; ECX ????
push EDX ; ... push EDX ; ...
sub ESP,4 ; allocate space for control word sub ESP,4 ; allocate space for control word
fstcw word ptr [ESP] ; get control word fstcw word ptr [ESP] ; get control word
@ -89,10 +95,12 @@ defp __Fini_FPE_handler
mov EAX, 68 mov EAX, 68
mov EBX, 15 mov EBX, 15
mov ECX, dword ptr Save87 mov ECX, dword ptr Save87 ; restore handler
int 40h ; set new #FPE handler mov EDX, dword ptr OldMask ; restore mask
int 40h ; set new ecxeption handler
pop EDX ; ... pop EDX ; ...
; ECX ????
pop EBX ; ... pop EBX ; ...
pop EAX ; ... pop EAX ; ...
ret ret

View File

@ -60,7 +60,7 @@ xdefp __FPEHandler_
defp __FPEHandler_ defp __FPEHandler_
public __FPE2Handler_ public __FPE2Handler_
__FPE2Handler_ label byte __FPE2Handler_ label byte
push EAX ; save regs push EAX ; save regs
push EBX ; ... push EBX ; ...
@ -71,6 +71,9 @@ __FPE2Handler_ label byte
push EBP ; ... push EBP ; ...
sub ESP,ENV_SIZE ; make room for environment information sub ESP,ENV_SIZE ; make room for environment information
mov EBP,ESP ; point to buffer for 80x87 environment mov EBP,ESP ; point to buffer for 80x87 environment
; Now EXC_NUM is located in [EBP+ENV_SIZE+32]
; but it isn't necessary to testing EXC_NUM,
; because only #MF is unmasked now
fnstenv [EBP] ; get 80x87 environment fnstenv [EBP] ; get 80x87 environment
fwait ; wait for 80x87 fwait ; wait for 80x87
mov EDX,ENV_CW[EBP] ; get control word mov EDX,ENV_CW[EBP] ; get control word
@ -124,6 +127,15 @@ opcode:
call GetInf ; - process divide by zero call GetInf ; - process divide by zero
mov CL,FPE_ZERODIVIDE ; - indicate divide by zero mov CL,FPE_ZERODIVIDE ; - indicate divide by zero
_endguess ; endguess _endguess ; endguess
; More correctly to rise this mask bit - is on end of __FPE_exception_
; but it may not returned at all...
push ECX
mov EAX, 68
mov EBX, 18 ;
mov ECX, 16 ; #MF
mov EDX, 1 ; rise activity
int 40h ; change state of signal activity
pop ECX
_guess ; guess exception to be handled _guess ; guess exception to be handled
cmp CL,FPE_OK ; - check if exception allowed cmp CL,FPE_OK ; - check if exception allowed
_quif e ; - quit if exception not allowed _quif e ; - quit if exception not allowed
@ -144,7 +156,8 @@ opcode:
pop ECX ; ... pop ECX ; ...
pop EBX ; ... pop EBX ; ...
pop EAX ; ... pop EAX ; ...
ret ; return from interrupt handler ret 4 ; return from interrupt handler
; with removing EXC_NUM
endproc __FPEHandler_ endproc __FPEHandler_