Minor fix in cpu reset, bug sometimes caused to run on garbage memory after software reset. Some small debug messages fixes
This commit is contained in:
parent
a3c0c4e58f
commit
032b13047c
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: debugstuff.cc,v 1.90 2008-01-29 17:13:06 sshwarts Exp $
|
||||
// $Id: debugstuff.cc,v 1.91 2008-02-01 13:25:23 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -50,9 +50,6 @@ void BX_CPU_C::debug_disasm_instruction(bx_address offset)
|
||||
bx_bool valid = dbg_xlate_linear2phy(BX_CPU_THIS_PTR get_segment_base(BX_SEG_REG_CS) + offset, &phy_addr);
|
||||
if (valid && BX_CPU_THIS_PTR mem!=NULL) {
|
||||
BX_CPU_THIS_PTR mem->dbg_fetch_mem(BX_CPU_THIS, phy_addr, 16, instr_buf);
|
||||
char_buf[i++] = '>';
|
||||
char_buf[i++] = '>';
|
||||
char_buf[i++] = ' ';
|
||||
unsigned isize = bx_disassemble.disasm(
|
||||
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.d_b,
|
||||
BX_CPU_THIS_PTR cpu_mode == BX_MODE_LONG_64,
|
||||
@ -68,7 +65,7 @@ void BX_CPU_C::debug_disasm_instruction(bx_address offset)
|
||||
char_buf[i++] = letters[(instr_buf[j] >> 0) & 0xf];
|
||||
}
|
||||
char_buf[i] = 0;
|
||||
BX_INFO(("%s", char_buf));
|
||||
BX_INFO((">> %s", char_buf));
|
||||
}
|
||||
else {
|
||||
BX_INFO(("(instruction unavailable) page split instruction"));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: init.cc,v 1.150 2008-01-31 21:44:28 vruppert Exp $
|
||||
// $Id: init.cc,v 1.151 2008-02-01 13:25:23 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -730,7 +730,6 @@ void BX_CPU_C::reset(unsigned source)
|
||||
* 286 F000 FF0000 FFFF FFF0
|
||||
* 386+ F000 FFFF0000 FFFF FFF0
|
||||
*/
|
||||
|
||||
parse_selector(0xf000,
|
||||
&BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector);
|
||||
|
||||
@ -756,10 +755,10 @@ void BX_CPU_C::reset(unsigned source)
|
||||
|
||||
#if BX_SUPPORT_ICACHE
|
||||
BX_CPU_THIS_PTR updateFetchModeMask();
|
||||
flushICaches();
|
||||
#endif
|
||||
|
||||
/* DS (Data Segment) and descriptor cache */
|
||||
|
||||
parse_selector(0x0000,
|
||||
&BX_CPU_THIS_PTR sregs[BX_SEG_REG_DS].selector);
|
||||
|
||||
@ -873,7 +872,6 @@ void BX_CPU_C::reset(unsigned source)
|
||||
BX_CPU_THIS_PTR smbase = 0x30000;
|
||||
|
||||
BX_CPU_THIS_PTR cr0.setRegister(0);
|
||||
|
||||
// handle reserved bits
|
||||
#if BX_CPU_LEVEL == 3
|
||||
// reserved bits all set to 1 on 386
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: proc_ctrl.cc,v 1.196 2008-01-18 08:57:35 sshwarts Exp $
|
||||
// $Id: proc_ctrl.cc,v 1.197 2008-02-01 13:25:23 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -1214,6 +1214,8 @@ void BX_CPU_C::LOADALL(bxInstruction_c *i)
|
||||
|
||||
void BX_CPU_C::handleCpuModeChange(void)
|
||||
{
|
||||
unsigned mode = BX_CPU_THIS_PTR cpu_mode;
|
||||
|
||||
#if BX_SUPPORT_X86_64
|
||||
if (BX_CPU_THIS_PTR efer.lma) {
|
||||
if (! BX_CPU_THIS_PTR cr0.get_PE()) {
|
||||
@ -1221,34 +1223,30 @@ void BX_CPU_C::handleCpuModeChange(void)
|
||||
}
|
||||
if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.l) {
|
||||
BX_CPU_THIS_PTR cpu_mode = BX_MODE_LONG_64;
|
||||
BX_DEBUG(("Long Mode Activated"));
|
||||
}
|
||||
else {
|
||||
BX_CPU_THIS_PTR cpu_mode = BX_MODE_LONG_COMPAT;
|
||||
if (BX_CPU_THIS_PTR eip_reg.dword.rip_upper != 0) {
|
||||
BX_PANIC(("handleCpuModeChange: leaving long mode with RIP upper != 0 !"));
|
||||
}
|
||||
BX_DEBUG(("Compatibility Mode Activated"));
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (BX_CPU_THIS_PTR cr0.get_PE()) {
|
||||
if (BX_CPU_THIS_PTR get_VM()) {
|
||||
if (BX_CPU_THIS_PTR get_VM())
|
||||
BX_CPU_THIS_PTR cpu_mode = BX_MODE_IA32_V8086;
|
||||
BX_DEBUG(("VM8086 Mode Activated"));
|
||||
}
|
||||
else {
|
||||
else
|
||||
BX_CPU_THIS_PTR cpu_mode = BX_MODE_IA32_PROTECTED;
|
||||
BX_DEBUG(("Protected Mode Activated"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
BX_CPU_THIS_PTR cpu_mode = BX_MODE_IA32_REAL;
|
||||
BX_DEBUG(("Real Mode Activated"));
|
||||
}
|
||||
}
|
||||
|
||||
if (mode != BX_CPU_THIS_PTR cpu_mode)
|
||||
BX_DEBUG(("%s activated", cpu_mode_string(BX_CPU_THIS_PTR cpu_mode)));
|
||||
}
|
||||
|
||||
#if BX_CPU_LEVEL >= 4 && BX_SUPPORT_ALIGNMENT_CHECK
|
||||
|
Loading…
x
Reference in New Issue
Block a user