2008-09-16 23:20:03 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2011-02-25 00:54:04 +03:00
|
|
|
// $Id$
|
2008-09-16 23:20:03 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2010-12-24 11:35:00 +03:00
|
|
|
// Copyright (c) 2008-2011 Stanislav Shwartsman
|
2008-09-16 23:20:03 +04:00
|
|
|
// Written by Stanislav Shwartsman [sshwarts at sourceforge net]
|
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
2009-01-16 21:18:59 +03:00
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA B 02110-1301 USA
|
2008-09-16 23:20:03 +04:00
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#define NEED_CPU_REG_SHORTCUTS 1
|
|
|
|
#include "bochs.h"
|
|
|
|
#include "cpu.h"
|
|
|
|
#define LOG_THIS BX_CPU_THIS_PTR
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Eb(bxInstruction_c *i)
|
2008-09-16 23:20:03 +04:00
|
|
|
{
|
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
|
|
|
TMP8L = read_virtual_byte(i->seg(), eaddr);
|
2011-07-07 00:01:18 +04:00
|
|
|
return BX_CPU_CALL_METHOD(i->execute2, (i));
|
2008-09-16 23:20:03 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ew(bxInstruction_c *i)
|
2008-09-16 23:20:03 +04:00
|
|
|
{
|
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
|
|
|
TMP16 = read_virtual_word(i->seg(), eaddr);
|
2011-07-07 00:01:18 +04:00
|
|
|
return BX_CPU_CALL_METHOD(i->execute2, (i));
|
2008-09-16 23:20:03 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ed(bxInstruction_c *i)
|
2008-09-16 23:20:03 +04:00
|
|
|
{
|
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
|
|
|
TMP32 = read_virtual_dword(i->seg(), eaddr);
|
2011-07-07 00:01:18 +04:00
|
|
|
return BX_CPU_CALL_METHOD(i->execute2, (i));
|
2008-09-16 23:20:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#if BX_SUPPORT_X86_64
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Eq(bxInstruction_c *i)
|
2008-09-16 23:20:03 +04:00
|
|
|
{
|
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
|
|
|
TMP64 = read_virtual_qword_64(i->seg(), eaddr);
|
2011-07-07 00:01:18 +04:00
|
|
|
return BX_CPU_CALL_METHOD(i->execute2, (i));
|
2008-09-16 23:20:03 +04:00
|
|
|
}
|
|
|
|
#endif
|
2010-12-23 00:16:02 +03:00
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ww(bxInstruction_c *i)
|
2010-12-25 22:34:43 +03:00
|
|
|
{
|
|
|
|
#if BX_CPU_LEVEL >= 6
|
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
|
|
|
Bit16u val_16 = read_virtual_word(i->seg(), eaddr);
|
|
|
|
BX_WRITE_XMM_REG_LO_WORD(BX_TMP_REGISTER, val_16);
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
return BX_CPU_CALL_METHOD(i->execute2, (i));
|
2010-12-25 22:34:43 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Wss(bxInstruction_c *i)
|
2010-12-23 00:16:02 +03:00
|
|
|
{
|
2010-12-25 18:00:20 +03:00
|
|
|
#if BX_CPU_LEVEL >= 6
|
2010-12-23 00:16:02 +03:00
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
|
|
|
Bit32u val_32 = read_virtual_dword(i->seg(), eaddr);
|
|
|
|
BX_WRITE_XMM_REG_LO_DWORD(BX_TMP_REGISTER, val_32);
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
return BX_CPU_CALL_METHOD(i->execute2, (i));
|
2010-12-25 18:00:20 +03:00
|
|
|
#endif
|
2010-12-23 00:16:02 +03:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Wsd(bxInstruction_c *i)
|
2010-12-23 00:16:02 +03:00
|
|
|
{
|
2010-12-25 18:00:20 +03:00
|
|
|
#if BX_CPU_LEVEL >= 6
|
2010-12-23 00:16:02 +03:00
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
|
|
|
Bit64u val_64 = read_virtual_qword(i->seg(), eaddr);
|
|
|
|
BX_WRITE_XMM_REG_LO_QWORD(BX_TMP_REGISTER, val_64);
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
return BX_CPU_CALL_METHOD(i->execute2, (i));
|
2010-12-25 18:00:20 +03:00
|
|
|
#endif
|
2010-12-23 00:16:02 +03:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Wdq(bxInstruction_c *i)
|
2010-12-23 00:16:02 +03:00
|
|
|
{
|
2010-12-25 18:00:20 +03:00
|
|
|
#if BX_CPU_LEVEL >= 6
|
2010-12-23 00:16:02 +03:00
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2010-12-23 00:24:19 +03:00
|
|
|
|
2011-01-12 23:16:25 +03:00
|
|
|
#if BX_SUPPORT_MISALIGNED_SSE
|
|
|
|
if (BX_CPU_THIS_PTR mxcsr.get_MM())
|
2011-03-19 23:09:34 +03:00
|
|
|
read_virtual_dqword(i->seg(), eaddr, &BX_READ_XMM_REG(BX_TMP_REGISTER));
|
2011-01-12 23:16:25 +03:00
|
|
|
else
|
|
|
|
#endif
|
2011-03-19 23:09:34 +03:00
|
|
|
read_virtual_dqword_aligned(i->seg(), eaddr, &BX_READ_XMM_REG(BX_TMP_REGISTER));
|
2010-12-23 00:16:02 +03:00
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
return BX_CPU_CALL_METHOD(i->execute2, (i));
|
2010-12-25 18:00:20 +03:00
|
|
|
#endif
|
2010-12-23 00:16:02 +03:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOADU_Wdq(bxInstruction_c *i)
|
2010-12-23 00:16:02 +03:00
|
|
|
{
|
2010-12-25 18:00:20 +03:00
|
|
|
#if BX_CPU_LEVEL >= 6
|
2010-12-23 00:16:02 +03:00
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2011-03-19 23:09:34 +03:00
|
|
|
read_virtual_dqword(i->seg(), eaddr, &BX_READ_XMM_REG(BX_TMP_REGISTER));
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
return BX_CPU_CALL_METHOD(i->execute2, (i));
|
2011-03-19 23:09:34 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#if BX_SUPPORT_AVX
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Vector(bxInstruction_c *i)
|
2011-03-19 23:09:34 +03:00
|
|
|
{
|
|
|
|
#if BX_CPU_LEVEL >= 6
|
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2011-06-14 23:56:28 +04:00
|
|
|
read_virtual_dword_vector(i->seg(), eaddr, i->getVL() << 2, &BX_READ_AVX_REG(BX_TMP_REGISTER));
|
2010-12-23 00:16:02 +03:00
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
return BX_CPU_CALL_METHOD(i->execute2, (i));
|
2010-12-25 18:00:20 +03:00
|
|
|
#endif
|
2010-12-23 00:16:02 +03:00
|
|
|
}
|
2011-03-19 23:09:34 +03:00
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_VectorQ(bxInstruction_c *i)
|
2011-03-19 23:09:34 +03:00
|
|
|
{
|
|
|
|
#if BX_CPU_LEVEL >= 6
|
|
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2011-06-14 23:56:28 +04:00
|
|
|
read_virtual_dword_vector(i->seg(), eaddr, i->getVL() << 1, &BX_READ_AVX_REG(BX_TMP_REGISTER));
|
2011-03-19 23:09:34 +03:00
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
return BX_CPU_CALL_METHOD(i->execute2, (i));
|
2011-03-19 23:09:34 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|