Warn if somebody used BSWAP with 16-bit opsize (behavior undefined)

This commit is contained in:
Stanislav Shwartsman 2006-05-07 20:56:40 +00:00
parent 91ada6c72c
commit b0e49a9a05

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bit.cc,v 1.28 2006-05-07 18:58:45 sshwarts Exp $
// $Id: bit.cc,v 1.29 2006-05-07 20:56:40 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -526,6 +526,10 @@ void BX_CPU_C::BSWAP_ERX(bxInstruction_c *i)
#if (BX_CPU_LEVEL >= 4) || (BX_CPU_LEVEL_HACKED >= 4)
Bit32u val32, b0, b1, b2, b3;
if (i->os32L() == 0) {
BX_ERROR(("BSWAP with 16-bit opsize: undefined behavior !"));
}
val32 = BX_READ_32BIT_REG(i->opcodeReg());
b0 = val32 & 0xff; val32 >>= 8;
b1 = val32 & 0xff; val32 >>= 8;