fixed #DB on rpeat instructions

This commit is contained in:
Stanislav Shwartsman 2009-10-30 09:13:19 +00:00
parent 98b51805d5
commit 6f0db17b08
6 changed files with 42 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.cc,v 1.295 2009-10-24 11:24:21 sshwarts Exp $
// $Id: cpu.cc,v 1.296 2009-10-30 09:13:18 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -218,6 +218,10 @@ void BX_CPP_AttrRegparmN(2) BX_CPU_C::repeat(bxInstruction_c *i, BxExecutePtr_tR
return;
}
#if BX_X86_DEBUGGER
BX_CPU_THIS_PTR in_repeat = 0;
#endif
#if BX_SUPPORT_X86_64
if (i->as64L()) {
while(1) {
@ -274,6 +278,10 @@ void BX_CPP_AttrRegparmN(2) BX_CPU_C::repeat(bxInstruction_c *i, BxExecutePtr_tR
}
}
#if BX_X86_DEBUGGER
BX_CPU_THIS_PTR in_repeat = 1;
#endif
RIP = BX_CPU_THIS_PTR prev_rip; // repeat loop not done, restore RIP
#if BX_SUPPORT_TRACE_CACHE
@ -292,6 +300,10 @@ void BX_CPP_AttrRegparmN(2) BX_CPU_C::repeat_ZF(bxInstruction_c *i, BxExecutePtr
return;
}
#if BX_X86_DEBUGGER
BX_CPU_THIS_PTR in_repeat = 0;
#endif
if (rep == 3) { /* repeat prefix 0xF3 */
#if BX_SUPPORT_X86_64
if (i->as64L()) {
@ -407,6 +419,10 @@ void BX_CPP_AttrRegparmN(2) BX_CPU_C::repeat_ZF(bxInstruction_c *i, BxExecutePtr
}
}
#if BX_X86_DEBUGGER
BX_CPU_THIS_PTR in_repeat = 1;
#endif
RIP = BX_CPU_THIS_PTR prev_rip; // repeat loop not done, restore RIP
#if BX_SUPPORT_TRACE_CACHE
@ -626,7 +642,7 @@ unsigned BX_CPU_C::handleAsyncEvent(void)
else {
// only bother comparing if any breakpoints enabled and
// debug events are not inhibited on this boundary.
if (! (BX_CPU_THIS_PTR inhibit_mask & BX_INHIBIT_DEBUG_SHADOW)) {
if (! (BX_CPU_THIS_PTR inhibit_mask & BX_INHIBIT_DEBUG_SHADOW) && ! BX_CPU_THIS_PTR in_repeat) {
if (BX_CPU_THIS_PTR dr7 & 0x000000ff) {
bx_address iaddr = get_laddr(BX_SEG_REG_CS, BX_CPU_THIS_PTR prev_rip);
Bit32u dr6_bits = hwdebug_compare(iaddr, 1, BX_HWDebugInstruction, BX_HWDebugInstruction);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.h,v 1.617 2009-10-29 15:49:50 sshwarts Exp $
// $Id: cpu.h,v 1.618 2009-10-30 09:13:18 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -922,6 +922,9 @@ public: // for now...
#define BX_ASYNC_EVENT_STOP_TRACE (0x80000000)
#endif
#if BX_X86_DEBUGGER
bx_bool in_repeat;
#endif
bx_bool in_smm;
unsigned cpu_mode;
bx_bool user_pl;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: debugstuff.cc,v 1.106 2009-10-29 15:49:50 sshwarts Exp $
// $Id: debugstuff.cc,v 1.107 2009-10-30 09:13:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -276,7 +276,6 @@ void BX_CPU_C::debug(bx_address offset)
bx_bool BX_CPU_C::dbg_set_reg(unsigned reg, Bit32u val)
{
// returns 1=OK, 0=can't change
bx_segment_reg_t *seg;
Bit32u current_sys_bits;
switch (reg) {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: exception.cc,v 1.142 2009-10-26 15:53:24 sshwarts Exp $
// $Id: exception.cc,v 1.143 2009-10-30 09:13:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -839,6 +839,10 @@ void BX_CPU_C::interrupt(Bit8u vector, unsigned type, bx_bool push_error, Bit16u
}
}
#if BX_X86_DEBUGGER
BX_CPU_THIS_PTR in_repeat = 0;
#endif
#if BX_SUPPORT_VMX
BX_CPU_THIS_PTR in_event = 0;
#endif

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: init.cc,v 1.218 2009-10-16 18:29:45 sshwarts Exp $
// $Id: init.cc,v 1.219 2009-10-30 09:13:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -528,8 +528,12 @@ void BX_CPU_C::register_state(void)
#endif
BXRS_HEX_PARAM_SIMPLE32(cpu, async_event);
BXRS_PARAM_BOOL(cpu, INTR, INTR);
#if BX_X86_DEBUGGER
BXRS_PARAM_BOOL(cpu, in_repeat, in_repeat);
#endif
BXRS_PARAM_BOOL(cpu, in_smm, in_smm);
BXRS_PARAM_BOOL(cpu, disable_SMI, disable_SMI);
BXRS_PARAM_BOOL(cpu, pending_SMI, pending_SMI);
@ -869,6 +873,9 @@ void BX_CPU_C::reset(unsigned source)
# error "DR6: CPU > 6"
#endif
#if BX_X86_DEBUGGER
BX_CPU_THIS_PTR in_repeat = 0;
#endif
BX_CPU_THIS_PTR in_smm = 0;
BX_CPU_THIS_PTR disable_SMI = 0;
BX_CPU_THIS_PTR pending_SMI = 0;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: proc_ctrl.cc,v 1.305 2009-10-07 15:45:15 sshwarts Exp $
// $Id: proc_ctrl.cc,v 1.306 2009-10-30 09:13:19 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -1493,6 +1493,10 @@ bx_address get_cr4_allow_mask(void)
allowMask |= (1<<13); /* VMX Enable */
#endif
#if BX_SUPPORT_SMX
allowMask |= (1<<14); /* SMX Enable */
#endif
#if BX_SUPPORT_XSAVE
allowMask |= (1<<18); /* OSXSAVE */
#endif