1 /////////////////////////////////////////////////////////////////////////
2 // $Id: logical64.cc,v 1.32 2008/08/11 20:34:05 sshwarts Exp $
3 /////////////////////////////////////////////////////////////////////////
5 // Copyright (C) 2001 MandrakeSoft S.A.
9 // 75002 Paris - France
10 // http://www.linux-mandrake.com/
11 // http://www.mandrakesoft.com/
13 // This library is free software; you can redistribute it and/or
14 // modify it under the terms of the GNU Lesser General Public
15 // License as published by the Free Software Foundation; either
16 // version 2 of the License, or (at your option) any later version.
18 // This library is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 // Lesser General Public License for more details.
23 // You should have received a copy of the GNU Lesser General Public
24 // License along with this library; if not, write to the Free Software
25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 /////////////////////////////////////////////////////////////////////////
28 #define NEED_CPU_REG_SHORTCUTS 1
31 #define LOG_THIS BX_CPU_THIS_PTR
35 void BX_CPP_AttrRegparmN(1) BX_CPU_C::XOR_EqGqM(bxInstruction_c
*i
)
37 Bit64u op1_64
, op2_64
;
39 bx_address eaddr
= BX_CPU_CALL_METHODR(i
->ResolveModrm
, (i
));
41 op1_64
= read_RMW_virtual_qword_64(i
->seg(), eaddr
);
42 op2_64
= BX_READ_64BIT_REG(i
->nnn());
44 write_RMW_virtual_qword(op1_64
);
46 SET_FLAGS_OSZAPC_LOGIC_64(op1_64
);
49 void BX_CPP_AttrRegparmN(1) BX_CPU_C::XOR_GqEqR(bxInstruction_c
*i
)
51 Bit64u op1_64
, op2_64
;
53 op1_64
= BX_READ_64BIT_REG(i
->nnn());
54 op2_64
= BX_READ_64BIT_REG(i
->rm());
57 /* now write result back to destination */
58 BX_WRITE_64BIT_REG(i
->nnn(), op1_64
);
60 SET_FLAGS_OSZAPC_LOGIC_64(op1_64
);
63 void BX_CPP_AttrRegparmN(1) BX_CPU_C::XOR_RAXId(bxInstruction_c
*i
)
65 Bit64u op1_64
, op2_64
;
68 op2_64
= (Bit32s
) i
->Id();
73 SET_FLAGS_OSZAPC_LOGIC_64(op1_64
);
76 void BX_CPP_AttrRegparmN(1) BX_CPU_C::XOR_EqIdM(bxInstruction_c
*i
)
78 Bit64u op1_64
, op2_64
= (Bit32s
) i
->Id();
80 bx_address eaddr
= BX_CPU_CALL_METHODR(i
->ResolveModrm
, (i
));
82 op1_64
= read_RMW_virtual_qword_64(i
->seg(), eaddr
);
84 write_RMW_virtual_qword(op1_64
);
86 SET_FLAGS_OSZAPC_LOGIC_64(op1_64
);
89 void BX_CPP_AttrRegparmN(1) BX_CPU_C::XOR_EqIdR(bxInstruction_c
*i
)
91 Bit64u op1_64
, op2_64
= (Bit32s
) i
->Id();
93 op1_64
= BX_READ_64BIT_REG(i
->rm());
95 BX_WRITE_64BIT_REG(i
->rm(), op1_64
);
97 SET_FLAGS_OSZAPC_LOGIC_64(op1_64
);
100 void BX_CPP_AttrRegparmN(1) BX_CPU_C::OR_EqIdM(bxInstruction_c
*i
)
102 Bit64u op1_64
, op2_64
= (Bit32s
) i
->Id();
104 bx_address eaddr
= BX_CPU_CALL_METHODR(i
->ResolveModrm
, (i
));
106 op1_64
= read_RMW_virtual_qword_64(i
->seg(), eaddr
);
108 write_RMW_virtual_qword(op1_64
);
110 SET_FLAGS_OSZAPC_LOGIC_64(op1_64
);
113 void BX_CPP_AttrRegparmN(1) BX_CPU_C::OR_EqIdR(bxInstruction_c
*i
)
115 Bit64u op1_64
, op2_64
= (Bit32s
) i
->Id();
117 op1_64
= BX_READ_64BIT_REG(i
->rm());
119 BX_WRITE_64BIT_REG(i
->rm(), op1_64
);
121 SET_FLAGS_OSZAPC_LOGIC_64(op1_64
);
124 void BX_CPP_AttrRegparmN(1) BX_CPU_C::NOT_EqM(bxInstruction_c
*i
)
128 bx_address eaddr
= BX_CPU_CALL_METHODR(i
->ResolveModrm
, (i
));
130 op1_64
= read_RMW_virtual_qword_64(i
->seg(), eaddr
);
132 write_RMW_virtual_qword(op1_64
);
135 void BX_CPP_AttrRegparmN(1) BX_CPU_C::NOT_EqR(bxInstruction_c
*i
)
137 Bit64u op1_64
= BX_READ_64BIT_REG(i
->rm());
139 BX_WRITE_64BIT_REG(i
->rm(), op1_64
);
142 void BX_CPP_AttrRegparmN(1) BX_CPU_C::OR_EqGqM(bxInstruction_c
*i
)
144 Bit64u op1_64
, op2_64
;
146 bx_address eaddr
= BX_CPU_CALL_METHODR(i
->ResolveModrm
, (i
));
148 op1_64
= read_RMW_virtual_qword_64(i
->seg(), eaddr
);
149 op2_64
= BX_READ_64BIT_REG(i
->nnn());
151 write_RMW_virtual_qword(op1_64
);
153 SET_FLAGS_OSZAPC_LOGIC_64(op1_64
);
156 void BX_CPP_AttrRegparmN(1) BX_CPU_C::OR_GqEqR(bxInstruction_c
*i
)
158 Bit64u op1_64
, op2_64
;
160 op1_64
= BX_READ_64BIT_REG(i
->nnn());
161 op2_64
= BX_READ_64BIT_REG(i
->rm());
164 /* now write result back to destination */
165 BX_WRITE_64BIT_REG(i
->nnn(), op1_64
);
167 SET_FLAGS_OSZAPC_LOGIC_64(op1_64
);
170 void BX_CPP_AttrRegparmN(1) BX_CPU_C::OR_RAXId(bxInstruction_c
*i
)
172 Bit64u op1_64
, op2_64
;
175 op2_64
= (Bit32s
) i
->Id();
180 SET_FLAGS_OSZAPC_LOGIC_64(op1_64
);
183 void BX_CPP_AttrRegparmN(1) BX_CPU_C::AND_EqGqM(bxInstruction_c
*i
)
185 Bit64u op1_64
, op2_64
;
187 bx_address eaddr
= BX_CPU_CALL_METHODR(i
->ResolveModrm
, (i
));
189 op1_64
= read_RMW_virtual_qword_64(i
->seg(), eaddr
);
190 op2_64
= BX_READ_64BIT_REG(i
->nnn());
192 write_RMW_virtual_qword(op1_64
);
194 SET_FLAGS_OSZAPC_LOGIC_64(op1_64
);
197 void BX_CPP_AttrRegparmN(1) BX_CPU_C::AND_GqEqR(bxInstruction_c
*i
)
199 Bit64u op1_64
, op2_64
;
201 op1_64
= BX_READ_64BIT_REG(i
->nnn());
202 op2_64
= BX_READ_64BIT_REG(i
->rm());
205 /* now write result back to destination */
206 BX_WRITE_64BIT_REG(i
->nnn(), op1_64
);
208 SET_FLAGS_OSZAPC_LOGIC_64(op1_64
);
211 void BX_CPP_AttrRegparmN(1) BX_CPU_C::AND_RAXId(bxInstruction_c
*i
)
213 Bit64u op1_64
, op2_64
;
216 op2_64
= (Bit32s
) i
->Id();
220 SET_FLAGS_OSZAPC_LOGIC_64(op1_64
);
223 void BX_CPP_AttrRegparmN(1) BX_CPU_C::AND_EqIdM(bxInstruction_c
*i
)
225 Bit64u op1_64
, op2_64
= (Bit32s
) i
->Id();
227 bx_address eaddr
= BX_CPU_CALL_METHODR(i
->ResolveModrm
, (i
));
229 op1_64
= read_RMW_virtual_qword_64(i
->seg(), eaddr
);
231 write_RMW_virtual_qword(op1_64
);
233 SET_FLAGS_OSZAPC_LOGIC_64(op1_64
);
236 void BX_CPP_AttrRegparmN(1) BX_CPU_C::AND_EqIdR(bxInstruction_c
*i
)
238 Bit64u op1_64
, op2_64
= (Bit32s
) i
->Id();
240 op1_64
= BX_READ_64BIT_REG(i
->rm());
242 BX_WRITE_64BIT_REG(i
->rm(), op1_64
);
244 SET_FLAGS_OSZAPC_LOGIC_64(op1_64
);
247 void BX_CPP_AttrRegparmN(1) BX_CPU_C::TEST_EqGqR(bxInstruction_c
*i
)
249 Bit64u op1_64
, op2_64
;
251 op1_64
= BX_READ_64BIT_REG(i
->rm());
252 op2_64
= BX_READ_64BIT_REG(i
->nnn());
255 SET_FLAGS_OSZAPC_LOGIC_64(op1_64
);
258 void BX_CPP_AttrRegparmN(1) BX_CPU_C::TEST_RAXId(bxInstruction_c
*i
)
260 Bit64u op1_64
, op2_64
;
263 op2_64
= (Bit32s
) i
->Id();
266 SET_FLAGS_OSZAPC_LOGIC_64(op1_64
);
269 void BX_CPP_AttrRegparmN(1) BX_CPU_C::TEST_EqIdR(bxInstruction_c
*i
)
271 Bit64u op1_64
, op2_64
;
273 op1_64
= BX_READ_64BIT_REG(i
->rm());
274 op2_64
= (Bit32s
) i
->Id();
277 SET_FLAGS_OSZAPC_LOGIC_64(op1_64
);
280 #endif /* if BX_SUPPORT_X86_64 */