Bochs supports only ONE memory address space anyway so the code sould be optimized for this case a little (mainly in SMP configuration)

This commit is contained in:
Stanislav Shwartsman 2006-01-15 19:35:39 +00:00
parent 504081f282
commit 3dbf0f3b97
4 changed files with 31 additions and 27 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bochs.h,v 1.163 2005-11-20 20:33:31 sshwarts Exp $
// $Id: bochs.h,v 1.164 2006-01-15 19:35:38 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -170,10 +170,14 @@ void bx_reset_options (void);
#if BX_SMP_PROCESSORS==1
#define BX_CPU(x) (&bx_cpu)
#define BX_MEM(x) (&bx_mem)
#else
#define BX_CPU(x) (bx_cpu_array[x])
#define BX_MEM(x) (bx_mem_array[x])
#endif
#if BX_ADDRESS_SPACES==1
#define BX_MEM(x) (&bx_mem)
#else
#define BX_MEM(x) (&bx_mem_array[x])
#endif
#define BX_SET_ENABLE_A20(enabled) bx_pc_system.set_enable_a20(enabled)

View File

@ -58,30 +58,34 @@
// one space for each processor to have an ID, starting with 0.
#define BX_IOAPIC_DEFAULT_ID (BX_SMP_PROCESSORS)
#define BX_ADDRESS_SPACES 1
// controls how many instances of BX_MEM_C are created. For
// SMP, use several processors with one shared memory space.
// For cosimulation, you could use two processors and two address
// spaces.
#define BX_ADDRESS_SPACES 1
#if BX_ADDRESS_SPACES != 1
#error "Support for several address spaces still not implemented"
#endif
#define BX_SUPPORT_APIC 0
// include in APIC models, required for a multiprocessor system.
#define BX_SUPPORT_APIC 0
#if (BX_SMP_PROCESSORS>1 && !BX_SUPPORT_APIC)
#error For multiprocessor simulation, BX_SUPPORT_APIC is required.
#endif
#define BX_DEBUG_LINUX 0
// if simulating Linux, this provides a few more debugging options
// such as tracing all system calls.
#define BX_DEBUG_LINUX 0
#define HAVE_LIBREADLINE 0
#define HAVE_READLINE_HISTORY_H 0
// adds support for the GNU readline library in the debugger command
// prompt.
#define HAVE_LIBREADLINE 0
#define HAVE_READLINE_HISTORY_H 0
#define HAVE_LOCALE_H 0
// Define to 1 if you have <locale.h>
#define HAVE_LOCALE_H 0
// I rebuilt the code which provides timers to IO devices.
// Setting this to 1 will introduce a little code which
@ -220,7 +224,6 @@
// members of the C++ CPU class to be static.
// This defaults to 1 since it should improve performance, but when
// SMP mode is enabled, it will be turned off by configure.
#define BX_USE_CPU_SMF 1
// Use static member functions in IO DEVice emulation modules.
@ -964,5 +967,4 @@ typedef
// of instructions.
//#define BX_SCHEDULED_DIE_TIME 1162230000 // end of redhat6.0 boot
#endif // _BX_CONFIG_H

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.302 2006-01-15 17:56:36 sshwarts Exp $
// $Id: main.cc,v 1.303 2006-01-15 19:35:38 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -95,12 +95,16 @@ bx_debug_t bx_dbg;
#if BX_SMP_PROCESSORS==1
// single processor simulation, so there's one of everything
BOCHSAPI BX_CPU_C bx_cpu;
BOCHSAPI BX_MEM_C bx_mem;
BOCHSAPI BX_CPU_C bx_cpu;
#else
// multiprocessor simulation, we need an array of cpus and memories
BOCHSAPI BX_CPU_C *bx_cpu_array[BX_SMP_PROCESSORS];
BOCHSAPI BX_MEM_C *bx_mem_array[BX_ADDRESS_SPACES];
BOCHSAPI BX_CPU_C *bx_cpu_array[BX_SMP_PROCESSORS];
#endif
#if BX_ADDRESS_SPACES==1
BOCHSAPI BX_MEM_C bx_mem;
#else
BOCHSAPI BX_MEM_C bx_mem_array[BX_ADDRESS_SPACES];
#endif
char *bochsrc_filename = NULL;
@ -856,12 +860,6 @@ int bx_init_hardware()
pageWriteStampTable.alloc(memSize);
#endif
#if BX_SMP_PROCESSORS == 1
// the memory object is static in single CPU configuration
#else
BX_MEM(0) = new BX_MEM_C ();
#endif
BX_MEM(0)->init_memory(memSize);
// First load the BIOS and VGABIOS

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: memory.h,v 1.26 2005-10-28 00:12:27 kevinlawton Exp $
// $Id: memory.h,v 1.27 2006-01-15 19:35:39 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -104,11 +104,11 @@ public:
#if BX_PROVIDE_CPU_MEMORY==1
#if BX_SMP_PROCESSORS==1
BOCHSAPI extern BX_MEM_C bx_mem;
#if BX_ADDRESS_SPACES==1
BOCHSAPI extern BX_MEM_C bx_mem;
#else
BOCHSAPI extern BX_MEM_C *bx_mem_array[BX_ADDRESS_SPACES];
#endif /* BX_SMP_PROCESSORS */
BOCHSAPI extern BX_MEM_C bx_mem_array[BX_ADDRESS_SPACES];
#endif /* BX_ADDRESS_SPACES */
#endif /* BX_PROVIDE_CPU_MEMORY==1 */