Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly Language > Patching of a d...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 4993 of 5083
Post > Topic >>

Patching of a divide overflow error ?

by soSagtDieHex <soSagtDieHex@[EMAIL PROTECTED] > May 3, 2008 at 11:29 AM

I recently came across an old post in a forum
which is about an assembly patching of a 'divide overflow' error.

I quote

the program pcxdump.exe will NOT function properly on the faster CPUs
of today because of a 'divide overflow' error - but a

fairly simple patch can correct the 'divide overflow' error that
occurs when the TSR ****tion of the PCXDUMP program attempts

to go resident

here is the old PCXDUMP.EXE code which caused the problem:

; OLD CODE:  FILE OFFSET at byte: 0x982C  of the UNPACKED version of
PCXDUMP.EXE v 9.31
;**************************************************************************************
; This original code will cause an Intel 'divide overflow' error on
FAST CPUs...
:914C  B8 0000   mov ax,0
:914F  BA 0000   mov dx,0 ;DX start at ZERO too much for fast CPU
:9152  2E: C7 06 9184 0000  mov cs:[data_588],0  ;(0001:9184=0)
:9159                       loc_821:         ; xref 0001:9166
:9159  40                    inc     ax
:915A  3D 0000               cmp     ax,0
:915D  75 01     jne   short loc_822  ;Jump if not equal
:915F  42        inc  dx   ; the DX ****tion of DX:AX too BIG!
:9160                       loc_822:        ; xref 0001:915D
:9160  2E: 83 3E 9184 09  cmp cs:[data_588],9  ;(0001:9184=0)
:9166  72 F1                jb    loc_821     ;Jump if below
;*****************************************************************************************

Code Patch for today's FASTER Intel/AMD CPUs:

; NEW CODE:  FILE OFFSET at byte: 0x982C  of the UNPACKED version of
PCXDUMP.EXE v 9.31
;***************************************************************************************
;  Below is new Patch to prevent DIVIDE OVERFLOW with a Timer Counter
on FAST CPUs...
:914C  31 C0          xor     ax, ax
:914E  31 D2          xor     dx, dx
:9150  2E A3 9184     mov     cs:[data_588], ax
:9154                 loc_821:
:9154  40             inc     ax
:9155  3D 0000        cmp     ax, 0
:9158  75 01          jne     short loc_822
:915A  42             inc     dx
:915B                 loc_822:
:915B  2E: 83 3E 9184 09     cmp     cs:[data_588], 09
:9161  72 F1          jb      loc_821
:9163  81 E2 09C3  and dx, 09C3h ;prevent DIVIDE OVERFLOW in DX
:9167  90             nop
;*******************************************************************************************

Now, I'm afraid I don't get in what way
and dx, 09C3h
should make the trick.
Actually, I don't even see where the overflow should come from in the
original unpatched code...

Can someone help me ?
Are those snippets meaningful to you ?
If you wish, I can post the link to that post
(http://vogons.zetafleet.com/viewtopic.php?t=12246)

Thx for reading.
 




 6 Posts in Topic:
Patching of a divide overflow error ?
soSagtDieHex <soSagtDi  2008-05-03 11:29:54 
Re: Patching of a divide overflow error ?
"Wolfgang Kern"  2008-05-04 11:28:01 
Re: Patching of a divide overflow error ?
"rio" <a@[EM  2008-05-04 20:45:05 
Re: Patching of a divide overflow error ?
"Wolfgang Kern"  2008-05-05 11:38:49 
Re: Patching of a divide overflow error ?
soSagtDieHex <soSagtDi  2008-05-04 05:18:21 
Re: Patching of a divide overflow error ?
"Wolfgang Kern"  2008-05-04 14:54:18 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 19:46:44 CDT 2008.