From d8f8c0faad5690bdd8033932482383acc508cf38 Mon Sep 17 00:00:00 2001 From: Galkov Date: Fri, 22 May 2009 10:35:21 +0000 Subject: [PATCH] change functionality of f68:15, f68:18 git-svn-id: svn://kolibrios.org@1075 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../open watcom/trunk/clib/fpu/fpe387.asm | 18 +++++++++++++----- .../open watcom/trunk/clib/fpu/fpeinth.asm | 17 +++++++++++++++-- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/programs/develop/open watcom/trunk/clib/fpu/fpe387.asm b/programs/develop/open watcom/trunk/clib/fpu/fpe387.asm index 531508d0aa..8a88394401 100644 --- a/programs/develop/open watcom/trunk/clib/fpu/fpe387.asm +++ b/programs/develop/open watcom/trunk/clib/fpu/fpe387.asm @@ -42,6 +42,7 @@ include mdef.inc datasegment Save87 dd 0 +OldMask dd 0 enddata @@ -56,13 +57,17 @@ defp __Init_FPE_handler push EAX ; save registers push EBX ; ... push ECX ; ... - + push EDX ; ... + mov EAX, 68 mov EBX, 15 + mov EDX, 10000h ; 1 shl 16 - #MF lea ECX, __FPE2Handler_ - int 40h ; set new #FPE handler + int 40h ; set new exception handler mov Save87, EAX ; save old handler + mov OldMask,EBX ; save old mask + pop EDX ; ... pop ECX ; ... pop EBX ; ... pop EAX ; ... @@ -78,6 +83,7 @@ defp __Fini_FPE_handler _endif ; endif push EAX ; save registers push EBX ; ... + ; ECX ???? push EDX ; ... sub ESP,4 ; allocate space for control word fstcw word ptr [ESP] ; get control word @@ -89,10 +95,12 @@ defp __Fini_FPE_handler mov EAX, 68 mov EBX, 15 - mov ECX, dword ptr Save87 - int 40h ; set new #FPE handler - + mov ECX, dword ptr Save87 ; restore handler + mov EDX, dword ptr OldMask ; restore mask + int 40h ; set new ecxeption handler + pop EDX ; ... + ; ECX ???? pop EBX ; ... pop EAX ; ... ret diff --git a/programs/develop/open watcom/trunk/clib/fpu/fpeinth.asm b/programs/develop/open watcom/trunk/clib/fpu/fpeinth.asm index 8b131f1720..c4c5ce38e3 100644 --- a/programs/develop/open watcom/trunk/clib/fpu/fpeinth.asm +++ b/programs/develop/open watcom/trunk/clib/fpu/fpeinth.asm @@ -60,7 +60,7 @@ xdefp __FPEHandler_ defp __FPEHandler_ public __FPE2Handler_ -__FPE2Handler_ label byte +__FPE2Handler_ label byte push EAX ; save regs push EBX ; ... @@ -71,6 +71,9 @@ __FPE2Handler_ label byte push EBP ; ... sub ESP,ENV_SIZE ; make room for environment information 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 fwait ; wait for 80x87 mov EDX,ENV_CW[EBP] ; get control word @@ -124,6 +127,15 @@ opcode: call GetInf ; - process divide by zero mov CL,FPE_ZERODIVIDE ; - indicate divide by zero _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 cmp CL,FPE_OK ; - check if exception allowed _quif e ; - quit if exception not allowed @@ -144,7 +156,8 @@ opcode: pop ECX ; ... pop EBX ; ... pop EAX ; ... - ret ; return from interrupt handler + ret 4 ; return from interrupt handler + ; with removing EXC_NUM endproc __FPEHandler_