- tftp_send_optack() was not 64-bit clean (patch from SF bug #1787500)
[bochs-mirror.git] / cpu / data_xfer8.cc
blob7077de50d93c61dc3b2c15301d2ad20fe06f9bdc
1 /////////////////////////////////////////////////////////////////////////
2 // $Id: data_xfer8.cc,v 1.26 2007/01/12 22:47:20 sshwarts Exp $
3 /////////////////////////////////////////////////////////////////////////
4 //
5 // Copyright (C) 2001 MandrakeSoft S.A.
6 //
7 // MandrakeSoft S.A.
8 // 43, rue d'Aboukir
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
28 #define NEED_CPU_REG_SHORTCUTS 1
29 #include "bochs.h"
30 #include "cpu.h"
31 #define LOG_THIS BX_CPU_THIS_PTR
34 void BX_CPU_C::MOV_RLIb(bxInstruction_c *i)
36 BX_READ_8BIT_REGx(i->opcodeReg(),i->extend8bitL()) = i->Ib();
39 void BX_CPU_C::MOV_RHIb(bxInstruction_c *i)
41 BX_CPU_THIS_PTR gen_reg[i->b1() & 0x03].word.byte.rh = i->Ib();
44 void BX_CPU_C::MOV_EEbGb(bxInstruction_c *i)
46 write_virtual_byte(i->seg(), RMAddr(i), &BX_READ_8BIT_REGx(i->nnn(),i->extend8bitL()));
49 void BX_CPU_C::MOV_EGbGb(bxInstruction_c *i)
51 Bit8u op2 = BX_READ_8BIT_REGx(i->nnn(),i->extend8bitL());
52 BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), op2);
55 void BX_CPU_C::MOV_GbEEb(bxInstruction_c *i)
57 read_virtual_byte(i->seg(), RMAddr(i), &BX_READ_8BIT_REGx(i->nnn(),i->extend8bitL()));
60 void BX_CPU_C::MOV_GbEGb(bxInstruction_c *i)
62 Bit8u op2 = BX_READ_8BIT_REGx(i->rm(),i->extend8bitL());
63 BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), op2);
66 void BX_CPU_C::MOV_ALOd(bxInstruction_c *i)
68 read_virtual_byte(i->seg(), i->Id(), &AL);
71 void BX_CPU_C::MOV_OdAL(bxInstruction_c *i)
73 write_virtual_byte(i->seg(), i->Id(), &AL);
76 void BX_CPU_C::MOV_EbIb(bxInstruction_c *i)
78 Bit8u op2 = i->Ib();
80 if (i->modC0()) {
81 BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), op2);
83 else {
84 write_virtual_byte(i->seg(), RMAddr(i), &op2);
88 void BX_CPU_C::XLAT(bxInstruction_c *i)
90 bx_address offset;
92 #if BX_SUPPORT_X86_64
93 if (i->as64L()) {
94 offset = RBX + AL;
96 else
97 #endif
98 if (i->as32L()) {
99 offset = EBX + AL;
101 else {
102 offset = BX + AL;
105 read_virtual_byte(i->seg(), offset, &AL);
108 void BX_CPU_C::XCHG_EbGb(bxInstruction_c *i)
110 Bit8u op2, op1;
112 op2 = BX_READ_8BIT_REGx(i->nnn(), i->extend8bitL());
114 /* op1 is a register or memory reference */
115 if (i->modC0()) {
116 op1 = BX_READ_8BIT_REGx(i->rm(), i->extend8bitL());
117 BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), op2);
119 else {
120 /* pointer, segment address pair */
121 read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1);
122 write_RMW_virtual_byte(op2);
125 BX_WRITE_8BIT_REGx(i->nnn(), i->extend8bitL(), op1);