1 |
2 |
alfik |
/////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// $Id: load.cc 11562 2012-12-20 19:43:11Z sshwarts $
|
3 |
|
|
/////////////////////////////////////////////////////////////////////////
|
4 |
|
|
//
|
5 |
|
|
// Copyright (c) 2008-2011 Stanislav Shwartsman
|
6 |
|
|
// Written by Stanislav Shwartsman [sshwarts at sourceforge net]
|
7 |
|
|
//
|
8 |
|
|
// This library is free software; you can redistribute it and/or
|
9 |
|
|
// modify it under the terms of the GNU Lesser General Public
|
10 |
|
|
// License as published by the Free Software Foundation; either
|
11 |
|
|
// version 2 of the License, or (at your option) any later version.
|
12 |
|
|
//
|
13 |
|
|
// This library is distributed in the hope that it will be useful,
|
14 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
16 |
|
|
// Lesser General Public License for more details.
|
17 |
|
|
//
|
18 |
|
|
// You should have received a copy of the GNU Lesser General Public
|
19 |
|
|
// License along with this library; if not, write to the Free Software
|
20 |
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA B 02110-1301 USA
|
21 |
|
|
//
|
22 |
|
|
/////////////////////////////////////////////////////////////////////////
|
23 |
|
|
|
24 |
|
|
#define NEED_CPU_REG_SHORTCUTS 1
|
25 |
|
|
#include "bochs.h"
|
26 |
|
|
#include "cpu.h"
|
27 |
|
|
#define LOG_THIS BX_CPU_THIS_PTR
|
28 |
|
|
|
29 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Eb(bxInstruction_c *i)
|
30 |
|
|
{
|
31 |
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
32 |
|
|
TMP8L = read_virtual_byte(i->seg(), eaddr);
|
33 |
|
|
return BX_CPU_CALL_METHOD(i->execute2(), (i));
|
34 |
|
|
}
|
35 |
|
|
|
36 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ew(bxInstruction_c *i)
|
37 |
|
|
{
|
38 |
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
39 |
|
|
TMP16 = read_virtual_word(i->seg(), eaddr);
|
40 |
|
|
return BX_CPU_CALL_METHOD(i->execute2(), (i));
|
41 |
|
|
}
|
42 |
|
|
|
43 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ed(bxInstruction_c *i)
|
44 |
|
|
{
|
45 |
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
46 |
|
|
TMP32 = read_virtual_dword(i->seg(), eaddr);
|
47 |
|
|
return BX_CPU_CALL_METHOD(i->execute2(), (i));
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
#if BX_SUPPORT_X86_64
|
51 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Eq(bxInstruction_c *i)
|
52 |
|
|
{
|
53 |
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
54 |
|
|
TMP64 = read_virtual_qword_64(i->seg(), eaddr);
|
55 |
|
|
return BX_CPU_CALL_METHOD(i->execute2(), (i));
|
56 |
|
|
}
|
57 |
|
|
#endif
|
58 |
|
|
|
59 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Wb(bxInstruction_c *i)
|
60 |
|
|
{
|
61 |
|
|
#if BX_CPU_LEVEL >= 6
|
62 |
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
63 |
|
|
Bit8u val_8 = read_virtual_byte(i->seg(), eaddr);
|
64 |
|
|
BX_WRITE_XMM_REG_LO_BYTE(BX_TMP_REGISTER, val_8);
|
65 |
|
|
|
66 |
|
|
return BX_CPU_CALL_METHOD(i->execute2(), (i));
|
67 |
|
|
#endif
|
68 |
|
|
}
|
69 |
|
|
|
70 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Ww(bxInstruction_c *i)
|
71 |
|
|
{
|
72 |
|
|
#if BX_CPU_LEVEL >= 6
|
73 |
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
74 |
|
|
Bit16u val_16 = read_virtual_word(i->seg(), eaddr);
|
75 |
|
|
BX_WRITE_XMM_REG_LO_WORD(BX_TMP_REGISTER, val_16);
|
76 |
|
|
|
77 |
|
|
return BX_CPU_CALL_METHOD(i->execute2(), (i));
|
78 |
|
|
#endif
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Wss(bxInstruction_c *i)
|
82 |
|
|
{
|
83 |
|
|
#if BX_CPU_LEVEL >= 6
|
84 |
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
85 |
|
|
Bit32u val_32 = read_virtual_dword(i->seg(), eaddr);
|
86 |
|
|
BX_WRITE_XMM_REG_LO_DWORD(BX_TMP_REGISTER, val_32);
|
87 |
|
|
|
88 |
|
|
return BX_CPU_CALL_METHOD(i->execute2(), (i));
|
89 |
|
|
#endif
|
90 |
|
|
}
|
91 |
|
|
|
92 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Wsd(bxInstruction_c *i)
|
93 |
|
|
{
|
94 |
|
|
#if BX_CPU_LEVEL >= 6
|
95 |
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
96 |
|
|
Bit64u val_64 = read_virtual_qword(i->seg(), eaddr);
|
97 |
|
|
BX_WRITE_XMM_REG_LO_QWORD(BX_TMP_REGISTER, val_64);
|
98 |
|
|
|
99 |
|
|
return BX_CPU_CALL_METHOD(i->execute2(), (i));
|
100 |
|
|
#endif
|
101 |
|
|
}
|
102 |
|
|
|
103 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Wdq(bxInstruction_c *i)
|
104 |
|
|
{
|
105 |
|
|
#if BX_CPU_LEVEL >= 6
|
106 |
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
107 |
|
|
|
108 |
|
|
if (BX_CPU_THIS_PTR mxcsr.get_MM())
|
109 |
|
|
read_virtual_xmmword(i->seg(), eaddr, &BX_READ_XMM_REG(BX_TMP_REGISTER));
|
110 |
|
|
else
|
111 |
|
|
read_virtual_xmmword_aligned(i->seg(), eaddr, &BX_READ_XMM_REG(BX_TMP_REGISTER));
|
112 |
|
|
|
113 |
|
|
return BX_CPU_CALL_METHOD(i->execute2(), (i));
|
114 |
|
|
#endif
|
115 |
|
|
}
|
116 |
|
|
|
117 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOADU_Wdq(bxInstruction_c *i)
|
118 |
|
|
{
|
119 |
|
|
#if BX_CPU_LEVEL >= 6
|
120 |
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
121 |
|
|
read_virtual_xmmword(i->seg(), eaddr, &BX_READ_XMM_REG(BX_TMP_REGISTER));
|
122 |
|
|
|
123 |
|
|
return BX_CPU_CALL_METHOD(i->execute2(), (i));
|
124 |
|
|
#endif
|
125 |
|
|
}
|
126 |
|
|
|
127 |
|
|
#if BX_SUPPORT_AVX
|
128 |
|
|
|
129 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::LOAD_Vector(bxInstruction_c *i)
|
130 |
|
|
{
|
131 |
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
132 |
|
|
|
133 |
|
|
if (i->getVL() == BX_VL256)
|
134 |
|
|
read_virtual_ymmword(i->seg(), eaddr, &BX_READ_AVX_REG(BX_TMP_REGISTER));
|
135 |
|
|
else
|
136 |
|
|
read_virtual_xmmword(i->seg(), eaddr, &BX_READ_XMM_REG(BX_TMP_REGISTER));
|
137 |
|
|
|
138 |
|
|
return BX_CPU_CALL_METHOD(i->execute2(), (i));
|
139 |
|
|
}
|
140 |
|
|
|
141 |
|
|
#endif
|