- Timestamp:
- Jul 5, 2013 8:00:06 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 87007
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllAImpl.asm
r46958 r46992 1331 1331 PROLOGUE_3_ARGS 1332 1332 1333 ; div by chainsaw check. 1333 1334 test A1_8, A1_8 1334 1335 jz .div_zero 1336 1337 ; Overflow check - unsigned division is simple to verify, haven't 1338 ; found a simple way to check signed division yet unfortunately. 1335 1339 %if %4 == 0 1336 1340 cmp [A0 + 1], A1_8 1337 1341 jae .div_overflow 1338 1342 %else 1339 ; js .divisor_negative 1340 ;.divisor_positive: 1341 ; mov ax, [A0] 1342 ; test ax, ax 1343 ; js .divisor_positive_dividend_negative 1344 ; 1345 ;.both_positive: 1346 ; shl ax, 1 1347 ; cmp ah, A1_8 1348 ; jae .div_overflow 1349 ; jmp .div_no_overflow 1350 ;.both_negative: 1351 ; neg ax 1352 ; shl ax, 1 1353 ; mov al, A1_8 1354 ; neg al 1355 ; cmp ah, al 1356 ; jae .div_overflow 1357 ; jmp .div_no_overflow 1358 ; 1359 ;.divisor_positive_dividend_negative: 1360 ; jmp .div_no_overflow 1361 ;.divisor_negative: 1362 ; test ax, ax 1363 ; js .both_negative 1364 ;.divisor_negative_dividend_positive: 1365 ; jmp .div_no_overflow 1366 ;.div_no_overflow: 1343 mov T0_16, [A0] ; T0 = dividend 1344 mov T1_8, A1_8 ; T1 = divisor 1345 test T1_16, T1_16 1346 js .divisor_negative 1347 test T0_16, T0_16 1348 jns .both_positive 1349 neg T0_16 1350 .one_of_each: ; OK range is 2^(result-with - 1) + (divisor - 1). 1351 push T0 ; Start off like unsigned below. 1352 shr T0_16, 7 1353 cmp T0_8, T1_8 1354 pop T0 1355 jb .div_no_overflow 1356 ja .div_overflow 1357 and T0_8, 0x7f ; Special case for covering (divisor - 1). 1358 cmp T0_8, T1_8 1359 jae .div_overflow 1360 jmp .div_no_overflow 1361 1362 .divisor_negative: 1363 neg T1_8 1364 test T0_16, T0_16 1365 jns .one_of_each 1366 neg T0_16 1367 .both_positive: ; Same as unsigned shifted by sign indicator bit. 1368 shr T0_16, 7 1369 cmp T0_8, T1_8 1370 jae .div_overflow 1371 .div_no_overflow: 1367 1372 %endif 1368 1373
Note:
See TracChangeset
for help on using the changeset viewer.