small fixes

This commit is contained in:
Stanislav Shwartsman 2009-05-07 12:00:02 +00:00
parent 8adeb0050f
commit 6fe6da5f25
3 changed files with 47 additions and 16 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: cpu.cc,v 1.289 2009-04-18 21:09:50 sshwarts Exp $ // $Id: cpu.cc,v 1.290 2009-05-07 12:00:02 sshwarts Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -656,11 +656,16 @@ unsigned BX_CPU_C::handleAsyncEvent(void)
BX_CPU_THIS_PTR debug_trap || BX_CPU_THIS_PTR debug_trap ||
BX_HRQ || BX_HRQ ||
BX_CPU_THIS_PTR get_TF() BX_CPU_THIS_PTR get_TF()
#if BX_X86_DEBUGGER
|| (BX_CPU_THIS_PTR dr7 & 0xff)
#endif
#if BX_SUPPORT_VMX #if BX_SUPPORT_VMX
|| (BX_CPU_THIS_PTR vmx_interrupt_window) || BX_CPU_THIS_PTR vmx_interrupt_window
#endif
#if BX_X86_DEBUGGER
// any debug code breakpoint is set
|| ((BX_CPU_THIS_PTR dr7 & 0xff) &&
(((BX_CPU_THIS_PTR dr7 >> 16) & 3) == 0 ||
((BX_CPU_THIS_PTR dr7 >> 20) & 3) == 0 ||
((BX_CPU_THIS_PTR dr7 >> 24) & 3) == 0 ||
((BX_CPU_THIS_PTR dr7 >> 28) & 3) == 0))
#endif #endif
)) ))
BX_CPU_THIS_PTR async_event = 0; BX_CPU_THIS_PTR async_event = 0;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: proc_ctrl.cc,v 1.295 2009-04-07 16:12:19 sshwarts Exp $ // $Id: proc_ctrl.cc,v 1.296 2009-05-07 12:00:02 sshwarts Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -345,10 +345,18 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_DdRd(bxInstruction_c *i)
BX_CPU_THIS_PTR dr7 = (val_32 & 0xffff2fff) | 0x00000400; BX_CPU_THIS_PTR dr7 = (val_32 & 0xffff2fff) | 0x00000400;
#endif #endif
#if BX_X86_DEBUGGER #if BX_X86_DEBUGGER
// if we have breakpoints enabled then we must check // if we have code breakpoints enabled then we must check
// breakpoints condition in cpu loop // breakpoints condition in cpu loop
if(BX_CPU_THIS_PTR dr7 & 0xff) if (BX_CPU_THIS_PTR dr7 & 0xff) {
if (((BX_CPU_THIS_PTR dr7 >> 16) & 3) == 0 ||
((BX_CPU_THIS_PTR dr7 >> 20) & 3) == 0 ||
((BX_CPU_THIS_PTR dr7 >> 24) & 3) == 0 ||
((BX_CPU_THIS_PTR dr7 >> 28) & 3) == 0)
{
BX_INFO(("MOV_DdRd(): code breakpoint is set"));
BX_CPU_THIS_PTR async_event = 1; BX_CPU_THIS_PTR async_event = 1;
}
}
#endif #endif
break; break;
@ -519,10 +527,18 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::MOV_DqRq(bxInstruction_c *i)
BX_CPU_THIS_PTR dr7 = (val_64 & 0xffff2fff) | 0x00000400; BX_CPU_THIS_PTR dr7 = (val_64 & 0xffff2fff) | 0x00000400;
#if BX_X86_DEBUGGER #if BX_X86_DEBUGGER
// if we have breakpoints enabled then we must check // if we have code breakpoints enabled then we must check
// breakpoints condition in cpu loop // breakpoints condition in cpu loop
if(BX_CPU_THIS_PTR dr7 & 0xff) if (BX_CPU_THIS_PTR dr7 & 0xff) {
if (((BX_CPU_THIS_PTR dr7 >> 16) & 3) == 0 ||
((BX_CPU_THIS_PTR dr7 >> 20) & 3) == 0 ||
((BX_CPU_THIS_PTR dr7 >> 24) & 3) == 0 ||
((BX_CPU_THIS_PTR dr7 >> 28) & 3) == 0)
{
BX_INFO(("MOV_DdRd(): code breakpoint is set"));
BX_CPU_THIS_PTR async_event = 1; BX_CPU_THIS_PTR async_event = 1;
}
}
#endif #endif
break; break;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: tasking.cc,v 1.71 2009-05-01 14:59:21 sshwarts Exp $ // $Id: tasking.cc,v 1.72 2009-05-07 12:00:02 sshwarts Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -205,8 +205,6 @@ void BX_CPU_C::task_switch(bxInstruction_c *i, bx_selector_t *tss_selector,
// used in the task switch are paged in. // used in the task switch are paged in.
if (BX_CPU_THIS_PTR cr0.get_PG()) if (BX_CPU_THIS_PTR cr0.get_PG())
{ {
dtranslate_linear(obase32, 0, BX_WRITE); // new TSS
dtranslate_linear(obase32 + old_TSS_max, 0, BX_WRITE);
dtranslate_linear(nbase32, 0, BX_READ); // old TSS dtranslate_linear(nbase32, 0, BX_READ); // old TSS
dtranslate_linear(nbase32 + new_TSS_max, 0, BX_READ); dtranslate_linear(nbase32 + new_TSS_max, 0, BX_READ);
@ -242,6 +240,12 @@ void BX_CPU_C::task_switch(bxInstruction_c *i, bx_selector_t *tss_selector,
} }
if (BX_CPU_THIS_PTR tr.cache.type <= 3) { if (BX_CPU_THIS_PTR tr.cache.type <= 3) {
// check that we won't page fault while writing
if (BX_CPU_THIS_PTR cr0.get_PG()) {
dtranslate_linear(Bit32u(obase32 + 14), 0, BX_WRITE);
dtranslate_linear(Bit32u(obase32 + 41), 0, BX_WRITE);
}
temp16 = IP; access_write_linear(Bit32u(obase32 + 14), 2, 0, &temp16); temp16 = IP; access_write_linear(Bit32u(obase32 + 14), 2, 0, &temp16);
temp16 = oldEFLAGS; access_write_linear(Bit32u(obase32 + 16), 2, 0, &temp16); temp16 = oldEFLAGS; access_write_linear(Bit32u(obase32 + 16), 2, 0, &temp16);
temp16 = AX; access_write_linear(Bit32u(obase32 + 18), 2, 0, &temp16); temp16 = AX; access_write_linear(Bit32u(obase32 + 18), 2, 0, &temp16);
@ -262,6 +266,12 @@ void BX_CPU_C::task_switch(bxInstruction_c *i, bx_selector_t *tss_selector,
access_write_linear(Bit32u(obase32 + 40), 2, 0, &temp16); access_write_linear(Bit32u(obase32 + 40), 2, 0, &temp16);
} }
else { else {
// check that we won't page fault while writing
if (BX_CPU_THIS_PTR cr0.get_PG()) {
dtranslate_linear(Bit32u(obase32 + 0x20), 0, BX_WRITE);
dtranslate_linear(Bit32u(obase32 + 0x5d), 0, BX_WRITE);
}
temp32 = EIP; access_write_linear(Bit32u(obase32 + 0x20), 4, 0, &temp32); temp32 = EIP; access_write_linear(Bit32u(obase32 + 0x20), 4, 0, &temp32);
temp32 = oldEFLAGS; access_write_linear(Bit32u(obase32 + 0x24), 4, 0, &temp32); temp32 = oldEFLAGS; access_write_linear(Bit32u(obase32 + 0x24), 4, 0, &temp32);
temp32 = EAX; access_write_linear(Bit32u(obase32 + 0x28), 4, 0, &temp32); temp32 = EAX; access_write_linear(Bit32u(obase32 + 0x28), 4, 0, &temp32);