1 |
2 |
alfik |
/////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// $Id: data_xfer8.cc 11313 2012-08-05 13:52:40Z sshwarts $
|
3 |
|
|
/////////////////////////////////////////////////////////////////////////
|
4 |
|
|
//
|
5 |
|
|
// Copyright (C) 2001-2012 The Bochs Project
|
6 |
|
|
//
|
7 |
|
|
// This library is free software; you can redistribute it and/or
|
8 |
|
|
// modify it under the terms of the GNU Lesser General Public
|
9 |
|
|
// License as published by the Free Software Foundation; either
|
10 |
|
|
// version 2 of the License, or (at your option) any later version.
|
11 |
|
|
//
|
12 |
|
|
// This library is distributed in the hope that it will be useful,
|
13 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15 |
|
|
// Lesser General Public License for more details.
|
16 |
|
|
//
|
17 |
|
|
// You should have received a copy of the GNU Lesser General Public
|
18 |
|
|
// License along with this library; if not, write to the Free Software
|
19 |
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA B 02110-1301 USA
|
20 |
|
|
/////////////////////////////////////////////////////////////////////////
|
21 |
|
|
|
22 |
|
|
#define NEED_CPU_REG_SHORTCUTS 1
|
23 |
|
|
#include "bochs.h"
|
24 |
|
|
#include "cpu.h"
|
25 |
|
|
#define LOG_THIS BX_CPU_THIS_PTR
|
26 |
|
|
|
27 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_RLIb(bxInstruction_c *i)
|
28 |
|
|
{
|
29 |
|
|
BX_WRITE_8BIT_REGx(i->dst(), i->extend8bitL(), i->Ib());
|
30 |
|
|
|
31 |
|
|
BX_NEXT_INSTR(i);
|
32 |
|
|
}
|
33 |
|
|
|
34 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_RHIb(bxInstruction_c *i)
|
35 |
|
|
{
|
36 |
|
|
BX_WRITE_8BIT_REGH(i->dst() & 0x3, i->Ib());
|
37 |
|
|
|
38 |
|
|
BX_NEXT_INSTR(i);
|
39 |
|
|
}
|
40 |
|
|
|
41 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_EbGbM(bxInstruction_c *i)
|
42 |
|
|
{
|
43 |
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
44 |
|
|
|
45 |
|
|
write_virtual_byte(i->seg(), eaddr, BX_READ_8BIT_REGx(i->src(), i->extend8bitL()));
|
46 |
|
|
|
47 |
|
|
BX_NEXT_INSTR(i);
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_GbEbM(bxInstruction_c *i)
|
51 |
|
|
{
|
52 |
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
53 |
|
|
|
54 |
|
|
Bit8u val8 = read_virtual_byte(i->seg(), eaddr);
|
55 |
|
|
BX_WRITE_8BIT_REGx(i->dst(), i->extend8bitL(), val8);
|
56 |
|
|
|
57 |
|
|
BX_NEXT_INSTR(i);
|
58 |
|
|
}
|
59 |
|
|
|
60 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_GbEbR(bxInstruction_c *i)
|
61 |
|
|
{
|
62 |
|
|
Bit8u op2 = BX_READ_8BIT_REGx(i->src(), i->extend8bitL());
|
63 |
|
|
BX_WRITE_8BIT_REGx(i->dst(), i->extend8bitL(), op2);
|
64 |
|
|
|
65 |
|
|
BX_NEXT_INSTR(i);
|
66 |
|
|
}
|
67 |
|
|
|
68 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_ALOd(bxInstruction_c *i)
|
69 |
|
|
{
|
70 |
|
|
AL = read_virtual_byte_32(i->seg(), i->Id());
|
71 |
|
|
|
72 |
|
|
BX_NEXT_INSTR(i);
|
73 |
|
|
}
|
74 |
|
|
|
75 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_OdAL(bxInstruction_c *i)
|
76 |
|
|
{
|
77 |
|
|
write_virtual_byte_32(i->seg(), i->Id(), AL);
|
78 |
|
|
|
79 |
|
|
BX_NEXT_INSTR(i);
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_EbIbM(bxInstruction_c *i)
|
83 |
|
|
{
|
84 |
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
85 |
|
|
|
86 |
|
|
write_virtual_byte(i->seg(), eaddr, i->Ib());
|
87 |
|
|
|
88 |
|
|
BX_NEXT_INSTR(i);
|
89 |
|
|
}
|
90 |
|
|
|
91 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::XLAT(bxInstruction_c *i)
|
92 |
|
|
{
|
93 |
|
|
#if BX_SUPPORT_X86_64
|
94 |
|
|
if (i->as64L()) {
|
95 |
|
|
AL = read_virtual_byte_64(i->seg(), RBX + AL);
|
96 |
|
|
}
|
97 |
|
|
else
|
98 |
|
|
#endif
|
99 |
|
|
if (i->as32L()) {
|
100 |
|
|
AL = read_virtual_byte(i->seg(), (Bit32u) (EBX + AL));
|
101 |
|
|
}
|
102 |
|
|
else {
|
103 |
|
|
AL = read_virtual_byte_32(i->seg(), (Bit16u) (BX + AL));
|
104 |
|
|
}
|
105 |
|
|
|
106 |
|
|
BX_NEXT_INSTR(i);
|
107 |
|
|
}
|
108 |
|
|
|
109 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::XCHG_EbGbM(bxInstruction_c *i)
|
110 |
|
|
{
|
111 |
|
|
bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
112 |
|
|
|
113 |
|
|
Bit8u op1 = read_RMW_virtual_byte(i->seg(), eaddr);
|
114 |
|
|
Bit8u op2 = BX_READ_8BIT_REGx(i->src(), i->extend8bitL());
|
115 |
|
|
|
116 |
|
|
write_RMW_virtual_byte(op2);
|
117 |
|
|
BX_WRITE_8BIT_REGx(i->src(), i->extend8bitL(), op1);
|
118 |
|
|
|
119 |
|
|
BX_NEXT_INSTR(i);
|
120 |
|
|
}
|
121 |
|
|
|
122 |
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::XCHG_EbGbR(bxInstruction_c *i)
|
123 |
|
|
{
|
124 |
|
|
Bit8u op1 = BX_READ_8BIT_REGx(i->dst(), i->extend8bitL());
|
125 |
|
|
Bit8u op2 = BX_READ_8BIT_REGx(i->src(), i->extend8bitL());
|
126 |
|
|
|
127 |
|
|
BX_WRITE_8BIT_REGx(i->src(), i->extend8bitL(), op1);
|
128 |
|
|
BX_WRITE_8BIT_REGx(i->dst(), i->extend8bitL(), op2);
|
129 |
|
|
|
130 |
|
|
BX_NEXT_INSTR(i);
|
131 |
|
|
}
|