diff --git a/bochs/cpu/Makefile.in b/bochs/cpu/Makefile.in index a947c0c4c..8561128b4 100644 --- a/bochs/cpu/Makefile.in +++ b/bochs/cpu/Makefile.in @@ -63,9 +63,7 @@ OBJS32 = \ arith32.o \ mult32.o \ data_xfer32.o \ - logical32.o \ stack32.o \ - logical8.o \ ctrl_xfer8.o \ arith16.o \ data_xfer16.o \ @@ -103,6 +101,8 @@ OBJSXX = \ mult8.o \ data_xfer8.o \ vm8086.o \ + logical8.o \ + logical32.o \ # Objects which are only used for x86-64 code, but which have been diff --git a/bochs/cpu/logical32.cc b/bochs/cpu/logical32.cc index 2e0d08f03..ba8d53f23 100644 --- a/bochs/cpu/logical32.cc +++ b/bochs/cpu/logical32.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: logical32.cc,v 1.6 2002-09-06 21:54:58 kevinlawton Exp $ +// $Id: logical32.cc,v 1.7 2002-09-13 22:20:45 kevinlawton Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -58,7 +58,7 @@ BX_CPU_C::XOR_EdGd(BxInstruction_t *i) /* now write result back to destination */ if (i->mod == 0xc0) { - BX_WRITE_32BIT_REG(i->rm, result_32); + BX_WRITE_32BIT_REGZ(i->rm, result_32); } else { Write_RMW_virtual_dword(result_32); @@ -88,7 +88,7 @@ BX_CPU_C::XOR_GdEd(BxInstruction_t *i) result_32 = op1_32 ^ op2_32; /* now write result back to destination */ - BX_WRITE_32BIT_REG(i->nnn, result_32); + BX_WRITE_32BIT_REGZ(i->nnn, result_32); SET_FLAGS_OSZAPC_32(op1_32, op2_32, result_32, BX_INSTR_XOR32); } @@ -107,7 +107,11 @@ BX_CPU_C::XOR_EAXId(BxInstruction_t *i) sum_32 = op1_32 ^ op2_32; /* now write sum back to destination */ +#if BX_SUPPORT_X86_64 + RAX = sum_32; +#else EAX = sum_32; +#endif SET_FLAGS_OSZAPC_32(op1_32, op2_32, sum_32, BX_INSTR_XOR32); } @@ -132,7 +136,7 @@ BX_CPU_C::XOR_EdId(BxInstruction_t *i) /* now write result back to destination */ if (i->mod == 0xc0) { - BX_WRITE_32BIT_REG(i->rm, result_32); + BX_WRITE_32BIT_REGZ(i->rm, result_32); } else { Write_RMW_virtual_dword(result_32); @@ -162,7 +166,7 @@ BX_CPU_C::OR_EdId(BxInstruction_t *i) /* now write result back to destination */ if (i->mod == 0xc0) { - BX_WRITE_32BIT_REG(i->rm, result_32); + BX_WRITE_32BIT_REGZ(i->rm, result_32); } else { Write_RMW_virtual_dword(result_32); @@ -189,7 +193,7 @@ BX_CPU_C::NOT_Ed(BxInstruction_t *i) /* now write result back to destination */ if (i->mod == 0xc0) { - BX_WRITE_32BIT_REG(i->rm, result_32); + BX_WRITE_32BIT_REGZ(i->rm, result_32); } else { Write_RMW_virtual_dword(result_32); @@ -218,7 +222,7 @@ BX_CPU_C::OR_EdGd(BxInstruction_t *i) /* now write result back to destination */ if (i->mod == 0xc0) { - BX_WRITE_32BIT_REG(i->rm, result_32); + BX_WRITE_32BIT_REGZ(i->rm, result_32); } else { Write_RMW_virtual_dword(result_32); @@ -247,7 +251,7 @@ BX_CPU_C::OR_GdEd(BxInstruction_t *i) result_32 = op1_32 | op2_32; /* now write result back to destination */ - BX_WRITE_32BIT_REG(i->nnn, result_32); + BX_WRITE_32BIT_REGZ(i->nnn, result_32); SET_FLAGS_OSZAPC_32(op1_32, op2_32, result_32, BX_INSTR_OR32); } @@ -265,7 +269,11 @@ BX_CPU_C::OR_EAXId(BxInstruction_t *i) sum_32 = op1_32 | op2_32; /* now write sum back to destination */ +#if BX_SUPPORT_X86_64 + RAX = sum_32; +#else EAX = sum_32; +#endif SET_FLAGS_OSZAPC_32(op1_32, op2_32, sum_32, BX_INSTR_OR32); } @@ -293,7 +301,7 @@ BX_CPU_C::AND_EdGd(BxInstruction_t *i) /* now write result back to destination */ if (i->mod == 0xc0) { - BX_WRITE_32BIT_REG(i->rm, result_32); + BX_WRITE_32BIT_REGZ(i->rm, result_32); } else { Write_RMW_virtual_dword(result_32); @@ -322,7 +330,7 @@ BX_CPU_C::AND_GdEd(BxInstruction_t *i) result_32 = op1_32 & op2_32; /* now write result back to destination */ - BX_WRITE_32BIT_REG(i->nnn, result_32); + BX_WRITE_32BIT_REGZ(i->nnn, result_32); SET_FLAGS_OSZAPC_32(op1_32, op2_32, result_32, BX_INSTR_AND32); } @@ -340,7 +348,11 @@ BX_CPU_C::AND_EAXId(BxInstruction_t *i) sum_32 = op1_32 & op2_32; /* now write sum back to destination */ +#if BX_SUPPORT_X86_64 + RAX = sum_32; +#else EAX = sum_32; +#endif SET_FLAGS_OSZAPC_32(op1_32, op2_32, sum_32, BX_INSTR_AND32); } @@ -365,7 +377,7 @@ BX_CPU_C::AND_EdId(BxInstruction_t *i) /* now write result back to destination */ if (i->mod == 0xc0) { - BX_WRITE_32BIT_REG(i->rm, result_32); + BX_WRITE_32BIT_REGZ(i->rm, result_32); } else { Write_RMW_virtual_dword(result_32); diff --git a/bochs/cpu/logical8.cc b/bochs/cpu/logical8.cc index 131ea668d..e8ad40c29 100644 --- a/bochs/cpu/logical8.cc +++ b/bochs/cpu/logical8.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: logical8.cc,v 1.6 2002-09-06 21:54:58 kevinlawton Exp $ +// $Id: logical8.cc,v 1.7 2002-09-13 22:20:45 kevinlawton Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -41,11 +41,11 @@ BX_CPU_C::XOR_EbGb(BxInstruction_t *i) Bit8u op2, op1, result; /* op2 is a register, op2_addr is an index of a register */ - op2 = BX_READ_8BIT_REG(i->nnn); + op2 = BX_READ_8BIT_REGx(i->nnn,i->extend8bit); /* op1 is a register or memory reference */ if (i->mod == 0xc0) { - op1 = BX_READ_8BIT_REG(i->rm); + op1 = BX_READ_8BIT_REGx(i->rm,i->extend8bit); } else { /* pointer, segment address pair */ @@ -56,7 +56,7 @@ BX_CPU_C::XOR_EbGb(BxInstruction_t *i) /* now write result back to destination */ if (i->mod == 0xc0) { - BX_WRITE_8BIT_REG(i->rm, result); + BX_WRITE_8BIT_REGx(i->rm, i->extend8bit, result); } else { Write_RMW_virtual_byte(result); @@ -70,11 +70,11 @@ BX_CPU_C::XOR_GbEb(BxInstruction_t *i) { Bit8u op1, op2, result; - op1 = BX_READ_8BIT_REG(i->nnn); + op1 = BX_READ_8BIT_REGx(i->nnn,i->extend8bit); /* op2 is a register or memory reference */ if (i->mod == 0xc0) { - op2 = BX_READ_8BIT_REG(i->rm); + op2 = BX_READ_8BIT_REGx(i->rm,i->extend8bit); } else { /* pointer, segment address pair */ @@ -84,7 +84,7 @@ BX_CPU_C::XOR_GbEb(BxInstruction_t *i) result = op1 ^ op2; /* now write result back to destination, which is a register */ - BX_WRITE_8BIT_REG(i->nnn, result); + BX_WRITE_8BIT_REGx(i->nnn, i->extend8bit, result); SET_FLAGS_OSZAPC_8(op1, op2, result, BX_INSTR_XOR8); } @@ -117,7 +117,7 @@ BX_CPU_C::XOR_EbIb(BxInstruction_t *i) /* op1 is a register or memory reference */ if (i->mod == 0xc0) { - op1 = BX_READ_8BIT_REG(i->rm); + op1 = BX_READ_8BIT_REGx(i->rm,i->extend8bit); } else { /* pointer, segment address pair */ @@ -128,7 +128,7 @@ BX_CPU_C::XOR_EbIb(BxInstruction_t *i) /* now write result back to destination */ if (i->mod == 0xc0) { - BX_WRITE_8BIT_REG(i->rm, result); + BX_WRITE_8BIT_REGx(i->rm, i->extend8bit, result); } else { Write_RMW_virtual_byte(result); @@ -148,7 +148,7 @@ BX_CPU_C::OR_EbIb(BxInstruction_t *i) /* op1 is a register or memory reference */ if (i->mod == 0xc0) { - op1 = BX_READ_8BIT_REG(i->rm); + op1 = BX_READ_8BIT_REGx(i->rm,i->extend8bit); } else { /* pointer, segment address pair */ @@ -159,7 +159,7 @@ BX_CPU_C::OR_EbIb(BxInstruction_t *i) /* now write result back to destination */ if (i->mod == 0xc0) { - BX_WRITE_8BIT_REG(i->rm, result); + BX_WRITE_8BIT_REGx(i->rm, i->extend8bit, result); } else { Write_RMW_virtual_byte(result); @@ -177,7 +177,7 @@ BX_CPU_C::NOT_Eb(BxInstruction_t *i) /* op1 is a register or memory reference */ if (i->mod == 0xc0) { - op1_8 = BX_READ_8BIT_REG(i->rm); + op1_8 = BX_READ_8BIT_REGx(i->rm,i->extend8bit); } else { /* pointer, segment address pair */ @@ -188,7 +188,7 @@ BX_CPU_C::NOT_Eb(BxInstruction_t *i) /* now write result back to destination */ if (i->mod == 0xc0) { - BX_WRITE_8BIT_REG(i->rm, result_8); + BX_WRITE_8BIT_REGx(i->rm, i->extend8bit, result_8); } else { Write_RMW_virtual_byte(result_8); @@ -203,11 +203,11 @@ BX_CPU_C::OR_EbGb(BxInstruction_t *i) /* op2 is a register, op2_addr is an index of a register */ - op2 = BX_READ_8BIT_REG(i->nnn); + op2 = BX_READ_8BIT_REGx(i->nnn,i->extend8bit); /* op1 is a register or memory reference */ if (i->mod == 0xc0) { - op1 = BX_READ_8BIT_REG(i->rm); + op1 = BX_READ_8BIT_REGx(i->rm,i->extend8bit); } else { /* pointer, segment address pair */ @@ -218,7 +218,7 @@ BX_CPU_C::OR_EbGb(BxInstruction_t *i) /* now write result back to destination */ if (i->mod == 0xc0) { - BX_WRITE_8BIT_REG(i->rm, result); + BX_WRITE_8BIT_REGx(i->rm, i->extend8bit, result); } else { Write_RMW_virtual_byte(result); @@ -234,11 +234,11 @@ BX_CPU_C::OR_GbEb(BxInstruction_t *i) Bit8u op1, op2, result; - op1 = BX_READ_8BIT_REG(i->nnn); + op1 = BX_READ_8BIT_REGx(i->nnn,i->extend8bit); /* op2 is a register or memory reference */ if (i->mod == 0xc0) { - op2 = BX_READ_8BIT_REG(i->rm); + op2 = BX_READ_8BIT_REGx(i->rm,i->extend8bit); } else { /* pointer, segment address pair */ @@ -248,7 +248,7 @@ BX_CPU_C::OR_GbEb(BxInstruction_t *i) result = op1 | op2; /* now write result back to destination, which is a register */ - BX_WRITE_8BIT_REG(i->nnn, result); + BX_WRITE_8BIT_REGx(i->nnn, i->extend8bit, result); SET_FLAGS_OSZAPC_8(op1, op2, result, BX_INSTR_OR8); @@ -281,11 +281,11 @@ BX_CPU_C::AND_EbGb(BxInstruction_t *i) Bit8u op2, op1, result; /* op2 is a register, op2_addr is an index of a register */ - op2 = BX_READ_8BIT_REG(i->nnn); + op2 = BX_READ_8BIT_REGx(i->nnn,i->extend8bit); /* op1 is a register or memory reference */ if (i->mod == 0xc0) { - op1 = BX_READ_8BIT_REG(i->rm); + op1 = BX_READ_8BIT_REGx(i->rm,i->extend8bit); } else { /* pointer, segment address pair */ @@ -296,7 +296,7 @@ BX_CPU_C::AND_EbGb(BxInstruction_t *i) /* now write result back to destination */ if (i->mod == 0xc0) { - BX_WRITE_8BIT_REG(i->rm, result); + BX_WRITE_8BIT_REGx(i->rm, i->extend8bit, result); } else { Write_RMW_virtual_byte(result); @@ -311,11 +311,11 @@ BX_CPU_C::AND_GbEb(BxInstruction_t *i) { Bit8u op1, op2, result; - op1 = BX_READ_8BIT_REG(i->nnn); + op1 = BX_READ_8BIT_REGx(i->nnn,i->extend8bit); /* op2 is a register or memory reference */ if (i->mod == 0xc0) { - op2 = BX_READ_8BIT_REG(i->rm); + op2 = BX_READ_8BIT_REGx(i->rm,i->extend8bit); } else { /* pointer, segment address pair */ @@ -325,7 +325,7 @@ BX_CPU_C::AND_GbEb(BxInstruction_t *i) result = op1 & op2; /* now write result back to destination, which is a register */ - BX_WRITE_8BIT_REG(i->nnn, result); + BX_WRITE_8BIT_REGx(i->nnn, i->extend8bit, result); SET_FLAGS_OSZAPC_8(op1, op2, result, BX_INSTR_AND8); } @@ -362,7 +362,7 @@ BX_CPU_C::AND_EbIb(BxInstruction_t *i) /* op1 is a register or memory reference */ if (i->mod == 0xc0) { - op1 = BX_READ_8BIT_REG(i->rm); + op1 = BX_READ_8BIT_REGx(i->rm,i->extend8bit); } else { /* pointer, segment address pair */ @@ -373,7 +373,7 @@ BX_CPU_C::AND_EbIb(BxInstruction_t *i) /* now write result back to destination */ if (i->mod == 0xc0) { - BX_WRITE_8BIT_REG(i->rm, result); + BX_WRITE_8BIT_REGx(i->rm, i->extend8bit, result); } else { Write_RMW_virtual_byte(result); @@ -389,11 +389,11 @@ BX_CPU_C::TEST_EbGb(BxInstruction_t *i) Bit8u op2, op1, result; /* op2 is a register, op2_addr is an index of a register */ - op2 = BX_READ_8BIT_REG(i->nnn); + op2 = BX_READ_8BIT_REGx(i->nnn,i->extend8bit); /* op1 is a register or memory reference */ if (i->mod == 0xc0) { - op1 = BX_READ_8BIT_REG(i->rm); + op1 = BX_READ_8BIT_REGx(i->rm,i->extend8bit); } else { /* pointer, segment address pair */ @@ -433,7 +433,7 @@ BX_CPU_C::TEST_EbIb(BxInstruction_t *i) /* op1 is a register or memory reference */ if (i->mod == 0xc0) { - op1 = BX_READ_8BIT_REG(i->rm); + op1 = BX_READ_8BIT_REGx(i->rm,i->extend8bit); } else { /* pointer, segment address pair */