make displ field of instruction signed

This commit is contained in:
Stanislav Shwartsman 2009-01-12 20:14:37 +00:00
parent 93dd7bfccf
commit da511513b3
3 changed files with 19 additions and 19 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: instr.h,v 1.18 2008-10-10 20:49:16 sshwarts Exp $
// $Id: instr.h,v 1.19 2009-01-12 20:14:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2008 Stanislav Shwartsman
@ -173,8 +173,8 @@ public:
BX_CPP_INLINE unsigned sibBase() const {
return metaData[BX_INSTR_METADATA_BASE];
}
BX_CPP_INLINE Bit32u displ32u() const { return modRMForm.displ32u; }
BX_CPP_INLINE Bit16u displ16u() const { return modRMForm.displ16u; }
BX_CPP_INLINE Bit32s displ32s() const { return (Bit32s) modRMForm.displ32u; }
BX_CPP_INLINE Bit16s displ16s() const { return (Bit16s) modRMForm.displ16u; }
BX_CPP_INLINE Bit32u Id() const { return modRMForm.Id; }
BX_CPP_INLINE Bit16u Iw() const { return modRMForm.Iw; }
BX_CPP_INLINE Bit8u Ib() const { return modRMForm.Ib; }

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: load32.cc,v 1.3 2008-12-11 21:19:38 sshwarts Exp $
// $Id: load32.cc,v 1.4 2009-01-12 20:14:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2008 Stanislav Shwartsman
@ -35,7 +35,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Eb(bxInstruction_c *i)
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Eb_Resolve16BaseIndex(bxInstruction_c *i)
{
Bit16u offset = BX_READ_16BIT_REG(i->sibBase()) + BX_READ_16BIT_REG(i->sibIndex()) + (Bit16s) i->displ16u();
Bit16u offset = BX_READ_16BIT_REG(i->sibBase()) + BX_READ_16BIT_REG(i->sibIndex()) + i->displ16s();
Bit32u laddr;
unsigned s = i->seg();
@ -82,7 +82,7 @@ accessOK:
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Eb_Resolve32Base(bxInstruction_c *i)
{
Bit32u offset = BX_READ_32BIT_REG(i->sibBase()) + (Bit32s) i->displ32u();
Bit32u offset = BX_READ_32BIT_REG(i->sibBase()) + i->displ32s();
Bit32u laddr;
unsigned s = i->seg();
@ -129,7 +129,7 @@ accessOK:
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Eb_Resolve32BaseIndex(bxInstruction_c *i)
{
Bit32u offset = BX_READ_32BIT_REG(i->sibBase()) + (BX_READ_32BIT_REG(i->sibIndex()) << i->sibScale()) + (Bit32s) i->displ32u();
Bit32u offset = BX_READ_32BIT_REG(i->sibBase()) + (BX_READ_32BIT_REG(i->sibIndex()) << i->sibScale()) + i->displ32s();
Bit32u laddr;
unsigned s = i->seg();
@ -183,7 +183,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ew(bxInstruction_c *i)
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ew_Resolve16BaseIndex(bxInstruction_c *i)
{
Bit16u offset = BX_READ_16BIT_REG(i->sibBase()) + BX_READ_16BIT_REG(i->sibIndex()) + (Bit16s) i->displ16u();
Bit16u offset = BX_READ_16BIT_REG(i->sibBase()) + BX_READ_16BIT_REG(i->sibIndex()) + i->displ16s();
Bit32u laddr;
unsigned s = i->seg();
@ -230,7 +230,7 @@ accessOK:
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ew_Resolve32Base(bxInstruction_c *i)
{
Bit32u offset = BX_READ_32BIT_REG(i->sibBase()) + (Bit32s) i->displ32u();
Bit32u offset = BX_READ_32BIT_REG(i->sibBase()) + i->displ32s();
Bit32u laddr;
unsigned s = i->seg();
@ -277,7 +277,7 @@ accessOK:
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ew_Resolve32BaseIndex(bxInstruction_c *i)
{
Bit32u offset = BX_READ_32BIT_REG(i->sibBase()) + (BX_READ_32BIT_REG(i->sibIndex()) << i->sibScale()) + (Bit32s) i->displ32u();
Bit32u offset = BX_READ_32BIT_REG(i->sibBase()) + (BX_READ_32BIT_REG(i->sibIndex()) << i->sibScale()) + i->displ32s();
Bit32u laddr;
unsigned s = i->seg();
@ -331,7 +331,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ed(bxInstruction_c *i)
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ed_Resolve16BaseIndex(bxInstruction_c *i)
{
Bit16u offset = BX_READ_16BIT_REG(i->sibBase()) + BX_READ_16BIT_REG(i->sibIndex()) + (Bit16s) i->displ16u();
Bit16u offset = BX_READ_16BIT_REG(i->sibBase()) + BX_READ_16BIT_REG(i->sibIndex()) + i->displ16s();
Bit32u laddr;
unsigned s = i->seg();
@ -378,7 +378,7 @@ accessOK:
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ed_Resolve32Base(bxInstruction_c *i)
{
Bit32u offset = BX_READ_32BIT_REG(i->sibBase()) + (Bit32s) i->displ32u();
Bit32u offset = BX_READ_32BIT_REG(i->sibBase()) + i->displ32s();
Bit32u laddr;
unsigned s = i->seg();
@ -425,7 +425,7 @@ accessOK:
void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ed_Resolve32BaseIndex(bxInstruction_c *i)
{
Bit32u offset = BX_READ_32BIT_REG(i->sibBase()) + (BX_READ_32BIT_REG(i->sibIndex()) << i->sibScale()) + (Bit32s) i->displ32u();
Bit32u offset = BX_READ_32BIT_REG(i->sibBase()) + (BX_READ_32BIT_REG(i->sibIndex()) << i->sibScale()) + i->displ32s();
Bit32u laddr;
unsigned s = i->seg();

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: resolver.cc,v 1.1 2008-10-07 07:47:56 akrisak Exp $
// $Id: resolver.cc,v 1.2 2009-01-12 20:14:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2008 Stanislav Shwartsman
@ -33,7 +33,7 @@
bx_address BX_CPP_AttrRegparmN(1)
BX_CPU_C::BxResolve16BaseIndex(bxInstruction_c *i)
{
return (Bit16u) (BX_READ_16BIT_REG(i->sibBase()) + BX_READ_16BIT_REG(i->sibIndex()) + (Bit16s) i->displ16u());
return (Bit16u) (BX_READ_16BIT_REG(i->sibBase()) + BX_READ_16BIT_REG(i->sibIndex()) + i->displ16s());
}
//
@ -43,12 +43,12 @@ BX_CPU_C::BxResolve16BaseIndex(bxInstruction_c *i)
bx_address BX_CPP_AttrRegparmN(1)
BX_CPU_C::BxResolve32Base(bxInstruction_c *i)
{
return (Bit32u) (BX_READ_32BIT_REG(i->sibBase()) + (Bit32s) i->displ32u());
return (Bit32u) (BX_READ_32BIT_REG(i->sibBase()) + i->displ32s());
}
bx_address BX_CPP_AttrRegparmN(1)
BX_CPU_C::BxResolve32BaseIndex(bxInstruction_c *i)
{
return (Bit32u) (BX_READ_32BIT_REG(i->sibBase()) + (BX_READ_32BIT_REG(i->sibIndex()) << i->sibScale()) + (Bit32s) i->displ32u());
return (Bit32u) (BX_READ_32BIT_REG(i->sibBase()) + (BX_READ_32BIT_REG(i->sibIndex()) << i->sibScale()) + i->displ32s());
}
//
@ -59,11 +59,11 @@ BX_CPU_C::BxResolve32BaseIndex(bxInstruction_c *i)
bx_address BX_CPP_AttrRegparmN(1)
BX_CPU_C::BxResolve64Base(bxInstruction_c *i)
{
return BX_READ_64BIT_REG(i->sibBase()) + (Bit32s) i->displ32u();
return BX_READ_64BIT_REG(i->sibBase()) + i->displ32s();
}
bx_address BX_CPP_AttrRegparmN(1)
BX_CPU_C::BxResolve64BaseIndex(bxInstruction_c *i)
{
return BX_READ_64BIT_REG(i->sibBase()) + (BX_READ_64BIT_REG(i->sibIndex()) << i->sibScale()) + (Bit32s) i->displ32u();
return BX_READ_64BIT_REG(i->sibBase()) + (BX_READ_64BIT_REG(i->sibIndex()) << i->sibScale()) + i->displ32s();
}
#endif