I updated code that was using !!get_CF() (or other arithmetic flag) to

use getB_CF() etc.  getB_CF() and friends are only for a relatively
  small number of cases where a true boolean/binary number (0 or 1) is required
  rather than 0 or non-0 as is returned by get_CF().
This commit is contained in:
Kevin Lawton 2002-09-24 18:33:38 +00:00
parent 472202226d
commit 3c09fdb363
9 changed files with 60 additions and 56 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: arith16.cc,v 1.18 2002-09-23 17:59:17 kevinlawton Exp $
// $Id: arith16.cc,v 1.19 2002-09-24 18:33:37 kevinlawton Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -181,7 +181,7 @@ BX_CPU_C::ADC_EwGw(bxInstruction_c *i)
Boolean temp_CF;
Bit16u op2_16, op1_16, sum_16;
temp_CF = !!get_CF();
temp_CF = getB_CF();
@ -219,7 +219,7 @@ BX_CPU_C::ADC_GwEw(bxInstruction_c *i)
Boolean temp_CF;
Bit16u op1_16, op2_16, sum_16;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* op1_16 is a register, RMAddr(i) is an index of a register */
@ -250,7 +250,7 @@ BX_CPU_C::ADC_AXIw(bxInstruction_c *i)
Boolean temp_CF;
Bit16u op1_16, op2_16, sum_16;
temp_CF = !!get_CF();
temp_CF = getB_CF();
op1_16 = AX;
@ -275,7 +275,7 @@ BX_CPU_C::SBB_EwGw(bxInstruction_c *i)
Bit16u op2_16, op1_16, diff_16;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* op2_16 is a register, RMAddr(i) is an index of a register */
@ -310,7 +310,7 @@ BX_CPU_C::SBB_GwEw(bxInstruction_c *i)
{
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
Bit16u op1_16, op2_16, diff_16;
@ -344,7 +344,7 @@ BX_CPU_C::SBB_AXIw(bxInstruction_c *i)
Boolean temp_CF;
Bit16u op1_16, op2_16, diff_16;
temp_CF = !!get_CF();
temp_CF = getB_CF();
op1_16 = AX;
@ -368,7 +368,7 @@ BX_CPU_C::SBB_EwIw(bxInstruction_c *i)
Boolean temp_CF;
Bit16u op2_16, op1_16, diff_16;
temp_CF = !!get_CF();
temp_CF = getB_CF();
@ -715,7 +715,7 @@ BX_CPU_C::ADC_EwIw(bxInstruction_c *i)
Boolean temp_CF;
Bit16u op2_16, op1_16, sum_16;
temp_CF = !!get_CF();
temp_CF = getB_CF();
op2_16 = i->Iw();

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: arith32.cc,v 1.20 2002-09-23 17:59:17 kevinlawton Exp $
// $Id: arith32.cc,v 1.21 2002-09-24 18:33:37 kevinlawton Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -204,7 +204,7 @@ BX_CPU_C::ADC_EdGd(bxInstruction_c *i)
{
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* for 32 bit operand size mode */
@ -242,7 +242,7 @@ BX_CPU_C::ADC_GdEd(bxInstruction_c *i)
{
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* for 32 bit operand size mode */
@ -275,7 +275,7 @@ BX_CPU_C::ADC_EAXId(bxInstruction_c *i)
{
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* for 32 bit operand size mode */
Bit32u op1_32, op2_32, sum_32;
@ -301,7 +301,7 @@ BX_CPU_C::SBB_EdGd(bxInstruction_c *i)
{
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* for 32 bit operand size mode */
@ -339,7 +339,7 @@ BX_CPU_C::SBB_GdEd(bxInstruction_c *i)
{
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* for 32 bit operand size mode */
@ -372,7 +372,7 @@ BX_CPU_C::SBB_EAXId(bxInstruction_c *i)
{
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* for 32 bit operand size mode */
Bit32u op1_32, op2_32, diff_32;
@ -397,7 +397,7 @@ BX_CPU_C::SBB_EdId(bxInstruction_c *i)
{
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* for 32 bit operand size mode */
@ -775,7 +775,7 @@ BX_CPU_C::ADC_EdId(bxInstruction_c *i)
{
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* for 32 bit operand size mode */
Bit32u op2_32, op1_32, sum_32;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: arith64.cc,v 1.8 2002-09-23 14:25:08 bdenney Exp $
// $Id: arith64.cc,v 1.9 2002-09-24 18:33:37 kevinlawton Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -138,7 +138,7 @@ BX_CPU_C::ADC_EqGq(bxInstruction_c *i)
{
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* for 64 bit operand size mode */
@ -176,7 +176,7 @@ BX_CPU_C::ADC_GqEq(bxInstruction_c *i)
{
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* for 64 bit operand size mode */
@ -209,7 +209,7 @@ BX_CPU_C::ADC_RAXId(bxInstruction_c *i)
{
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* for 64 bit operand size mode */
Bit64u op1_64, op2_64, sum_64;
@ -235,7 +235,7 @@ BX_CPU_C::SBB_EqGq(bxInstruction_c *i)
{
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* for 64 bit operand size mode */
@ -273,7 +273,7 @@ BX_CPU_C::SBB_GqEq(bxInstruction_c *i)
{
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* for 64 bit operand size mode */
@ -306,7 +306,7 @@ BX_CPU_C::SBB_RAXId(bxInstruction_c *i)
{
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* for 64 bit operand size mode */
Bit64u op1_64, op2_64, diff_64;
@ -331,7 +331,7 @@ BX_CPU_C::SBB_EqId(bxInstruction_c *i)
{
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* for 64 bit operand size mode */
@ -652,7 +652,7 @@ BX_CPU_C::ADC_EqId(bxInstruction_c *i)
{
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* for 64 bit operand size mode */
Bit64u op2_64, op1_64, sum_64;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: arith8.cc,v 1.16 2002-09-23 17:59:17 kevinlawton Exp $
// $Id: arith8.cc,v 1.17 2002-09-24 18:33:37 kevinlawton Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -119,7 +119,7 @@ BX_CPU_C::ADC_EbGb(bxInstruction_c *i)
Bit8u op2, op1, sum;
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* op2 is a register, RMAddr(i) is an index of a register */
@ -155,7 +155,7 @@ BX_CPU_C::ADC_GbEb(bxInstruction_c *i)
Bit8u op1, op2, sum;
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* op1 is a register, RMAddr(i) is an index of a register */
@ -186,7 +186,7 @@ BX_CPU_C::ADC_ALIb(bxInstruction_c *i)
Bit8u op1, op2, sum;
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
op1 = AL;
@ -209,7 +209,7 @@ BX_CPU_C::SBB_EbGb(bxInstruction_c *i)
Bit8u op2_8, op1_8, diff_8;
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* op2 is a register, RMAddr(i) is an index of a register */
@ -245,7 +245,7 @@ BX_CPU_C::SBB_GbEb(bxInstruction_c *i)
Bit8u op1_8, op2_8, diff_8;
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
/* op1 is a register, RMAddr(i) is an index of a register */
@ -276,7 +276,7 @@ BX_CPU_C::SBB_ALIb(bxInstruction_c *i)
Bit8u op1_8, op2_8, diff_8;
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
op1_8 = AL;
@ -299,7 +299,7 @@ BX_CPU_C::SBB_EbIb(bxInstruction_c *i)
Bit8u op2_8, op1_8, diff_8;
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
op2_8 = i->Ib();
@ -596,7 +596,7 @@ BX_CPU_C::ADC_EbIb(bxInstruction_c *i)
Bit8u op2, op1, sum;
Boolean temp_CF;
temp_CF = !!get_CF();
temp_CF = getB_CF();
op2 = i->Ib();

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.cc,v 1.51 2002-09-22 23:42:01 kevinlawton Exp $
// $Id: cpu.cc,v 1.52 2002-09-24 18:33:37 kevinlawton Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -898,9 +898,9 @@ BX_CPU_C::dbg_is_begin_instr_bpoint(Bit32u cs, Bit32u eip, Bit32u laddr,
// Downside is that we show the instruction about to be executed
// (not the one generating the mode switch).
if (BX_CPU_THIS_PTR mode_break &&
(BX_CPU_THIS_PTR debug_vm != !!BX_CPU_THIS_PTR get_VM ())) {
(BX_CPU_THIS_PTR debug_vm != BX_CPU_THIS_PTR getB_VM ())) {
BX_INFO(("Caught vm mode switch breakpoint"));
BX_CPU_THIS_PTR debug_vm = !!BX_CPU_THIS_PTR get_VM ();
BX_CPU_THIS_PTR debug_vm = BX_CPU_THIS_PTR getB_VM ();
BX_CPU_THIS_PTR stop_reason = STOP_MODE_BREAK_POINT;
return 1;
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.h,v 1.77 2002-09-24 16:39:33 kevinlawton Exp $
// $Id: cpu.h,v 1.78 2002-09-24 18:33:37 kevinlawton Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -413,6 +413,7 @@ typedef struct {
BX_CPP_INLINE void assert_VM(); \
BX_CPP_INLINE void clear_VM(); \
BX_CPP_INLINE Boolean get_VM(); \
BX_CPP_INLINE Boolean getB_VM(); \
BX_CPP_INLINE void set_VM(Bit32u val);
#define IMPLEMENT_EFLAG_ACCESSOR_VM(bitnum) \
@ -427,6 +428,9 @@ typedef struct {
BX_CPP_INLINE Boolean BX_CPU_C::get_VM() { \
return BX_CPU_THIS_PTR eflags.VM_cached; \
} \
BX_CPP_INLINE Boolean BX_CPU_C::getB_VM() { \
return (BX_CPU_THIS_PTR eflags.VM_cached>0); \
} \
BX_CPP_INLINE void BX_CPU_C::set_VM(Bit32u val) { \
BX_CPU_THIS_PTR eflags.val32 = \
(BX_CPU_THIS_PTR eflags.val32&~(1<<bitnum)) | (val ? (1<<bitnum) : 0); \

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: debugstuff.cc,v 1.19 2002-09-23 22:10:00 bdenney Exp $
// $Id: debugstuff.cc,v 1.20 2002-09-24 18:33:38 kevinlawton Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -226,9 +226,9 @@ BX_CPU_C::dbg_set_reg(unsigned reg, Bit32u val)
return(0);
}
// make sure none of the system bits are being changed
current_sys_bits = ((!!BX_CPU_THIS_PTR get_NT()) << 14) |
current_sys_bits = ((BX_CPU_THIS_PTR getB_NT()) << 14) |
(BX_CPU_THIS_PTR get_IOPL () << 12) |
((!!BX_CPU_THIS_PTR get_TF()) << 8);
((BX_CPU_THIS_PTR getB_TF()) << 8);
if ( current_sys_bits != (val & 0x0000f100) ) {
BX_INFO(("dbg_set_reg: can not modify NT, IOPL, or TF."));
return(0);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: io_pro.cc,v 1.9 2002-09-22 18:22:24 kevinlawton Exp $
// $Id: io_pro.cc,v 1.10 2002-09-24 18:33:38 kevinlawton Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -163,7 +163,7 @@ BX_CPU_C::allow_io(Bit16u addr, unsigned len)
&io_base);
if (io_base <= 103) {
BX_INFO(("PE is %u", BX_CPU_THIS_PTR cr0.pe));
BX_INFO(("VM is %u", !! BX_CPU_THIS_PTR get_VM ()));
BX_INFO(("VM is %u", BX_CPU_THIS_PTR getB_VM ()));
BX_INFO(("CPL is %u", CPL));
BX_INFO(("IOPL is %u", BX_CPU_THIS_PTR get_IOPL ()));
BX_INFO(("addr is %u", addr));

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: dbg_main.cc,v 1.67 2002-09-23 17:53:47 bdenney Exp $
// $Id: dbg_main.cc,v 1.68 2002-09-24 18:33:38 kevinlawton Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -1013,7 +1013,7 @@ bx_dbg_playback_command(char* path_quoted)
void
bx_dbg_modebp_command(char* dummy)
{
BX_CPU(dbg_cpu)->debug_vm = !!BX_CPU(dbg_cpu)->get_VM ();
BX_CPU(dbg_cpu)->debug_vm = BX_CPU(dbg_cpu)->getB_VM ();
BX_CPU(dbg_cpu)->mode_break = !BX_CPU(dbg_cpu)->mode_break;
dbg_printf (" mode switch break %s\n",
BX_CPU(dbg_cpu)->mode_break ? "enabled" : "disabled");
@ -1217,7 +1217,7 @@ void bx_dbg_show_command(char* arg)
BX_CPU(dbg_cpu)->show_flag = 0;
last_cr3 = BX_CPU(dbg_cpu)->cr3;
last_pe = BX_CPU(dbg_cpu)->cr0.pe;
last_vm = !!BX_CPU(dbg_cpu)->get_VM ();
last_vm = BX_CPU(dbg_cpu)->getB_VM ();
dbg_printf ("%10lld: address %04x:%08x %08x\n\n",
bx_pc_system.time_ticks(),
@ -2158,19 +2158,19 @@ void bx_dbg_disassemble_current (int which_cpu, int print_time)
BX_CPU(which_cpu)->get_EBP (),
BX_CPU(which_cpu)->get_ESI (),
BX_CPU(which_cpu)->get_EDI (),
!!BX_CPU(which_cpu)->get_CF(),
!!BX_CPU(which_cpu)->get_AF(),
!!BX_CPU(which_cpu)->get_ZF(),
!!BX_CPU(which_cpu)->get_SF(),
!!BX_CPU(which_cpu)->get_OF(),
!!BX_CPU(which_cpu)->get_PF(),
BX_CPU(which_cpu)->getB_CF(),
BX_CPU(which_cpu)->getB_AF(),
BX_CPU(which_cpu)->getB_ZF(),
BX_CPU(which_cpu)->getB_SF(),
BX_CPU(which_cpu)->getB_OF(),
BX_CPU(which_cpu)->getB_PF(),
BX_CPU(which_cpu)->get_TF (),
BX_CPU(which_cpu)->get_IF (),
BX_CPU(which_cpu)->get_DF (),
BX_CPU(which_cpu)->get_IOPL (),
BX_CPU(which_cpu)->get_NT (),
BX_CPU(which_cpu)->get_RF (),
!!BX_CPU(which_cpu)->get_VM ());
BX_CPU(which_cpu)->get_BVM ());
if (print_time)
dbg_printf ( "(%u).[%lld] ", which_cpu, bx_pc_system.time_ticks());
@ -4482,7 +4482,7 @@ bx_dbg_symbolic_output(void)
last_pe = !last_pe;
}
if(last_vm != !!BX_CPU(dbg_cpu)->get_VM ()) {
if(last_vm != BX_CPU(dbg_cpu)->getB_VM ()) {
dbg_printf ("%10lld: %s V86 mode\n",
bx_pc_system.time_ticks(),
last_vm ? "Exited" : "Entered");