Changes for lazy flags handling -> 1st stap in transition to new lazy flags handling by Darek Mihocka (www.emulators.com)
This commit is contained in:
parent
40fc0a3e42
commit
88899cf617
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: arith16.cc,v 1.58 2007-12-01 16:45:15 sshwarts Exp $
|
||||
// $Id: arith16.cc,v 1.59 2007-12-04 19:27:22 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -35,13 +35,13 @@
|
||||
void BX_CPU_C::INC_RX(bxInstruction_c *i)
|
||||
{
|
||||
Bit16u rx = ++BX_READ_16BIT_REG(i->opcodeReg());
|
||||
SET_FLAGS_OSZAP_RESULT_16(rx, BX_INSTR_INC16);
|
||||
SET_FLAGS_OSZAPC_INC_16(rx);
|
||||
}
|
||||
|
||||
void BX_CPU_C::DEC_RX(bxInstruction_c *i)
|
||||
{
|
||||
Bit16u rx = --BX_READ_16BIT_REG(i->opcodeReg());
|
||||
SET_FLAGS_OSZAP_RESULT_16(rx, BX_INSTR_DEC16);
|
||||
SET_FLAGS_OSZAPC_DEC_16(rx);
|
||||
}
|
||||
|
||||
void BX_CPU_C::ADD_EwGwM(bxInstruction_c *i)
|
||||
@ -561,7 +561,7 @@ void BX_CPU_C::INC_EwM(bxInstruction_c *i)
|
||||
op1_16++;
|
||||
write_RMW_virtual_word(op1_16);
|
||||
|
||||
SET_FLAGS_OSZAP_RESULT_16(op1_16, BX_INSTR_INC16);
|
||||
SET_FLAGS_OSZAPC_INC_16(op1_16);
|
||||
}
|
||||
|
||||
void BX_CPU_C::INC_EwR(bxInstruction_c *i)
|
||||
@ -570,7 +570,7 @@ void BX_CPU_C::INC_EwR(bxInstruction_c *i)
|
||||
op1_16++;
|
||||
BX_WRITE_16BIT_REG(i->rm(), op1_16);
|
||||
|
||||
SET_FLAGS_OSZAP_RESULT_16(op1_16, BX_INSTR_INC16);
|
||||
SET_FLAGS_OSZAPC_INC_16(op1_16);
|
||||
}
|
||||
|
||||
void BX_CPU_C::DEC_EwM(bxInstruction_c *i)
|
||||
@ -581,7 +581,7 @@ void BX_CPU_C::DEC_EwM(bxInstruction_c *i)
|
||||
op1_16--;
|
||||
write_RMW_virtual_word(op1_16);
|
||||
|
||||
SET_FLAGS_OSZAP_RESULT_16(op1_16, BX_INSTR_DEC16);
|
||||
SET_FLAGS_OSZAPC_DEC_16(op1_16);
|
||||
}
|
||||
|
||||
void BX_CPU_C::DEC_EwR(bxInstruction_c *i)
|
||||
@ -590,7 +590,7 @@ void BX_CPU_C::DEC_EwR(bxInstruction_c *i)
|
||||
op1_16--;
|
||||
BX_WRITE_16BIT_REG(i->rm(), op1_16);
|
||||
|
||||
SET_FLAGS_OSZAP_RESULT_16(op1_16, BX_INSTR_DEC16);
|
||||
SET_FLAGS_OSZAPC_DEC_16(op1_16);
|
||||
}
|
||||
|
||||
void BX_CPU_C::CMPXCHG_EwGwM(bxInstruction_c *i)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: arith32.cc,v 1.65 2007-12-03 20:48:02 sshwarts Exp $
|
||||
// $Id: arith32.cc,v 1.66 2007-12-04 19:27:22 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -42,14 +42,14 @@
|
||||
void BX_CPU_C::INC_ERX(bxInstruction_c *i)
|
||||
{
|
||||
Bit32u erx = ++BX_READ_32BIT_REG(i->opcodeReg());
|
||||
SET_FLAGS_OSZAP_RESULT_32(erx, BX_INSTR_INC32);
|
||||
SET_FLAGS_OSZAPC_INC_32(erx);
|
||||
BX_CLEAR_64BIT_HIGH(i->opcodeReg());
|
||||
}
|
||||
|
||||
void BX_CPU_C::DEC_ERX(bxInstruction_c *i)
|
||||
{
|
||||
Bit32u erx = --BX_READ_32BIT_REG(i->opcodeReg());
|
||||
SET_FLAGS_OSZAP_RESULT_32(erx, BX_INSTR_DEC32);
|
||||
SET_FLAGS_OSZAPC_DEC_32(erx);
|
||||
BX_CLEAR_64BIT_HIGH(i->opcodeReg());
|
||||
}
|
||||
|
||||
@ -615,7 +615,7 @@ void BX_CPU_C::INC_EdM(bxInstruction_c *i)
|
||||
op1_32++;
|
||||
write_RMW_virtual_dword(op1_32);
|
||||
|
||||
SET_FLAGS_OSZAP_RESULT_32(op1_32, BX_INSTR_INC32);
|
||||
SET_FLAGS_OSZAPC_INC_32(op1_32);
|
||||
}
|
||||
|
||||
void BX_CPU_C::INC_EdR(bxInstruction_c *i)
|
||||
@ -624,7 +624,7 @@ void BX_CPU_C::INC_EdR(bxInstruction_c *i)
|
||||
op1_32++;
|
||||
BX_WRITE_32BIT_REGZ(i->rm(), op1_32);
|
||||
|
||||
SET_FLAGS_OSZAP_RESULT_32(op1_32, BX_INSTR_INC32);
|
||||
SET_FLAGS_OSZAPC_INC_32(op1_32);
|
||||
}
|
||||
|
||||
void BX_CPU_C::DEC_EdM(bxInstruction_c *i)
|
||||
@ -635,7 +635,7 @@ void BX_CPU_C::DEC_EdM(bxInstruction_c *i)
|
||||
op1_32--;
|
||||
write_RMW_virtual_dword(op1_32);
|
||||
|
||||
SET_FLAGS_OSZAP_RESULT_32(op1_32, BX_INSTR_DEC32);
|
||||
SET_FLAGS_OSZAPC_DEC_32(op1_32);
|
||||
}
|
||||
|
||||
void BX_CPU_C::DEC_EdR(bxInstruction_c *i)
|
||||
@ -644,7 +644,7 @@ void BX_CPU_C::DEC_EdR(bxInstruction_c *i)
|
||||
op1_32--;
|
||||
BX_WRITE_32BIT_REGZ(i->rm(), op1_32);
|
||||
|
||||
SET_FLAGS_OSZAP_RESULT_32(op1_32, BX_INSTR_DEC32);
|
||||
SET_FLAGS_OSZAPC_DEC_32(op1_32);
|
||||
}
|
||||
|
||||
void BX_CPU_C::CMPXCHG_EdGdM(bxInstruction_c *i)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: arith64.cc,v 1.41 2007-12-03 20:48:02 sshwarts Exp $
|
||||
// $Id: arith64.cc,v 1.42 2007-12-04 19:27:22 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -597,7 +597,7 @@ void BX_CPU_C::INC_EqM(bxInstruction_c *i)
|
||||
op1_64++;
|
||||
write_RMW_virtual_qword(op1_64);
|
||||
|
||||
SET_FLAGS_OSZAP_RESULT_64(op1_64, BX_INSTR_INC64);
|
||||
SET_FLAGS_OSZAPC_INC_64(op1_64);
|
||||
}
|
||||
|
||||
void BX_CPU_C::INC_EqR(bxInstruction_c *i)
|
||||
@ -606,7 +606,7 @@ void BX_CPU_C::INC_EqR(bxInstruction_c *i)
|
||||
op1_64++;
|
||||
BX_WRITE_64BIT_REG(i->rm(), op1_64);
|
||||
|
||||
SET_FLAGS_OSZAP_RESULT_64(op1_64, BX_INSTR_INC64);
|
||||
SET_FLAGS_OSZAPC_INC_64(op1_64);
|
||||
}
|
||||
|
||||
void BX_CPU_C::DEC_EqM(bxInstruction_c *i)
|
||||
@ -618,7 +618,7 @@ void BX_CPU_C::DEC_EqM(bxInstruction_c *i)
|
||||
op1_64--;
|
||||
write_RMW_virtual_qword(op1_64);
|
||||
|
||||
SET_FLAGS_OSZAP_RESULT_64(op1_64, BX_INSTR_DEC64);
|
||||
SET_FLAGS_OSZAPC_DEC_64(op1_64);
|
||||
}
|
||||
|
||||
void BX_CPU_C::DEC_EqR(bxInstruction_c *i)
|
||||
@ -627,7 +627,7 @@ void BX_CPU_C::DEC_EqR(bxInstruction_c *i)
|
||||
op1_64--;
|
||||
BX_WRITE_64BIT_REG(i->rm(), op1_64);
|
||||
|
||||
SET_FLAGS_OSZAP_RESULT_64(op1_64, BX_INSTR_DEC64);
|
||||
SET_FLAGS_OSZAPC_DEC_64(op1_64);
|
||||
}
|
||||
|
||||
void BX_CPU_C::CMPXCHG_EqGqM(bxInstruction_c *i)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: arith8.cc,v 1.49 2007-12-01 16:45:16 sshwarts Exp $
|
||||
// $Id: arith8.cc,v 1.50 2007-12-04 19:27:22 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -525,22 +525,22 @@ void BX_CPU_C::NEG_EbR(bxInstruction_c *i)
|
||||
|
||||
void BX_CPU_C::INC_EbM(bxInstruction_c *i)
|
||||
{
|
||||
Bit8u op1;
|
||||
Bit8u op1_8;
|
||||
|
||||
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1);
|
||||
op1++;
|
||||
write_RMW_virtual_byte(op1);
|
||||
read_RMW_virtual_byte(i->seg(), RMAddr(i), &op1_8);
|
||||
op1_8++;
|
||||
write_RMW_virtual_byte(op1_8);
|
||||
|
||||
SET_FLAGS_OSZAP_RESULT_8(op1, BX_INSTR_INC8);
|
||||
SET_FLAGS_OSZAPC_INC_8(op1_8);
|
||||
}
|
||||
|
||||
void BX_CPU_C::INC_EbR(bxInstruction_c *i)
|
||||
{
|
||||
Bit8u op1 = BX_READ_8BIT_REGx(i->rm(), i->extend8bitL());
|
||||
op1++;
|
||||
BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), op1);
|
||||
Bit8u op1_8 = BX_READ_8BIT_REGx(i->rm(), i->extend8bitL());
|
||||
op1_8++;
|
||||
BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), op1_8);
|
||||
|
||||
SET_FLAGS_OSZAP_RESULT_8(op1, BX_INSTR_INC8);
|
||||
SET_FLAGS_OSZAPC_INC_8(op1_8);
|
||||
}
|
||||
|
||||
void BX_CPU_C::DEC_EbM(bxInstruction_c *i)
|
||||
@ -551,7 +551,7 @@ void BX_CPU_C::DEC_EbM(bxInstruction_c *i)
|
||||
op1_8--;
|
||||
write_RMW_virtual_byte(op1_8);
|
||||
|
||||
SET_FLAGS_OSZAP_RESULT_8(op1_8, BX_INSTR_DEC8);
|
||||
SET_FLAGS_OSZAPC_DEC_8(op1_8);
|
||||
}
|
||||
|
||||
void BX_CPU_C::DEC_EbR(bxInstruction_c *i)
|
||||
@ -560,7 +560,7 @@ void BX_CPU_C::DEC_EbR(bxInstruction_c *i)
|
||||
op1_8--;
|
||||
BX_WRITE_8BIT_REGx(i->rm(), i->extend8bitL(), op1_8);
|
||||
|
||||
SET_FLAGS_OSZAP_RESULT_8(op1_8, BX_INSTR_DEC8);
|
||||
SET_FLAGS_OSZAPC_DEC_8(op1_8);
|
||||
}
|
||||
|
||||
void BX_CPU_C::CMPXCHG_EbGbM(bxInstruction_c *i)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cpu.cc,v 1.185 2007-12-03 21:43:14 sshwarts Exp $
|
||||
// $Id: cpu.cc,v 1.186 2007-12-04 19:27:22 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -60,16 +60,16 @@ void flushICaches(void)
|
||||
#define InstrumentICACHE 0
|
||||
|
||||
#if InstrumentICACHE
|
||||
static unsigned iCacheLookups=0;
|
||||
static unsigned iCacheMisses=0;
|
||||
static Bit32u iCacheLookups=0;
|
||||
static Bit32u iCacheMisses=0;
|
||||
|
||||
#define InstrICache_StatsMask 0xffffff
|
||||
#define InstrICache_StatsMask 0xfffffff
|
||||
|
||||
#define InstrICache_Stats() {\
|
||||
if ((iCacheLookups & InstrICache_StatsMask) == 0) { \
|
||||
BX_INFO(("ICACHE lookups: %u, misses: %u, hit rate = %6.2f%% ", \
|
||||
iCacheLookups, \
|
||||
iCacheMisses, \
|
||||
(unsigned) iCacheLookups, \
|
||||
(unsigned) iCacheMisses, \
|
||||
(iCacheLookups-iCacheMisses) * 100.0 / iCacheLookups)); \
|
||||
iCacheLookups = iCacheMisses = 0; \
|
||||
} \
|
||||
@ -86,7 +86,6 @@ static unsigned iCacheMisses=0;
|
||||
// Make code more tidy with a few macros.
|
||||
#if BX_SUPPORT_X86_64==0
|
||||
#define RIP EIP
|
||||
#define RSP ESP
|
||||
#define RCX ECX
|
||||
#endif
|
||||
|
||||
|
104
bochs/cpu/cpu.h
104
bochs/cpu/cpu.h
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cpu.h,v 1.380 2007-12-03 20:49:24 sshwarts Exp $
|
||||
// $Id: cpu.h,v 1.381 2007-12-04 19:27:22 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -1093,11 +1093,9 @@ public: // for now...
|
||||
bx_eip_reg_t eip_reg;
|
||||
|
||||
// status and control flags register set
|
||||
Bit32u lf_flags_status;
|
||||
bx_flags_reg_t eflags;
|
||||
|
||||
Bit32u lf_flags_status;
|
||||
bx_lf_flags_entry oszapc;
|
||||
bx_lf_flags_entry oszap;
|
||||
|
||||
// so that we can back up when handling faults, exceptions, etc.
|
||||
// we need to store the value of the instruction pointer, before
|
||||
@ -1282,13 +1280,6 @@ public: // for now...
|
||||
|
||||
BX_SMF void setEFlags(Bit32u val) BX_CPP_AttrRegparmN(1);
|
||||
|
||||
#define lfMaskCF 0x0000000f
|
||||
#define lfMaskPF 0x000000f0
|
||||
#define lfMaskAF 0x00000f00
|
||||
#define lfMaskZF 0x0000f000
|
||||
#define lfMaskSF 0x000f0000
|
||||
#define lfMaskOF 0x00f00000
|
||||
|
||||
#define ArithmeticalFlag(flag, lfMask, eflagsBitShift) \
|
||||
BX_SMF bx_bool get_##flag##Lazy(void); \
|
||||
BX_SMF bx_bool getB_##flag(void) { \
|
||||
@ -1299,30 +1290,35 @@ public: // for now...
|
||||
} \
|
||||
BX_SMF bx_bool get_##flag(void) { \
|
||||
if ( (BX_CPU_THIS_PTR lf_flags_status & (lfMask)) == 0) \
|
||||
return BX_CPU_THIS_PTR eflags.val32 & (1<<eflagsBitShift); \
|
||||
return BX_CPU_THIS_PTR eflags.val32 & (lfMask); \
|
||||
else \
|
||||
return get_##flag##Lazy(); \
|
||||
} \
|
||||
BX_SMF void set_##flag(bx_bool val) { \
|
||||
BX_CPU_THIS_PTR lf_flags_status &= ~(lfMask); \
|
||||
BX_CPU_THIS_PTR eflags.val32 &= ~(1<<eflagsBitShift); \
|
||||
BX_CPU_THIS_PTR eflags.val32 &= ~(lfMask); \
|
||||
BX_CPU_THIS_PTR eflags.val32 |= ((val)<<eflagsBitShift); \
|
||||
} \
|
||||
BX_SMF void clear_##flag(void) { \
|
||||
BX_CPU_THIS_PTR lf_flags_status &= ~(lfMask); \
|
||||
BX_CPU_THIS_PTR eflags.val32 &= ~(1<<eflagsBitShift); \
|
||||
BX_CPU_THIS_PTR eflags.val32 &= ~(lfMask); \
|
||||
} \
|
||||
BX_SMF void assert_##flag(void) { \
|
||||
BX_CPU_THIS_PTR lf_flags_status &= ~(lfMask); \
|
||||
BX_CPU_THIS_PTR eflags.val32 |= (1<<eflagsBitShift); \
|
||||
BX_CPU_THIS_PTR eflags.val32 |= (lfMask); \
|
||||
} \
|
||||
BX_SMF void force_##flag(void) { \
|
||||
if ( (BX_CPU_THIS_PTR lf_flags_status & (lfMask)) != 0) { \
|
||||
set_##flag(!!get_##flag##Lazy()); \
|
||||
} \
|
||||
}
|
||||
|
||||
ArithmeticalFlag(OF, lfMaskOF, 11);
|
||||
ArithmeticalFlag(SF, lfMaskSF, 7);
|
||||
ArithmeticalFlag(ZF, lfMaskZF, 6);
|
||||
ArithmeticalFlag(AF, lfMaskAF, 4);
|
||||
ArithmeticalFlag(PF, lfMaskPF, 2);
|
||||
ArithmeticalFlag(CF, lfMaskCF, 0);
|
||||
ArithmeticalFlag(OF, EFlagsOFMask, 11);
|
||||
ArithmeticalFlag(SF, EFlagsSFMask, 7);
|
||||
ArithmeticalFlag(ZF, EFlagsZFMask, 6);
|
||||
ArithmeticalFlag(AF, EFlagsAFMask, 4);
|
||||
ArithmeticalFlag(PF, EFlagsPFMask, 2);
|
||||
ArithmeticalFlag(CF, EFlagsCFMask, 0);
|
||||
|
||||
BX_SMF BX_CPP_INLINE void set_PF_base(Bit8u val);
|
||||
|
||||
@ -3532,7 +3528,7 @@ BX_CPP_INLINE void BX_CPU_C::set_PF_base(Bit8u val)
|
||||
BX_CPU_THIS_PTR oszapc.op2##size = lf_op2; \
|
||||
BX_CPU_THIS_PTR oszapc.result##size = lf_result; \
|
||||
BX_CPU_THIS_PTR oszapc.instr = ins; \
|
||||
BX_CPU_THIS_PTR lf_flags_status = BX_LF_MASK_OSZAPC; \
|
||||
BX_CPU_THIS_PTR lf_flags_status = EFlagsOSZAPCMask; \
|
||||
}
|
||||
|
||||
#define SET_FLAGS_OSZAPC_8(op1, op2, result, ins) \
|
||||
@ -3551,7 +3547,7 @@ BX_CPP_INLINE void BX_CPU_C::set_PF_base(Bit8u val)
|
||||
BX_CPU_THIS_PTR oszapc.op1##size = lf_op1; \
|
||||
BX_CPU_THIS_PTR oszapc.result##size = lf_result; \
|
||||
BX_CPU_THIS_PTR oszapc.instr = ins; \
|
||||
BX_CPU_THIS_PTR lf_flags_status = BX_LF_MASK_OSZAPC; \
|
||||
BX_CPU_THIS_PTR lf_flags_status = EFlagsOSZAPCMask; \
|
||||
}
|
||||
|
||||
#define SET_FLAGS_OSZAPC_S1_8(op1, result, ins) \
|
||||
@ -3570,7 +3566,7 @@ BX_CPP_INLINE void BX_CPU_C::set_PF_base(Bit8u val)
|
||||
BX_CPU_THIS_PTR oszapc.op2##size = lf_op2; \
|
||||
BX_CPU_THIS_PTR oszapc.result##size = lf_result; \
|
||||
BX_CPU_THIS_PTR oszapc.instr = ins; \
|
||||
BX_CPU_THIS_PTR lf_flags_status = BX_LF_MASK_OSZAPC; \
|
||||
BX_CPU_THIS_PTR lf_flags_status = EFlagsOSZAPCMask; \
|
||||
}
|
||||
|
||||
#define SET_FLAGS_OSZAPC_S2_8(op2, result, ins) \
|
||||
@ -3589,7 +3585,7 @@ BX_CPP_INLINE void BX_CPU_C::set_PF_base(Bit8u val)
|
||||
BX_CPU_THIS_PTR oszapc.op1##size = lf_op1; \
|
||||
BX_CPU_THIS_PTR oszapc.op2##size = lf_op2; \
|
||||
BX_CPU_THIS_PTR oszapc.instr = ins; \
|
||||
BX_CPU_THIS_PTR lf_flags_status = BX_LF_MASK_OSZAPC; \
|
||||
BX_CPU_THIS_PTR lf_flags_status = EFlagsOSZAPCMask; \
|
||||
}
|
||||
|
||||
#define SET_FLAGS_OSZAPC_S1S2_8(op1, op2, ins) \
|
||||
@ -3607,7 +3603,7 @@ BX_CPP_INLINE void BX_CPU_C::set_PF_base(Bit8u val)
|
||||
#define SET_FLAGS_OSZAPC_RESULT_SIZE(size, lf_result, ins) { \
|
||||
BX_CPU_THIS_PTR oszapc.result##size = lf_result; \
|
||||
BX_CPU_THIS_PTR oszapc.instr = ins; \
|
||||
BX_CPU_THIS_PTR lf_flags_status = BX_LF_MASK_OSZAPC; \
|
||||
BX_CPU_THIS_PTR lf_flags_status = EFlagsOSZAPCMask; \
|
||||
}
|
||||
|
||||
#define SET_FLAGS_OSZAPC_RESULT_8(result, ins) \
|
||||
@ -3625,31 +3621,12 @@ BX_CPP_INLINE void BX_CPU_C::set_PF_base(Bit8u val)
|
||||
// OSZAP
|
||||
// *******************
|
||||
|
||||
/* op1, op2, result */
|
||||
#define SET_FLAGS_OSZAP_SIZE(size, lf_op1, lf_op2, lf_result, ins) { \
|
||||
BX_CPU_THIS_PTR oszap.op1##size = lf_op1; \
|
||||
BX_CPU_THIS_PTR oszap.op2##size = lf_op2; \
|
||||
BX_CPU_THIS_PTR oszap.result##size = lf_result; \
|
||||
BX_CPU_THIS_PTR oszap.instr = ins; \
|
||||
BX_CPU_THIS_PTR lf_flags_status = (BX_CPU_THIS_PTR lf_flags_status & 0x00000f) | BX_LF_MASK_OSZAP; \
|
||||
}
|
||||
|
||||
#define SET_FLAGS_OSZAP_8(op1, op2, result, ins) \
|
||||
SET_FLAGS_OSZAP_SIZE(_8, op1, op2, result, ins)
|
||||
#define SET_FLAGS_OSZAP_16(op1, op2, result, ins) \
|
||||
SET_FLAGS_OSZAP_SIZE(_16, op1, op2, result, ins)
|
||||
#define SET_FLAGS_OSZAP_32(op1, op2, result, ins) \
|
||||
SET_FLAGS_OSZAP_SIZE(_32, op1, op2, result, ins)
|
||||
#if BX_SUPPORT_X86_64
|
||||
#define SET_FLAGS_OSZAP_64(op1, op2, result, ins) \
|
||||
SET_FLAGS_OSZAP_SIZE(_64, op1, op2, result, ins)
|
||||
#endif
|
||||
|
||||
/* result only */
|
||||
#define SET_FLAGS_OSZAP_RESULT_SIZE(size, lf_result, ins) { \
|
||||
BX_CPU_THIS_PTR oszap.result##size = lf_result; \
|
||||
BX_CPU_THIS_PTR oszap.instr = ins; \
|
||||
BX_CPU_THIS_PTR lf_flags_status = (BX_CPU_THIS_PTR lf_flags_status & 0x00000f) | BX_LF_MASK_OSZAP; \
|
||||
force_CF(); \
|
||||
BX_CPU_THIS_PTR oszapc.result##size = lf_result; \
|
||||
BX_CPU_THIS_PTR oszapc.instr = ins; \
|
||||
BX_CPU_THIS_PTR lf_flags_status = EFlagsOSZAPMask; \
|
||||
}
|
||||
|
||||
#define SET_FLAGS_OSZAP_RESULT_8(result, ins) \
|
||||
@ -3663,6 +3640,7 @@ BX_CPP_INLINE void BX_CPU_C::set_PF_base(Bit8u val)
|
||||
SET_FLAGS_OSZAP_RESULT_SIZE(_64, result, ins)
|
||||
#endif
|
||||
|
||||
// transition to new lazy flags code
|
||||
#define SET_FLAGS_OSZAPC_LOGIC_8(result_8) \
|
||||
SET_FLAGS_OSZAPC_RESULT_8((result_8), BX_INSTR_LOGIC8)
|
||||
#define SET_FLAGS_OSZAPC_LOGIC_16(result_16) \
|
||||
@ -3696,6 +3674,28 @@ BX_CPP_INLINE void BX_CPU_C::set_PF_base(Bit8u val)
|
||||
SET_FLAGS_OSZAPC_64((op1_64), (op2_64), (diff_64), BX_INSTR_SUB64)
|
||||
#endif
|
||||
|
||||
#define SET_FLAGS_OSZAPC_INC_8(result) \
|
||||
SET_FLAGS_OSZAP_RESULT_SIZE(_8, (result), BX_INSTR_INC8)
|
||||
#define SET_FLAGS_OSZAPC_INC_16(result) \
|
||||
SET_FLAGS_OSZAP_RESULT_SIZE(_16, (result), BX_INSTR_INC16)
|
||||
#define SET_FLAGS_OSZAPC_INC_32(result) \
|
||||
SET_FLAGS_OSZAP_RESULT_SIZE(_32, (result), BX_INSTR_INC32)
|
||||
#if BX_SUPPORT_X86_64
|
||||
#define SET_FLAGS_OSZAPC_INC_64(result) \
|
||||
SET_FLAGS_OSZAP_RESULT_SIZE(_64, (result), BX_INSTR_INC64)
|
||||
#endif
|
||||
|
||||
#define SET_FLAGS_OSZAPC_DEC_8(result) \
|
||||
SET_FLAGS_OSZAP_RESULT_SIZE(_8, (result), BX_INSTR_DEC8)
|
||||
#define SET_FLAGS_OSZAPC_DEC_16(result) \
|
||||
SET_FLAGS_OSZAP_RESULT_SIZE(_16, (result), BX_INSTR_DEC16)
|
||||
#define SET_FLAGS_OSZAPC_DEC_32(result) \
|
||||
SET_FLAGS_OSZAP_RESULT_SIZE(_32, (result), BX_INSTR_DEC32)
|
||||
#if BX_SUPPORT_X86_64
|
||||
#define SET_FLAGS_OSZAPC_DEC_64(result) \
|
||||
SET_FLAGS_OSZAP_RESULT_SIZE(_64, (result), BX_INSTR_DEC64)
|
||||
#endif
|
||||
|
||||
IMPLEMENT_EFLAG_ACCESSOR (ID, 21)
|
||||
IMPLEMENT_EFLAG_ACCESSOR (VIP, 20)
|
||||
IMPLEMENT_EFLAG_ACCESSOR (VIF, 19)
|
||||
@ -3782,12 +3782,6 @@ IMPLEMENT_EFLAG_ACCESSOR (TF, 8)
|
||||
BX_CPU_THIS_PTR lf_flags_status = 0; \
|
||||
}
|
||||
|
||||
#define SET_FLAGS_OxxxxC(new_of, new_cf) { \
|
||||
BX_CPU_THIS_PTR eflags.val32 &= ~((1<<11) | (1<<0)); \
|
||||
BX_CPU_THIS_PTR eflags.val32 |= ((!!new_of)<<11) | ((!!new_cf)<<0); \
|
||||
BX_CPU_THIS_PTR lf_flags_status &= 0x0ffff0; \
|
||||
}
|
||||
|
||||
#define ASSERT_FLAGS_OxxxxC() { \
|
||||
BX_CPU_THIS_PTR eflags.val32 |= (EFlagsOFMask | EFlagsCFMask); \
|
||||
BX_CPU_THIS_PTR lf_flags_status &= ~(EFlagsOFMask | EFlagsCFMask); \
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: lazy_flags.h,v 1.25 2007-11-29 21:52:16 sshwarts Exp $
|
||||
// $Id: lazy_flags.h,v 1.26 2007-12-04 19:27:23 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -109,11 +109,13 @@
|
||||
#define BX_INSTR_IMUL32 55
|
||||
#define BX_INSTR_IMUL64 56
|
||||
|
||||
#define BX_LF_INDEX_OSZAPC 1
|
||||
#define BX_LF_INDEX_OSZAP 2
|
||||
|
||||
#define BX_LF_MASK_OSZAPC 0x111111
|
||||
#define BX_LF_MASK_OSZAP 0x222220
|
||||
#if BX_SUPPORT_X86_64
|
||||
#define BX_LF_SIGN_BIT 63
|
||||
#define BX_LF_SIGN_MASK BX_CONST64(0x8000000000000000)
|
||||
#else
|
||||
#define BX_LF_SIGN_BIT 31
|
||||
#define BX_LF_SIGN_MASK 0x80000000
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
Bit8u op1_8;
|
||||
|
Loading…
Reference in New Issue
Block a user