- fix bug reported by Thomas Weidner [ 877510 ] amd64 fixes...

This commit is contained in:
Christophe Bothamy 2004-04-28 19:57:37 +00:00
parent 9d74ea2d63
commit f4dbefad66

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: string.cc,v 1.21 2002-10-24 21:05:55 bdenney Exp $ // $Id: string.cc,v 1.22 2004-04-28 19:57:37 cbothamy Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -150,7 +150,7 @@ BX_CPU_C::MOVSB_XbYb(bxInstruction_c *i)
if (byteCount) { if (byteCount) {
Bit32u bytesFitSrc, bytesFitDst; Bit32u bytesFitSrc, bytesFitDst;
Bit8u *hostAddrSrc, *hostAddrDst; Bit8u *hostAddrSrc, *hostAddrDst;
unsigned pointerDelta; signed int pointerDelta;
bx_segment_reg_t *srcSegPtr, *dstSegPtr; bx_segment_reg_t *srcSegPtr, *dstSegPtr;
bx_address laddrDst, laddrSrc; bx_address laddrDst, laddrSrc;
Bit32u paddrDst, paddrSrc; Bit32u paddrDst, paddrSrc;
@ -198,13 +198,13 @@ BX_CPU_C::MOVSB_XbYb(bxInstruction_c *i)
// Counting downward. // Counting downward.
bytesFitSrc = 1 + (paddrSrc & 0xfff); bytesFitSrc = 1 + (paddrSrc & 0xfff);
bytesFitDst = 1 + (paddrDst & 0xfff); bytesFitDst = 1 + (paddrDst & 0xfff);
pointerDelta = (unsigned) -1; pointerDelta = (signed int) -1;
} }
else { else {
// Counting upward. // Counting upward.
bytesFitSrc = (0x1000 - (paddrSrc & 0xfff)); bytesFitSrc = (0x1000 - (paddrSrc & 0xfff));
bytesFitDst = (0x1000 - (paddrDst & 0xfff)); bytesFitDst = (0x1000 - (paddrDst & 0xfff));
pointerDelta = 1; pointerDelta = (signed int) 1;
} }
// Restrict count to the number that will fit in either // Restrict count to the number that will fit in either
// source or dest pages. // source or dest pages.
@ -462,7 +462,7 @@ BX_CPU_C::MOVSW_XvYv(bxInstruction_c *i)
if (dwordCount) { if (dwordCount) {
Bit32u dwordsFitSrc, dwordsFitDst; Bit32u dwordsFitSrc, dwordsFitDst;
Bit8u *hostAddrSrc, *hostAddrDst; Bit8u *hostAddrSrc, *hostAddrDst;
unsigned pointerDelta; signed int pointerDelta;
bx_segment_reg_t *srcSegPtr, *dstSegPtr; bx_segment_reg_t *srcSegPtr, *dstSegPtr;
bx_address laddrDst, laddrSrc; bx_address laddrDst, laddrSrc;
Bit32u paddrDst, paddrSrc; Bit32u paddrDst, paddrSrc;
@ -514,13 +514,13 @@ BX_CPU_C::MOVSW_XvYv(bxInstruction_c *i)
goto noAcceleration32; goto noAcceleration32;
dwordsFitSrc = (4 + (paddrSrc & 0xfff)) >> 2; dwordsFitSrc = (4 + (paddrSrc & 0xfff)) >> 2;
dwordsFitDst = (4 + (paddrDst & 0xfff)) >> 2; dwordsFitDst = (4 + (paddrDst & 0xfff)) >> 2;
pointerDelta = (unsigned) -4; pointerDelta = (signed int) -4;
} }
else { else {
// Counting upward. // Counting upward.
dwordsFitSrc = (0x1000 - (paddrSrc & 0xfff)) >> 2; dwordsFitSrc = (0x1000 - (paddrSrc & 0xfff)) >> 2;
dwordsFitDst = (0x1000 - (paddrDst & 0xfff)) >> 2; dwordsFitDst = (0x1000 - (paddrDst & 0xfff)) >> 2;
pointerDelta = 4; pointerDelta = (signed int) 4;
} }
// Restrict dword count to the number that will fit in either // Restrict dword count to the number that will fit in either
// source or dest pages. // source or dest pages.
@ -720,7 +720,7 @@ doIncr32:
if (wordCount) { if (wordCount) {
Bit32u wordsFitSrc, wordsFitDst; Bit32u wordsFitSrc, wordsFitDst;
Bit8u *hostAddrSrc, *hostAddrDst; Bit8u *hostAddrSrc, *hostAddrDst;
unsigned pointerDelta; signed int pointerDelta;
bx_segment_reg_t *srcSegPtr, *dstSegPtr; bx_segment_reg_t *srcSegPtr, *dstSegPtr;
bx_address laddrDst, laddrSrc; bx_address laddrDst, laddrSrc;
Bit32u paddrDst, paddrSrc; Bit32u paddrDst, paddrSrc;
@ -772,13 +772,13 @@ doIncr32:
goto noAcceleration16; goto noAcceleration16;
wordsFitSrc = (2 + (paddrSrc & 0xfff)) >> 1; wordsFitSrc = (2 + (paddrSrc & 0xfff)) >> 1;
wordsFitDst = (2 + (paddrDst & 0xfff)) >> 1; wordsFitDst = (2 + (paddrDst & 0xfff)) >> 1;
pointerDelta = (unsigned) -2; pointerDelta = (signed int) -2;
} }
else { else {
// Counting upward. // Counting upward.
wordsFitSrc = (0x1000 - (paddrSrc & 0xfff)) >> 1; wordsFitSrc = (0x1000 - (paddrSrc & 0xfff)) >> 1;
wordsFitDst = (0x1000 - (paddrDst & 0xfff)) >> 1; wordsFitDst = (0x1000 - (paddrDst & 0xfff)) >> 1;
pointerDelta = 2; pointerDelta = (signed int) 2;
} }
// Restrict word count to the number that will fit in either // Restrict word count to the number that will fit in either
// source or dest pages. // source or dest pages.
@ -1659,7 +1659,7 @@ BX_CPU_C::STOSB_YbAL(bxInstruction_c *i)
if (byteCount) { if (byteCount) {
Bit32u bytesFitDst; Bit32u bytesFitDst;
Bit8u *hostAddrDst; Bit8u *hostAddrDst;
unsigned pointerDelta; signed int pointerDelta;
bx_segment_reg_t *dstSegPtr; bx_segment_reg_t *dstSegPtr;
bx_address laddrDst; bx_address laddrDst;
Bit32u paddrDst; Bit32u paddrDst;
@ -1691,12 +1691,12 @@ BX_CPU_C::STOSB_YbAL(bxInstruction_c *i)
if (BX_CPU_THIS_PTR get_DF ()) { if (BX_CPU_THIS_PTR get_DF ()) {
// Counting downward. // Counting downward.
bytesFitDst = 1 + (paddrDst & 0xfff); bytesFitDst = 1 + (paddrDst & 0xfff);
pointerDelta = (unsigned) -1; pointerDelta = (signed int) -1;
} }
else { else {
// Counting upward. // Counting upward.
bytesFitDst = (0x1000 - (paddrDst & 0xfff)); bytesFitDst = (0x1000 - (paddrDst & 0xfff));
pointerDelta = 1; pointerDelta = (signed int) 1;
} }
// Restrict count to the number that will fit in either // Restrict count to the number that will fit in either
// source or dest pages. // source or dest pages.