Move SHOW_IPS action to bx_gui object, may be some GUI will be able to print IPS online in the simulation window status bar ...

Small code cleanup
This commit is contained in:
Stanislav Shwartsman 2005-10-13 16:22:21 +00:00
parent 0e2f0a4392
commit 469358aaf9
8 changed files with 81 additions and 85 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bochs.h,v 1.159 2005-10-02 10:16:53 vruppert Exp $
// $Id: bochs.h,v 1.160 2005-10-13 16:22:21 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -664,7 +664,7 @@ typedef struct BOCHSAPI {
bx_param_enum_c *Osel_config;
bx_param_enum_c *Osel_displaylib;
bx_param_string_c *Odisplaylib_options;
} bx_options_t;
} bx_options_t;
BOCHSAPI extern bx_options_t bx_options;
@ -672,10 +672,6 @@ void bx_init_options();
void bx_center_print (FILE *file, char *line, int maxwidth);
#if BX_PROVIDE_CPU_MEMORY==1
#else
// # include "external_interface.h"
#endif
#define BX_USE_PS2_MOUSE 1

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: exception.cc,v 1.63 2005-08-08 21:03:32 sshwarts Exp $
// $Id: exception.cc,v 1.64 2005-10-13 16:22:21 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -821,9 +821,9 @@ void BX_CPU_C::exception(unsigned vector, Bit16u error_code, bx_bool is_INT)
}
#endif
#if BX_EXTERNAL_DEBUGGER
//#if BX_EXTERNAL_DEBUGGER
//trap_debugger(1);
#endif
//#endif
BX_INSTR_EXCEPTION(BX_CPU_ID, vector);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: proc_ctrl.cc,v 1.116 2005-10-09 18:32:36 sshwarts Exp $
// $Id: proc_ctrl.cc,v 1.117 2005-10-13 16:22:21 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -1330,9 +1330,9 @@ void BX_CPU_C::SetCR0(Bit32u val_32)
BX_CPU_THIS_PTR msr.lma = 1;
BX_DEBUG(("Enter Compatibility Mode"));
BX_CPU_THIS_PTR cpu_mode = BX_MODE_LONG_COMPAT;
#if BX_EXTERNAL_DEBUGGER
//#if BX_EXTERNAL_DEBUGGER
//trap_debugger(0);
#endif
//#endif
}
}
else if (prev_pg==1 && BX_CPU_THIS_PTR cr0.pg==0) {
@ -1349,9 +1349,9 @@ void BX_CPU_C::SetCR0(Bit32u val_32)
BX_DEBUG(("Enter Real Mode"));
BX_CPU_THIS_PTR cpu_mode = BX_MODE_IA32_REAL;
}
#if BX_EXTERNAL_DEBUGGER
//#if BX_EXTERNAL_DEBUGGER
//trap_debugger(0);
#endif
//#endif
}
}
#endif // #if BX_SUPPORT_X86_64

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: soft_int.cc,v 1.25 2005-03-19 20:44:00 sshwarts Exp $
// $Id: soft_int.cc,v 1.26 2005-10-13 16:22:21 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -109,41 +109,31 @@ void BX_CPU_C::INT_Ib(bxInstruction_c *i)
Bit8u vector = i->Ib();
if (v8086_mode())
{
if (v8086_mode()) {
#if BX_SUPPORT_VME
if (BX_CPU_THIS_PTR cr4.get_VME())
{
Bit16u io_base;
access_linear(BX_CPU_THIS_PTR tr.cache.u.tss386.base + 102,
2, 0, BX_READ, &io_base);
if (BX_CPU_THIS_PTR cr4.get_VME())
{
Bit8u vme_redirection_bitmap;
Bit16u io_base;
Bit8u vme_redirection_bitmap;
access_linear(BX_CPU_THIS_PTR tr.cache.u.tss386.base + io_base - 32 + (vector >> 3),
access_linear(BX_CPU_THIS_PTR tr.cache.u.tss386.base + 102,
2, 0, BX_READ, &io_base);
access_linear(BX_CPU_THIS_PTR tr.cache.u.tss386.base + io_base - 32 + (vector >> 3),
1, 0, BX_READ, &vme_redirection_bitmap);
if (vme_redirection_bitmap & (1 << (vector & 7)))
{
// VME redirecion bit is set so the interrupt is not redirected
if (BX_CPU_THIS_PTR get_IOPL() < 3)
{
exception(BX_GP_EXCEPTION, 0, 0);
}
}
else {
// redirect interrupt through virtual-mode idt
v86_redirect_interrupt(vector);
return;
}
}
else // VME is off
if (! (vme_redirection_bitmap & (1 << (vector & 7))))
{
// redirect interrupt through virtual-mode idt
v86_redirect_interrupt(vector);
return;
}
}
#endif
{
if (BX_CPU_THIS_PTR get_IOPL() < 3)
{
exception(BX_GP_EXCEPTION, 0, 0);
}
}
// interrupt is not redirected or VME is OFF
if (BX_CPU_THIS_PTR get_IOPL() < 3)
{
exception(BX_GP_EXCEPTION, 0, 0);
}
}
#ifdef SHOW_EXIT_STATUS

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: gui.cc,v 1.82 2005-10-10 19:32:53 vruppert Exp $
// $Id: gui.cc,v 1.83 2005-10-13 16:22:21 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -806,4 +806,12 @@ bx_gui_c::graphics_tile_update_in_place(unsigned x0, unsigned y0,
BX_GUI_THIS graphics_tile_update(tile, xc, yc);
}
}
}
void
bx_gui_c::show_ips(Bit32u ips_count)
{
#if BX_SHOW_IPS
BX_INFO(("ips = %lu", ips_count));
#endif
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: gui.h,v 1.46 2005-04-29 19:06:24 sshwarts Exp $
// $Id: gui.h,v 1.47 2005-10-13 16:22:21 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -83,7 +83,7 @@ public:
virtual int get_clipboard_text(Bit8u **bytes, Bit32s *nbytes) = 0;
virtual int set_clipboard_text(char *snapshot, Bit32u len) = 0;
virtual void mouse_enabled_changed_specific (bx_bool val) = 0;
virtual void statusbar_setitem(int element, bx_bool active) {};
virtual void statusbar_setitem(int element, bx_bool active) {}
virtual void exit(void) = 0;
// set_display_mode() changes the mode between the configuration interface
// and the simulation. This is primarily intended for display libraries
@ -103,6 +103,7 @@ public:
// this is called from the CPU model when the HLT instruction is executed.
virtual void sim_is_idle(void) {}
#endif
virtual void show_ips(Bit32u ips_count);
virtual void beep_on(float frequency);
virtual void beep_off();
virtual void get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.294 2005-10-03 10:28:03 vruppert Exp $
// $Id: main.cc,v 1.295 2005-10-13 16:22:21 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -1040,7 +1040,7 @@ void bx_signal_handler(int signum)
// amount of system ticks passed from last time the handler was called
Bit64u ips_count = bx_pc_system.time_ticks() - ticks_count;
if (ips_count) {
BX_INFO(("ips = %lu", (unsigned long) ips_count));
bx_gui->show_ips((Bit32u) ips_count);
ticks_count = bx_pc_system.time_ticks();
}
#ifndef __MINGW32__
@ -1054,7 +1054,7 @@ void bx_signal_handler(int signum)
#if BX_GUI_SIGHANDLER
if (bx_gui_sighandler) {
if ((1<<signum) & bx_gui->get_sighandler_mask ()) {
bx_gui->sighandler (signum);
bx_gui->sighandler(signum);
return;
}
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: memory.cc,v 1.42 2005-10-12 17:11:44 vruppert Exp $
// $Id: memory.cc,v 1.43 2005-10-13 16:22:21 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -58,11 +58,13 @@ BX_MEM_C::writePhysicalPage(BX_CPU_C *cpu, Bit32u addr, unsigned len, void *data
struct memory_handler_struct *memory_handler = memory_handlers[a20addr >> 20];
while (memory_handler) {
if (memory_handler->begin <= a20addr &&
memory_handler->end >= a20addr &&
memory_handler->write_handler(a20addr, len, data, memory_handler->write_param))
return;
memory_handler = memory_handler->next;
if (memory_handler->begin <= a20addr &&
memory_handler->end >= a20addr &&
memory_handler->write_handler(a20addr, len, data, memory_handler->write_param))
{
return;
}
memory_handler = memory_handler->next;
}
#if BX_SUPPORT_ICACHE
@ -71,16 +73,16 @@ BX_MEM_C::writePhysicalPage(BX_CPU_C *cpu, Bit32u addr, unsigned len, void *data
#endif
#if BX_SUPPORT_APIC
bx_generic_apic_c *local_apic = &cpu->local_apic;
bx_generic_apic_c *ioapic = bx_devices.ioapic;
if (local_apic->is_selected (a20addr, len)) {
local_apic->write (a20addr, (Bit32u *)data, len);
return;
}
if (ioapic->is_selected (a20addr, len)) {
ioapic->write (a20addr, (Bit32u *)data, len);
return;
}
bx_generic_apic_c *local_apic = &cpu->local_apic;
bx_generic_apic_c *ioapic = bx_devices.ioapic;
if (local_apic->is_selected (a20addr, len)) {
local_apic->write (a20addr, (Bit32u *)data, len);
return;
}
if (ioapic->is_selected (a20addr, len)) {
ioapic->write (a20addr, (Bit32u *)data, len);
return;
}
#endif
if ( (a20addr + len) <= BX_MEM_THIS len ) {
@ -102,7 +104,7 @@ BX_MEM_C::writePhysicalPage(BX_CPU_C *cpu, Bit32u addr, unsigned len, void *data
return;
}
// len == other, just fall thru to special cases handling
}
}
#ifdef BX_LITTLE_ENDIAN
data_ptr = (Bit8u *) data;
@ -186,11 +188,9 @@ inc_one:
data_ptr--;
#endif
}
return;
}
}
void BX_CPP_AttrRegparmN(3)
BX_MEM_C::readPhysicalPage(BX_CPU_C *cpu, Bit32u addr, unsigned len, void *data)
{
@ -217,24 +217,26 @@ BX_MEM_C::readPhysicalPage(BX_CPU_C *cpu, Bit32u addr, unsigned len, void *data)
struct memory_handler_struct *memory_handler = memory_handlers[a20addr >> 20];
while (memory_handler) {
if (memory_handler->begin <= a20addr &&
memory_handler->end >= a20addr &&
memory_handler->read_handler(a20addr, len, data, memory_handler->read_param))
return;
memory_handler = memory_handler->next;
if (memory_handler->begin <= a20addr &&
memory_handler->end >= a20addr &&
memory_handler->read_handler(a20addr, len, data, memory_handler->read_param))
{
return;
}
memory_handler = memory_handler->next;
}
#if BX_SUPPORT_APIC
bx_generic_apic_c *local_apic = &cpu->local_apic;
bx_generic_apic_c *ioapic = bx_devices.ioapic;
if (local_apic->is_selected (addr, len)) {
local_apic->read (addr, data, len);
return;
}
if (ioapic->is_selected (addr, len)) {
ioapic->read (addr, data, len);
return;
}
if (local_apic->is_selected (addr, len)) {
local_apic->read (addr, data, len);
return;
}
if (ioapic->is_selected (addr, len)) {
ioapic->read (addr, data, len);
return;
}
#endif
if ( (a20addr + len) <= BX_MEM_THIS len ) {
@ -249,7 +251,7 @@ BX_MEM_C::readPhysicalPage(BX_CPU_C *cpu, Bit32u addr, unsigned len, void *data)
return;
}
if (len == 1) {
* (Bit8u *) data = * ((Bit8u *) (&vector[a20addr]));
* (Bit8u *) data = * ((Bit8u *) (&vector[a20addr]));
return;
}
// len == 3 case can just fall thru to special cases handling
@ -343,7 +345,6 @@ inc_one:
data_ptr--;
#endif
}
return;
}
}