Remove cpu.h -> devices.cc dependancy, kill_bochs_request moved from CPU to bx_pc_system
Small Icache simplification and speedup
This commit is contained in:
parent
2e144d5862
commit
e85a90a720
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cpu.cc,v 1.137 2006-03-06 22:02:51 sshwarts Exp $
|
||||
// $Id: cpu.cc,v 1.138 2006-03-14 18:11:22 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -137,7 +137,7 @@ void BX_CPU_C::cpu_loop(Bit32s max_instr_count)
|
||||
BX_CPU_THIS_PTR stop_reason = STOP_NO_REASON;
|
||||
#endif
|
||||
|
||||
if (setjmp( BX_CPU_THIS_PTR jmp_buf_env ))
|
||||
if (setjmp(BX_CPU_THIS_PTR jmp_buf_env))
|
||||
{
|
||||
// only from exception function can we get here ...
|
||||
BX_INSTR_NEW_INSTRUCTION(BX_CPU_ID);
|
||||
@ -477,23 +477,13 @@ bxInstruction_c* BX_CPU_C::fetchInstruction(bxInstruction_c *iStorage, bx_addres
|
||||
|
||||
if (ret==0) {
|
||||
#if BX_SUPPORT_ICACHE
|
||||
i = iStorage; // Leave entry invalid
|
||||
i = iStorage; // return iStorage and leave icache entry invalid
|
||||
#endif
|
||||
boundaryFetch(fetchPtr, remainingInPage, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if BX_SUPPORT_ICACHE
|
||||
// In the case where the page is marked ICacheWriteStampInvalid, all
|
||||
// counter bits will be high, being eqivalent to ICacheWriteStampMax.
|
||||
// In the case where the page is marked as possibly having associated
|
||||
// iCache entries, we need to leave the counter as-is, unless we're
|
||||
// willing to dump all iCache entries which can hash to this page.
|
||||
// Therefore, in either case, we can keep the counter as-is and
|
||||
// replace the fetch mode bits.
|
||||
pageWriteStamp &= ICacheWriteStampMask; // Clear out old fetch mode bits.
|
||||
pageWriteStamp |= BX_CPU_THIS_PTR fetchModeMask; // Add in new ones.
|
||||
pageWriteStampTable.setPageWriteStamp(pAddr, pageWriteStamp);
|
||||
cache_entry->pAddr = pAddr;
|
||||
cache_entry->writeStamp = pageWriteStamp;
|
||||
#endif
|
||||
@ -554,7 +544,7 @@ unsigned BX_CPU_C::handleAsyncEvent(void)
|
||||
return 1; // Return to caller of cpu_loop.
|
||||
}
|
||||
#endif
|
||||
} else if (BX_CPU_THIS_PTR kill_bochs_request) {
|
||||
} else if (bx_pc_system.kill_bochs_request) {
|
||||
// setting kill_bochs_request causes the cpu loop to return ASAP.
|
||||
return 1; // Return to caller of cpu_loop.
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: ctrl_xfer64.cc,v 1.42 2006-03-06 22:02:52 sshwarts Exp $
|
||||
// $Id: ctrl_xfer64.cc,v 1.43 2006-03-14 18:11:22 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -23,6 +23,7 @@
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#define NEED_CPU_REG_SHORTCUTS 1
|
||||
@ -37,8 +38,6 @@ void BX_CPU_C::RETnear64_Iw(bxInstruction_c *i)
|
||||
{
|
||||
Bit64u return_RIP;
|
||||
|
||||
//invalidate_prefetch_q();
|
||||
|
||||
#if BX_DEBUGGER
|
||||
BX_CPU_THIS_PTR show_flag |= Flag_ret;
|
||||
#endif
|
||||
@ -46,17 +45,15 @@ void BX_CPU_C::RETnear64_Iw(bxInstruction_c *i)
|
||||
Bit64u temp_RSP = RSP;
|
||||
Bit16u imm16 = i->Iw();
|
||||
|
||||
access_linear(BX_CPU_THIS_PTR get_segment_base(BX_SEG_REG_SS) + temp_RSP,
|
||||
8, CPL==3, BX_READ, &return_RIP);
|
||||
pop_64(&return_RIP);
|
||||
|
||||
if (! IsCanonical(return_RIP))
|
||||
{
|
||||
BX_INFO(("RETnear64_Iw: canonical RIP violation"));
|
||||
if (! IsCanonical(return_RIP)) {
|
||||
BX_ERROR(("RETnear64_Iw: canonical RIP violation"));
|
||||
exception(BX_GP_EXCEPTION, 0, 0);
|
||||
}
|
||||
|
||||
RIP = return_RIP;
|
||||
RSP += 8 + imm16;
|
||||
RSP += imm16;
|
||||
|
||||
BX_INSTR_UCNEAR_BRANCH(BX_CPU_ID, BX_INSTR_IS_RET, RIP);
|
||||
}
|
||||
@ -65,25 +62,20 @@ void BX_CPU_C::RETnear64(bxInstruction_c *i)
|
||||
{
|
||||
Bit64u return_RIP;
|
||||
|
||||
//invalidate_prefetch_q();
|
||||
|
||||
#if BX_DEBUGGER
|
||||
BX_CPU_THIS_PTR show_flag |= Flag_ret;
|
||||
#endif
|
||||
|
||||
Bit64u temp_RSP = RSP;
|
||||
|
||||
access_linear(BX_CPU_THIS_PTR get_segment_base(BX_SEG_REG_SS) + temp_RSP,
|
||||
8, CPL==3, BX_READ, &return_RIP);
|
||||
pop_64(&return_RIP);
|
||||
|
||||
if (! IsCanonical(return_RIP))
|
||||
{
|
||||
BX_INFO(("RETnear64: canonical RIP violation"));
|
||||
if (! IsCanonical(return_RIP)) {
|
||||
BX_ERROR(("RETnear64: canonical RIP violation"));
|
||||
exception(BX_GP_EXCEPTION, 0, 0);
|
||||
}
|
||||
|
||||
RIP = return_RIP;
|
||||
RSP += 8;
|
||||
|
||||
BX_INSTR_UCNEAR_BRANCH(BX_CPU_ID, BX_INSTR_IS_RET, RIP);
|
||||
}
|
||||
@ -128,14 +120,11 @@ void BX_CPU_C::CALL_Aq(bxInstruction_c *i)
|
||||
{
|
||||
Bit64u new_RIP = RIP + (Bit32s) i->Id();
|
||||
|
||||
//invalidate_prefetch_q();
|
||||
|
||||
#if BX_DEBUGGER
|
||||
BX_CPU_THIS_PTR show_flag |= Flag_call;
|
||||
#endif
|
||||
|
||||
if (! IsCanonical(new_RIP))
|
||||
{
|
||||
if (! IsCanonical(new_RIP)) {
|
||||
BX_INFO(("CALL_Aq: canonical RIP violation"));
|
||||
exception(BX_GP_EXCEPTION, 0, 0);
|
||||
}
|
||||
@ -151,8 +140,6 @@ void BX_CPU_C::CALL_Eq(bxInstruction_c *i)
|
||||
{
|
||||
Bit64u op1_64;
|
||||
|
||||
//invalidate_prefetch_q();
|
||||
|
||||
#if BX_DEBUGGER
|
||||
BX_CPU_THIS_PTR show_flag |= Flag_call;
|
||||
#endif
|
||||
@ -189,7 +176,7 @@ void BX_CPU_C::CALL64_Ep(bxInstruction_c *i)
|
||||
|
||||
/* op1_64 is a register or memory reference */
|
||||
if (i->modC0()) {
|
||||
BX_INFO(("CALL_Ep: op1 is a register"));
|
||||
BX_ERROR(("CALL64_Ep: op1 is a register"));
|
||||
exception(BX_UD_EXCEPTION, 0, 0);
|
||||
}
|
||||
|
||||
@ -199,7 +186,8 @@ void BX_CPU_C::CALL64_Ep(bxInstruction_c *i)
|
||||
|
||||
BX_ASSERT(protected_mode());
|
||||
|
||||
BX_INFO(("call far instruction executed ..."));
|
||||
BX_INFO(("CallFar64 instruction executed ..."));
|
||||
|
||||
BX_CPU_THIS_PTR call_protected(i, cs_raw, op1_32);
|
||||
|
||||
BX_INSTR_FAR_BRANCH(BX_CPU_ID, BX_INSTR_IS_CALL,
|
||||
@ -256,8 +244,6 @@ void BX_CPU_C::JMP_Eq(bxInstruction_c *i)
|
||||
{
|
||||
Bit64u op1_64;
|
||||
|
||||
//invalidate_prefetch_q();
|
||||
|
||||
if (i->modC0()) {
|
||||
op1_64 = BX_READ_64BIT_REG(i->rm());
|
||||
}
|
||||
@ -284,14 +270,14 @@ void BX_CPU_C::JMP64_Ep(bxInstruction_c *i)
|
||||
invalidate_prefetch_q();
|
||||
|
||||
if (i->modC0()) {
|
||||
BX_INFO(("JMP_Ep(): op1 is a register"));
|
||||
BX_ERROR(("JMP64_Ep(): op1 is a register"));
|
||||
exception(BX_UD_EXCEPTION, 0, 0);
|
||||
}
|
||||
|
||||
read_virtual_dword(i->seg(), RMAddr(i), &op1_32);
|
||||
read_virtual_word(i->seg(), RMAddr(i)+4, &cs_raw);
|
||||
|
||||
BX_INFO(("JMPF64 instruction executed ..."));
|
||||
BX_INFO(("JmpFar64 instruction executed ..."));
|
||||
|
||||
BX_ASSERT(protected_mode());
|
||||
BX_CPU_THIS_PTR jump_protected(i, cs_raw, op1_32);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: icache.h,v 1.12 2006-02-28 17:47:33 sshwarts Exp $
|
||||
// $Id: icache.h,v 1.13 2006-03-14 18:11:22 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -150,7 +150,7 @@ BX_CPP_INLINE void bxICache_c::purgeICacheEntries(void)
|
||||
if (e->writeStamp != pageWriteStamp)
|
||||
e->writeStamp = ICacheWriteStampInvalid; // invalidate entry
|
||||
else
|
||||
e->writeStamp |= 0x1fffffff;
|
||||
e->writeStamp |= ICacheWriteStampMask;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: init.cc,v 1.91 2006-03-09 20:16:16 vruppert Exp $
|
||||
// $Id: init.cc,v 1.92 2006-03-14 18:11:22 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -742,7 +742,6 @@ void BX_CPU_C::reset(unsigned source)
|
||||
|
||||
invalidate_prefetch_q();
|
||||
|
||||
BX_CPU_THIS_PTR kill_bochs_request = 0;
|
||||
BX_INSTR_RESET(BX_CPU_ID);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: proc_ctrl.cc,v 1.139 2006-03-06 22:03:01 sshwarts Exp $
|
||||
// $Id: proc_ctrl.cc,v 1.140 2006-03-14 18:11:22 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -610,8 +610,6 @@ void BX_CPU_C::MOV_CdRd(bxInstruction_c *i)
|
||||
// Reserved bits take on value of MOV instruction
|
||||
CR3_change(val_32);
|
||||
BX_INSTR_TLB_CNTRL(BX_CPU_ID, BX_INSTR_MOV_CR3, val_32);
|
||||
// Reload of CR3 always serializes.
|
||||
// invalidate_prefetch_q(); // Already done.
|
||||
break;
|
||||
case 4: // CR4
|
||||
#if BX_CPU_LEVEL == 3
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: smm.cc,v 1.4 2006-03-06 22:32:02 sshwarts Exp $
|
||||
// $Id: smm.cc,v 1.5 2006-03-14 18:11:22 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2006 Stanislav Shwartsman
|
||||
@ -34,12 +34,12 @@
|
||||
|
||||
void BX_CPU_C::RSM(bxInstruction_c *i)
|
||||
{
|
||||
invalidate_prefetch_q();
|
||||
|
||||
/* If we are not in System Management Mode, then #UD should be generated */
|
||||
if (! BX_CPU_THIS_PTR smm_mode()) {
|
||||
UndefinedOpcode(i);
|
||||
}
|
||||
|
||||
invalidate_prefetch_q();
|
||||
|
||||
BX_INFO(("RSM: System Management Mode not implemented yet"));
|
||||
|
||||
@ -48,6 +48,8 @@ void BX_CPU_C::RSM(bxInstruction_c *i)
|
||||
|
||||
void BX_CPU_C::enter_system_management_mode(void)
|
||||
{
|
||||
invalidate_prefetch_q();
|
||||
|
||||
// all status flags at known values, use BX_CPU_THIS_PTR eflags structure
|
||||
BX_CPU_THIS_PTR lf_flags_status = 0x000000;
|
||||
|
||||
|
@ -265,21 +265,17 @@ cmos.o: cmos.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
||||
../iodev/unmapped.h ../iodev/ne2k.h ../iodev/guest2host.h \
|
||||
../iodev/slowdown_timer.h ../iodev/extfpuirq.h ../iodev/gameport.h
|
||||
crc32.o: crc32.@CPP_SUFFIX@ crc32.h ../config.h
|
||||
devices.o: devices.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \
|
||||
devices.o: devices.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
||||
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
||||
../gui/siminterface.h ../memory/memory.h ../pc_system.h ../plugin.h \
|
||||
../extplugin.h ../gui/gui.h ../gui/textconfig.h ../config.h \
|
||||
../gui/keymap.h ../instrument/stubs/instrument.h ../cpu/cpu.h \
|
||||
../cpu/lazy_flags.h ../cpu/hostasm.h ../disasm/disasm.h ../config.h \
|
||||
../cpu/descriptor.h ../cpu/icache.h ../cpu/apic.h ../cpu/i387.h \
|
||||
../fpu/softfloat.h ../config.h ../fpu/tag_w.h ../fpu/status_w.h \
|
||||
../fpu/control_w.h ../cpu/xmm.h iodev.h ../iodev/pci.h \
|
||||
../gui/keymap.h ../instrument/stubs/instrument.h ../iodev/pci.h \
|
||||
../iodev/pci2isa.h ../iodev/pci_ide.h ../iodev/pcivga.h \
|
||||
../iodev/pciusb.h ../iodev/vga.h ../iodev/svga_cirrus.h \
|
||||
../iodev/ioapic.h ../cpu/apic.h ../iodev/biosdev.h ../iodev/cmos.h \
|
||||
../iodev/dma.h ../iodev/floppy.h ../iodev/harddrv.h ../iodev/iodebug.h \
|
||||
../iodev/keyboard.h ../iodev/parallel.h ../iodev/pic.h ../iodev/pit.h \
|
||||
../iodev/pit_wrap.h ../bochs.h ../iodev/pit82c54.h \
|
||||
../config.h ../iodev/keyboard.h ../iodev/parallel.h ../iodev/pic.h \
|
||||
../iodev/pit.h ../iodev/pit_wrap.h ../bochs.h ../iodev/pit82c54.h \
|
||||
../iodev/virt_timer.h ../iodev/serial.h ../iodev/sb16.h \
|
||||
../iodev/unmapped.h ../iodev/ne2k.h ../iodev/guest2host.h \
|
||||
../iodev/slowdown_timer.h ../iodev/extfpuirq.h ../iodev/gameport.h
|
||||
@ -844,21 +840,17 @@ cmos.lo: cmos.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
||||
../iodev/unmapped.h ../iodev/ne2k.h ../iodev/guest2host.h \
|
||||
../iodev/slowdown_timer.h ../iodev/extfpuirq.h ../iodev/gameport.h
|
||||
crc32.lo: crc32.@CPP_SUFFIX@ crc32.h ../config.h
|
||||
devices.lo: devices.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \
|
||||
devices.lo: devices.@CPP_SUFFIX@ iodev.h ../bochs.h ../config.h ../osdep.h \
|
||||
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
|
||||
../gui/siminterface.h ../memory/memory.h ../pc_system.h ../plugin.h \
|
||||
../extplugin.h ../gui/gui.h ../gui/textconfig.h ../config.h \
|
||||
../gui/keymap.h ../instrument/stubs/instrument.h ../cpu/cpu.h \
|
||||
../cpu/lazy_flags.h ../cpu/hostasm.h ../disasm/disasm.h ../config.h \
|
||||
../cpu/descriptor.h ../cpu/icache.h ../cpu/apic.h ../cpu/i387.h \
|
||||
../fpu/softfloat.h ../config.h ../fpu/tag_w.h ../fpu/status_w.h \
|
||||
../fpu/control_w.h ../cpu/xmm.h iodev.h ../iodev/pci.h \
|
||||
../gui/keymap.h ../instrument/stubs/instrument.h ../iodev/pci.h \
|
||||
../iodev/pci2isa.h ../iodev/pci_ide.h ../iodev/pcivga.h \
|
||||
../iodev/pciusb.h ../iodev/vga.h ../iodev/svga_cirrus.h \
|
||||
../iodev/ioapic.h ../cpu/apic.h ../iodev/biosdev.h ../iodev/cmos.h \
|
||||
../iodev/dma.h ../iodev/floppy.h ../iodev/harddrv.h ../iodev/iodebug.h \
|
||||
../iodev/keyboard.h ../iodev/parallel.h ../iodev/pic.h ../iodev/pit.h \
|
||||
../iodev/pit_wrap.h ../bochs.h ../iodev/pit82c54.h \
|
||||
../config.h ../iodev/keyboard.h ../iodev/parallel.h ../iodev/pic.h \
|
||||
../iodev/pit.h ../iodev/pit_wrap.h ../bochs.h ../iodev/pit82c54.h \
|
||||
../iodev/virt_timer.h ../iodev/serial.h ../iodev/sb16.h \
|
||||
../iodev/unmapped.h ../iodev/ne2k.h ../iodev/guest2host.h \
|
||||
../iodev/slowdown_timer.h ../iodev/extfpuirq.h ../iodev/gameport.h
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: devices.cc,v 1.94 2006-03-06 22:03:16 sshwarts Exp $
|
||||
// $Id: devices.cc,v 1.95 2006-03-14 18:11:22 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -28,7 +28,6 @@
|
||||
|
||||
|
||||
#include "bochs.h"
|
||||
#include "cpu/cpu.h"
|
||||
#include "iodev.h"
|
||||
#define LOG_THIS bx_devices.
|
||||
|
||||
@ -96,20 +95,17 @@ bx_devices_c::bx_devices_c()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bx_devices_c::~bx_devices_c()
|
||||
{
|
||||
// nothing needed for now
|
||||
BX_DEBUG(("Exit."));
|
||||
timer_handle = BX_NULL_TIMER_HANDLE;
|
||||
}
|
||||
|
||||
void
|
||||
bx_devices_c::init(BX_MEM_C *newmem)
|
||||
void bx_devices_c::init(BX_MEM_C *newmem)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
BX_DEBUG(("Init $Id: devices.cc,v 1.94 2006-03-06 22:03:16 sshwarts Exp $"));
|
||||
BX_DEBUG(("Init $Id: devices.cc,v 1.95 2006-03-14 18:11:22 sshwarts Exp $"));
|
||||
mem = newmem;
|
||||
|
||||
/* set no-default handlers, will be overwritten by the real default handler */
|
||||
@ -222,9 +218,9 @@ bx_devices_c::init(BX_MEM_C *newmem)
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_APIC
|
||||
// I/O APIC 82093AA
|
||||
ioapic = & bx_ioapic;
|
||||
ioapic->init ();
|
||||
// I/O APIC 82093AA
|
||||
ioapic = & bx_ioapic;
|
||||
ioapic->init ();
|
||||
#endif
|
||||
|
||||
// BIOS log
|
||||
@ -303,7 +299,7 @@ bx_devices_c::init(BX_MEM_C *newmem)
|
||||
DEV_cmos_set_reg(0x35, (Bit8u) ((extended_memory_in_64k >> 8) & 0xff) );
|
||||
|
||||
if (timer_handle != BX_NULL_TIMER_HANDLE) {
|
||||
timer_handle = bx_pc_system.register_timer( this, timer_handler,
|
||||
timer_handle = bx_pc_system.register_timer(this, timer_handler,
|
||||
(unsigned) BX_IODEV_HANDLER_PERIOD, 1, 1, "devices.cc");
|
||||
}
|
||||
|
||||
@ -318,9 +314,7 @@ bx_devices_c::init(BX_MEM_C *newmem)
|
||||
DEV_cmos_checksum();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
bx_devices_c::reset(unsigned type)
|
||||
void bx_devices_c::reset(unsigned type)
|
||||
{
|
||||
pluginUnmapped->reset(type);
|
||||
#if BX_SUPPORT_PCI
|
||||
@ -346,7 +340,6 @@ bx_devices_c::reset(unsigned type)
|
||||
bx_reset_plugins(type);
|
||||
}
|
||||
|
||||
|
||||
Bit32u bx_devices_c::read_handler(void *this_ptr, Bit32u address, unsigned io_len)
|
||||
{
|
||||
#if !BX_USE_DEV_SMF
|
||||
@ -388,7 +381,6 @@ void bx_devices_c::port92_write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This defines a no-default read handler,
|
||||
// so Bochs does not segfault if unmapped is not loaded
|
||||
Bit32u bx_devices_c::default_read_handler(void *this_ptr, Bit32u address, unsigned io_len)
|
||||
@ -415,30 +407,26 @@ void bx_devices_c::timer_handler(void *this_ptr)
|
||||
void bx_devices_c::timer()
|
||||
{
|
||||
#if (BX_USE_NEW_PIT==0)
|
||||
if ( pit->periodic( BX_IODEV_HANDLER_PERIOD ) ) {
|
||||
if (pit->periodic(BX_IODEV_HANDLER_PERIOD)) {
|
||||
// This is a hack to make the IRQ0 work
|
||||
DEV_pic_lower_irq(0);
|
||||
DEV_pic_raise_irq(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// separate calls to bx_gui->handle_events from the keyboard code.
|
||||
{
|
||||
static int multiple=0;
|
||||
if ( ++multiple==10)
|
||||
{
|
||||
multiple=0;
|
||||
SIM->periodic ();
|
||||
if (!BX_CPU(0)->kill_bochs_request)
|
||||
SIM->periodic();
|
||||
if (! bx_pc_system.kill_bochs_request)
|
||||
bx_gui->handle_events();
|
||||
}
|
||||
}
|
||||
|
||||
// KPL Removed lapic periodic timer registration here.
|
||||
}
|
||||
|
||||
|
||||
bx_bool bx_devices_c::register_irq(unsigned irq, const char *name)
|
||||
{
|
||||
if (irq >= BX_MAX_IRQS) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: main.cc,v 1.325 2006-03-11 22:40:32 vruppert Exp $
|
||||
// $Id: main.cc,v 1.326 2006-03-14 18:11:22 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -839,7 +839,7 @@ int bx_begin_simulation (int argc, char *argv[])
|
||||
// do some instructions in each processor
|
||||
BX_CPU(processor)->cpu_loop(quantum);
|
||||
processor = (processor+1) % BX_SMP_PROCESSORS;
|
||||
if (BX_CPU(0)->kill_bochs_request)
|
||||
if (bx_pc_system.kill_bochs_request)
|
||||
break;
|
||||
if (processor == 0)
|
||||
BX_TICKN(quantum);
|
||||
@ -858,7 +858,7 @@ void bx_stop_simulation()
|
||||
// our only job is to end the thread as soon as possible, NOT to shut
|
||||
// down the whole application with an exit.
|
||||
BX_CPU(0)->async_event = 1;
|
||||
BX_CPU(0)->kill_bochs_request = 1;
|
||||
bx_pc_system.kill_bochs_request = 1;
|
||||
// the cpu loop will exit very soon after this condition is set.
|
||||
}
|
||||
|
||||
@ -873,7 +873,7 @@ int bx_init_hardware()
|
||||
}
|
||||
}
|
||||
|
||||
bx_pc_system.init_ips(SIM->get_param_num(BXPN_IPS)->get());
|
||||
bx_pc_system.initialize(SIM->get_param_num(BXPN_IPS)->get());
|
||||
|
||||
if (SIM->get_param_string(BXPN_LOG_FILENAME)->getptr()[0]!='-') {
|
||||
BX_INFO (("using log file %s", SIM->get_param_string(BXPN_LOG_FILENAME)->getptr()));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pc_system.cc,v 1.52 2006-03-08 19:27:56 sshwarts Exp $
|
||||
// $Id: pc_system.cc,v 1.53 2006-03-14 18:11:22 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -79,10 +79,12 @@ bx_pc_system_c::bx_pc_system_c()
|
||||
usecSinceLast = 0;
|
||||
}
|
||||
|
||||
void bx_pc_system_c::init_ips(Bit32u ips)
|
||||
void bx_pc_system_c::initialize(Bit32u ips)
|
||||
{
|
||||
HRQ = 0;
|
||||
|
||||
kill_bochs_request = 0;
|
||||
|
||||
// parameter 'ips' is the processor speed in Instructions-Per-Second
|
||||
m_ips = double(ips) / 1000000.0L;
|
||||
|
||||
@ -175,7 +177,7 @@ void bx_pc_system_c::set_enable_a20(bx_bool value)
|
||||
|
||||
bx_bool bx_pc_system_c::get_enable_a20(void)
|
||||
{
|
||||
BX_INFO(("get_enable_a20: ignoring: SUPPORT_A20 = 0"));
|
||||
BX_DEBUG(("get_enable_a20: ignoring: SUPPORT_A20 = 0"));
|
||||
return(1);
|
||||
}
|
||||
#endif // #if BX_SUPPORT_A20
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pc_system.h,v 1.35 2006-03-04 16:58:10 sshwarts Exp $
|
||||
// $Id: pc_system.h,v 1.36 2006-03-14 18:11:22 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2004 MandrakeSoft S.A.
|
||||
@ -24,15 +24,14 @@
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
#ifndef BX_PCSYS_H
|
||||
#define BX_PCSYS_H
|
||||
|
||||
#define BX_MAX_TIMERS 64
|
||||
#define BX_NULL_TIMER_HANDLE 10000
|
||||
|
||||
|
||||
typedef void (*bx_timer_handler_t)(void *);
|
||||
|
||||
|
||||
BOCHSAPI extern class bx_pc_system_c bx_pc_system;
|
||||
|
||||
#ifdef PROVIDE_M_IPS
|
||||
@ -92,14 +91,13 @@ public:
|
||||
// Timer oriented public features
|
||||
// ==============================
|
||||
|
||||
void init_ips(Bit32u ips);
|
||||
int register_timer( void *this_ptr, bx_timer_handler_t, Bit32u useconds,
|
||||
void initialize(Bit32u ips);
|
||||
int register_timer(void *this_ptr, bx_timer_handler_t, Bit32u useconds,
|
||||
bx_bool continuous, bx_bool active, const char *id);
|
||||
unsigned unregisterTimer(int timerID);
|
||||
void start_timers(void);
|
||||
void activate_timer( unsigned timer_index, Bit32u useconds,
|
||||
bx_bool continuous );
|
||||
void deactivate_timer( unsigned timer_index );
|
||||
void activate_timer(unsigned timer_index, Bit32u useconds, bx_bool continuous);
|
||||
void deactivate_timer(unsigned timer_index);
|
||||
unsigned triggeredTimerID(void) {
|
||||
return triggeredTimer;
|
||||
}
|
||||
@ -161,11 +159,13 @@ public:
|
||||
//
|
||||
Bit32u a20_mask;
|
||||
|
||||
volatile bx_bool kill_bochs_request;
|
||||
|
||||
void set_HRQ(bx_bool val); // set the Hold ReQuest line
|
||||
void set_INTR(bx_bool value); // set the INTR line to value
|
||||
|
||||
// Cpu and System Reset
|
||||
int Reset( unsigned type );
|
||||
int Reset(unsigned type);
|
||||
Bit8u IAC(void);
|
||||
|
||||
bx_pc_system_c();
|
||||
@ -176,3 +176,5 @@ public:
|
||||
bx_bool get_enable_a20(void);
|
||||
void exit(void);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user