Merged patch: determine number of processors to emulate through .bochsrc

This commit is contained in:
Stanislav Shwartsman 2006-01-18 18:35:38 +00:00
parent 3e9ed43413
commit 2c8f6f7720
17 changed files with 296 additions and 405 deletions

View File

@ -78,6 +78,14 @@ romimage: file=$BXSHARE/BIOS-bochs-latest, address=0xf0000
#romimage: file=mybios.bin, address=0xfff80000 # 512k at memory top
#romimage: file=mybios.bin # calculate start address from image size
#=======================================================================
# CPU
# Set the number of processors when Bochs is compiled for SMP emulation.
# Bochs currently supports up to 8 processors. If Bochs is compiled
# without SMP support, it won't accept values different from 1.
#=======================================================================
cpu: count=1
#=======================================================================
# MEGS
# Set the number of Megabytes of physical memory you want to emulate.
@ -344,7 +352,7 @@ log: bochsout.txt
# This handles the format of the string prepended to each log line.
# You may use those special tokens :
# %t : 11 decimal digits timer tick
# %i : 8 hexadecimal digits of cpu0 current eip
# %i : 8 hexadecimal digits of cpu current eip (ignored in SMP configuration)
# %e : 1 character event type ('i'nfo, 'd'ebug, 'p'anic, 'e'rror)
# %d : 5 characters string of the device, between brackets
#

View File

@ -3,17 +3,15 @@
# more things than you actually want.
./configure \
--enable-processors=2 \
--enable-smp \
--enable-apic \
--enable-x86-64 \
--enable-all-optimizations \
--enable-ne2000 \
--enable-pci \
--enable-4meg-pages \
--enable-pae \
--enable-guest2host-tlb \
--enable-repeat-speedups \
--enable-icache \
--enable-global-pages \
--enable-host-specific-asms \
--enable-ignore-bad-msr \
--enable-port-e9-hack \
--enable-debugger \

View File

@ -1,4 +1,3 @@
-------------------------------------------------------------------------
Changes in 2.2.6 (not yet released):
- critical APIC timer bug fixed (Volker Ruppert)
@ -10,6 +9,11 @@ Changes in 2.2.6 (not yet released):
- development documentation improved
- enabled #PCE bit in CR4 register, previosly setting of this bit
generated #GP(0) fault (Stanislav Shwartsman)
- enabled LAHF/SAHF instructions in x86-64 mode (Stanislav Shwartsman)
- determine number of processors in SMP configuration through .bochsrc file
- new .bochsrc option to choose number of processors to emulate
- new to configure option --enable-smp to configure Bochs for SMP support,
the old --enable-processors=N option is deprecated
- updated Bochs instrumentation examples (Stanislav Shwartsman)
-------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bochs.h,v 1.164 2006-01-15 19:35:38 sshwarts Exp $
// $Id: bochs.h,v 1.165 2006-01-18 18:35:30 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -119,6 +119,7 @@ void bx_reset_options (void);
//
#if ((BX_DEBUGGER == 1) && (BX_NUM_SIMULATORS >= 2))
// =-=-=-=-=-=-=- Redirected to cosimulation debugger -=-=-=-=-=-=-=
#define DEV_vga_mem_read(addr) bx_dbg_ucmem_read(addr)
#define DEV_vga_mem_write(addr, val) bx_dbg_ucmem_write(addr, val)
@ -168,10 +169,10 @@ void bx_reset_options (void);
#define BX_MEM_WRITE_PHYSICAL(phy_addr, len, ptr) \
BX_MEM(0)->writePhysicalPage(BX_CPU(0), phy_addr, len, ptr)
#if BX_SMP_PROCESSORS==1
#define BX_CPU(x) (&bx_cpu)
#else
#if BX_SUPPORT_SMP
#define BX_CPU(x) (bx_cpu_array[x])
#else
#define BX_CPU(x) (&bx_cpu)
#endif
#if BX_ADDRESS_SPACES==1
@ -186,7 +187,7 @@ void bx_reset_options (void);
#endif
#if BX_SUPPORT_A20
# define A20ADDR(x) ( (x) & bx_pc_system.a20_mask )
# define A20ADDR(x) ((x) & bx_pc_system.a20_mask)
#else
# define A20ADDR(x) (x)
#endif
@ -194,8 +195,8 @@ void bx_reset_options (void);
// you can't use static member functions on the CPU, if there are going
// to be 2 cpus. Check this early on.
#if (BX_SMP_PROCESSORS>1)
# if (BX_USE_CPU_SMF!=0)
#if BX_SUPPORT_SMP
# if BX_USE_CPU_SMF
# error For SMP simulation, BX_USE_CPU_SMF must be 0.
# endif
#endif
@ -427,13 +428,12 @@ void bx_gdbstub_init(int argc, char* argv[]);
int bx_gdbstub_check(unsigned int eip);
#define GDBSTUB_STOP_NO_REASON (0xac0)
#if BX_SMP_PROCESSORS!=1
#if BX_SUPPORT_SMP
#error GDB stub was written for single processor support. If multiprocessor support is added, then we can remove this check.
// The big problem is knowing which CPU gdb is referring to. In other words,
// what should we put for "n" in BX_CPU(n)->dbg_xlate_linear2phy() and
// BX_CPU(n)->dword.eip, etc.
#endif
#endif
typedef struct {
@ -645,6 +645,7 @@ typedef struct BOCHSAPI {
bx_param_num_c *Okeyboard_serial_delay;
bx_param_num_c *Okeyboard_paste_delay;
bx_param_enum_c *Okeyboard_type;
bx_param_num_c *Ocpu_count;
bx_param_num_c *Oips;
bx_param_bool_c *Orealtime_pit;
bx_param_bool_c *Otext_snapshot_check;
@ -672,18 +673,22 @@ typedef struct BOCHSAPI {
BOCHSAPI extern bx_options_t bx_options;
#if BX_SUPPORT_SMP
#define BX_SMP_PROCESSORS (bx_cpu_count)
#else
#define BX_SMP_PROCESSORS 1
#endif
void bx_init_options();
void bx_center_print (FILE *file, char *line, int maxwidth);
#define BX_USE_PS2_MOUSE 1
int bx_init_hardware ();
#include "instrument.h"
// These are some convenience macros which abstract out accesses between
// a variable in native byte ordering to/from guest (x86) memory, which is
// always in little endian format. You must deal with alignment (if your

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: dbg_main.cc,v 1.33 2006-01-15 17:55:25 sshwarts Exp $
// $Id: dbg_main.cc,v 1.34 2006-01-18 18:35:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -1303,7 +1303,7 @@ one_more:
// cpus set stop, too bad.
}
// increment time tick only after all processors have had their chance.
#if BX_SMP_PROCESSORS==1
#if BX_SUPPORT_SMP == 0
// all ticks are handled inside the cpu loop
#else
// We must tick by the number of instructions that were
@ -1311,7 +1311,7 @@ one_more:
// execute. Even this is tricky with SMP because one might
// have hit a breakpoint, while others executed the whole
// quantum.
int max_executed = 0;
int max_executed = 0;
for (cpu=0; cpu<BX_SMP_PROCESSORS; cpu++) {
if (BX_CPU(cpu)->guard_found.icount > max_executed)
max_executed = BX_CPU(cpu)->guard_found.icount;
@ -1323,7 +1323,7 @@ one_more:
if (max_executed < 1) max_executed=1;
BX_TICKN(max_executed);
#endif /* BX_SMP_PROCESSORS>1 */
#endif /* BX_SUPPORT_SMP */
}
#endif /* BX_NUM_SIMULATORS */
@ -1371,7 +1371,7 @@ void bx_dbg_stepN_command(bx_dbg_icount_t count)
BX_CPU(cpu)->guard_found.icount = 0;
BX_CPU(cpu)->cpu_loop(-1);
}
#if BX_SMP_PROCESSORS==1
#if BX_SUPPORT_SMP == 0
// ticks are handled inside the cpu loop
#else
BX_TICK1 ();
@ -1471,8 +1471,7 @@ void bx_dbg_disassemble_current (int which_cpu, int print_time)
void bx_dbg_print_guard_results(void)
{
unsigned i;
unsigned sim;
unsigned sim, i;
for (sim=0; sim<BX_SMP_PROCESSORS; sim++) {
unsigned long found = BX_CPU(sim)->guard_found.guard_found;
@ -1892,7 +1891,7 @@ void bx_dbg_info_registers_command(int which_regs_mask)
memset(&cpu, 0, sizeof(cpu));
BX_CPU(i)->dbg_get_cpu(&cpu);
#if (BX_SMP_PROCESSORS >= 2)
#if BX_SUPPORT_SMP
dbg_printf ("%s:\n", BX_CPU(i)->name, i);
#endif
reg = cpu.eax;
@ -1952,10 +1951,10 @@ void bx_dbg_dump_cpu_command(void)
{
bx_dbg_cpu_t cpu;
for (unsigned i=0; i<BX_SMP_PROCESSORS; i++ ) {
for (unsigned i=0; i<BX_SMP_PROCESSORS; i++) {
BX_CPU(i)->dbg_get_cpu(&cpu);
#if (BX_SMP_PROCESSORS >= 2)
#if BX_SUPPORT_SMP
dbg_printf ("CPU#%u\n", i);
#endif
dbg_printf ("eax:0x%08x, ebx:0x%08x, ecx:0x%08x, edx:0x%08x\n",
@ -2412,7 +2411,7 @@ void bx_dbg_set_symbol_command(char *symbol, Bit32u val)
is_OK = BX_CPU(dbg_cpu)->dbg_set_reg(BX_DBG_REG_GS, val);
}
else if ( !strcmp(symbol, "cpu") ) {
#if ((BX_SMP_PROCESSORS>1) && (BX_SUPPORT_APIC))
#if BX_SUPPORT_SMP
if (val > BX_SMP_PROCESSORS) {
dbg_printf ("invalid cpu id number %d\n", val);
return;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: config.cc,v 1.66 2005-12-27 16:59:27 vruppert Exp $
// $Id: config.cc,v 1.67 2006-01-18 18:35:30 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -356,8 +356,6 @@ bx_param_enable_handler (bx_param_c *param, int val)
return val;
}
void bx_init_options ()
{
int i;
@ -1180,11 +1178,24 @@ void bx_init_options ()
BX_MOUSE_TYPE_NONE);
bx_options.Omouse_type->set_ask_format ("Choose the type of mouse [%s] ");
#if BX_SUPPORT_SMP
#define BX_CPU_COUNT_LIMIT 8
#else
#define BX_CPU_COUNT_LIMIT 1
#endif
bx_options.Ocpu_count = new bx_param_num_c (BXP_CPU_COUNT,
"Number of CPUs in SMP mode",
"Sets the number of CPUs for multiprocessor emulation",
1, BX_CPU_COUNT_LIMIT,
1);
bx_options.Oips = new bx_param_num_c (BXP_IPS,
"Emulated instructions per second (IPS)",
"Emulated instructions per second, used to calibrate bochs emulated time with wall clock time.",
1, BX_MAX_BIT32U,
2000000);
bx_options.Otext_snapshot_check = new bx_param_bool_c (BXP_TEXT_SNAPSHOT_CHECK,
"Enable panic for use in bochs testing",
"Enable panic when text on screen matches snapchk.txt.\nUseful for regression testing.\nIn win32, turns off CR/LF in snapshots and cuts.",
@ -1279,6 +1290,7 @@ void bx_init_options ()
"",
BX_PATHNAME_LEN);
bx_param_c *interface_init_list[] = {
bx_options.Ocpu_count,
bx_options.Osel_config,
bx_options.Osel_displaylib,
bx_options.Odisplaylib_options,
@ -1805,6 +1817,7 @@ void bx_reset_options ()
bx_options.Ovga_extension->reset();
bx_options.Omouse_enabled->reset();
bx_options.Omouse_type->reset();
bx_options.Ocpu_count->reset();
bx_options.Oips->reset();
bx_options.Oprivate_colormap->reset();
#if BX_WITH_AMIGAOS
@ -2613,6 +2626,17 @@ static Bit32s parse_line_formatted(char *context, int num_params, char *params[]
if (parse_log_options(context, params[0], params[1]) < 0) {
return -1;
}
} else if (!strcmp(params[0], "cpu")) {
if (num_params < 2) {
PARSE_ERR(("%s: cpu directive malformed.", context));
}
for (i=1; i<num_params; i++) {
if (!strncmp(params[i], "count=", 6)) {
bx_options.Ocpu_count->set (strtoul (&params[i][6], NULL, 10));
} else {
PARSE_ERR(("%s: cpu directive malformed.", context));
}
}
} else if (!strcmp(params[0], "megs")) {
if (num_params != 2) {
PARSE_ERR(("%s: megs directive: wrong # args.", context));
@ -3638,6 +3662,7 @@ bx_write_configuration (char *rc, int overwrite)
fprintf (fp, "vga: extension=%s\n", bx_options.Ovga_extension->getptr ());
fprintf (fp, "keyboard_serial_delay: %u\n", bx_options.Okeyboard_serial_delay->get ());
fprintf (fp, "keyboard_paste_delay: %u\n", bx_options.Okeyboard_paste_delay->get ());
fprintf (fp, "cpu: count=%d\n", bx_options.Ocpu_count->get ());
fprintf (fp, "ips: %u\n", bx_options.Oips->get ());
fprintf (fp, "text_snapshot_check: %d\n", bx_options.Otext_snapshot_check->get ());
fprintf (fp, "mouse: enabled=%d\n", bx_options.Omouse_enabled->get ());

View File

@ -48,15 +48,12 @@
#define BX_EXIT(x) ::exit(x)
#endif
// I have tested the following combinations:
// We have tested the following combinations:
// * processors=1, bootstrap=0, ioapic_id=1 (uniprocessor system)
// * processors=2, bootstrap=0, ioapic_id=2
// * processors=4, bootstrap=0, ioapic_id=4
#define BX_SMP_PROCESSORS 1
#define BX_SUPPORT_SMP 0
#define BX_BOOTSTRAP_PROCESSOR 0
// choose IOAPIC id to be equal to the number of processors. This leaves
// one space for each processor to have an ID, starting with 0.
#define BX_IOAPIC_DEFAULT_ID (BX_SMP_PROCESSORS)
// controls how many instances of BX_MEM_C are created. For
// SMP, use several processors with one shared memory space.
@ -71,7 +68,7 @@
// include in APIC models, required for a multiprocessor system.
#define BX_SUPPORT_APIC 0
#if (BX_SMP_PROCESSORS>1 && !BX_SUPPORT_APIC)
#if (BX_SUPPORT_SMP && !BX_SUPPORT_APIC)
#error For multiprocessor simulation, BX_SUPPORT_APIC is required.
#endif

270
bochs/configure vendored
View File

@ -1036,8 +1036,8 @@ Optional Features:
--enable-new-pit use Greg Alexander's new PIT model
--enable-idle-hack use Roland Mainz's idle hack
--enable-plugins enable plugins
--enable-processors select number of processors (1,2,4,8)
--enable-x86-64 compile in support for x86-64 instructions
--enable-smp compile in support for SMP configurations
--enable-cpu-level select cpu level (3,4,5,6)
--enable-apic enable APIC support
--enable-compressed-hd allows compressed (zlib) hard disk image (not implemented yet)
@ -1091,6 +1091,7 @@ Optional Features:
--enable-config-interface turns on/off configuration interface (deprecated)
--enable-control-panel turns on/off contol panel (deprecated)
--enable-vga use VGA emulation (deprecated)
--enable-processors select number of processors (deprecated)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@ -3664,7 +3665,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 3667 "configure"' > conftest.$ac_ext
echo '#line 3668 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -4772,7 +4773,7 @@ fi
# Provide some information about the compiler.
echo "$as_me:4775:" \
echo "$as_me:4776:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@ -5810,11 +5811,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:5813: $lt_compile\"" >&5)
(eval echo "\"\$as_me:5814: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:5817: \$? = $ac_status" >&5
echo "$as_me:5818: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -6043,11 +6044,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:6046: $lt_compile\"" >&5)
(eval echo "\"\$as_me:6047: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:6050: \$? = $ac_status" >&5
echo "$as_me:6051: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -6110,11 +6111,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:6113: $lt_compile\"" >&5)
(eval echo "\"\$as_me:6114: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:6117: \$? = $ac_status" >&5
echo "$as_me:6118: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -8276,7 +8277,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 8279 "configure"
#line 8280 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -8374,7 +8375,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 8377 "configure"
#line 8378 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -10553,11 +10554,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:10556: $lt_compile\"" >&5)
(eval echo "\"\$as_me:10557: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:10560: \$? = $ac_status" >&5
echo "$as_me:10561: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -10620,11 +10621,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:10623: $lt_compile\"" >&5)
(eval echo "\"\$as_me:10624: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:10627: \$? = $ac_status" >&5
echo "$as_me:10628: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -11963,7 +11964,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 11966 "configure"
#line 11967 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -12061,7 +12062,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 12064 "configure"
#line 12065 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -12884,11 +12885,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:12887: $lt_compile\"" >&5)
(eval echo "\"\$as_me:12888: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:12891: \$? = $ac_status" >&5
echo "$as_me:12892: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -12951,11 +12952,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:12954: $lt_compile\"" >&5)
(eval echo "\"\$as_me:12955: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:12958: \$? = $ac_status" >&5
echo "$as_me:12959: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -14967,11 +14968,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:14970: $lt_compile\"" >&5)
(eval echo "\"\$as_me:14971: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:14974: \$? = $ac_status" >&5
echo "$as_me:14975: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -15200,11 +15201,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15203: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15204: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:15207: \$? = $ac_status" >&5
echo "$as_me:15208: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -15267,11 +15268,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15270: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15271: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:15274: \$? = $ac_status" >&5
echo "$as_me:15275: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -17433,7 +17434,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 17436 "configure"
#line 17437 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -17531,7 +17532,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 17534 "configure"
#line 17535 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -19850,7 +19851,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 19853 "configure"
#line 19854 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -33095,143 +33096,6 @@ echo "${ECHO_T}yes" >&6
fi
fi
echo "$as_me:$LINENO: checking for number of processors" >&5
echo $ECHO_N "checking for number of processors... $ECHO_C" >&6
# Check whether --enable-processors or --disable-processors was given.
if test "${enable_processors+set}" = set; then
enableval="$enable_processors"
case "$enableval" in
1)
echo "$as_me:$LINENO: result: 1" >&5
echo "${ECHO_T}1" >&6
cat >>confdefs.h <<\_ACEOF
#define BX_SMP_PROCESSORS 1
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define BX_BOOTSTRAP_PROCESSOR 0
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define BX_IOAPIC_DEFAULT_ID 1
_ACEOF
;;
2)
echo "$as_me:$LINENO: result: 2" >&5
echo "${ECHO_T}2" >&6
cat >>confdefs.h <<\_ACEOF
#define BX_SMP_PROCESSORS 2
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define BX_BOOTSTRAP_PROCESSOR 0
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define BX_IOAPIC_DEFAULT_ID 2
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define BX_USE_CPU_SMF 0
_ACEOF
;;
4)
echo "$as_me:$LINENO: result: 4" >&5
echo "${ECHO_T}4" >&6
cat >>confdefs.h <<\_ACEOF
#define BX_SMP_PROCESSORS 4
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define BX_BOOTSTRAP_PROCESSOR 0
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define BX_IOAPIC_DEFAULT_ID 4
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define BX_USE_CPU_SMF 0
_ACEOF
;;
8)
echo "$as_me:$LINENO: result: 8" >&5
echo "${ECHO_T}8" >&6
cat >>confdefs.h <<\_ACEOF
#define BX_SMP_PROCESSORS 8
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define BX_BOOTSTRAP_PROCESSOR 0
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define BX_IOAPIC_DEFAULT_ID 8
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define BX_USE_CPU_SMF 0
_ACEOF
;;
yes|no)
echo "$as_me:$LINENO: result: $enableval" >&5
echo "${ECHO_T}$enableval" >&6
{ { echo "$as_me:$LINENO: error: --enable-processors=??? (valid number required)" >&5
echo "$as_me: error: --enable-processors=??? (valid number required)" >&2;}
{ (exit 1); exit 1; }; }
;;
*)
echo " "
echo "WARNING: processors != 1,2,4,8 can work, but you need to modify rombios.c manually"
echo "$as_me:$LINENO: result: $enableval" >&5
echo "${ECHO_T}$enableval" >&6
cat >>confdefs.h <<\_ACEOF
#define BX_SMP_PROCESSORS $enableval
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define BX_BOOTSTRAP_PROCESSOR 0
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define BX_IOAPIC_DEFAULT_ID $enableval
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define BX_USE_CPU_SMF 0
_ACEOF
;;
esac
bx_procs="$enableval"
else
echo "$as_me:$LINENO: result: 1" >&5
echo "${ECHO_T}1" >&6
cat >>confdefs.h <<\_ACEOF
#define BX_SMP_PROCESSORS 1
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define BX_BOOTSTRAP_PROCESSOR 0
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define BX_IOAPIC_DEFAULT_ID 1
_ACEOF
bx_procs=1
fi;
echo "$as_me:$LINENO: checking if compiler allows blank labels" >&5
echo $ECHO_N "checking if compiler allows blank labels... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
@ -33383,6 +33247,45 @@ _ACEOF
fi;
use_smp=0
echo "$as_me:$LINENO: checking for SMP support" >&5
echo $ECHO_N "checking for SMP support... $ECHO_C" >&6
# Check whether --enable-smp or --disable-smp was given.
if test "${enable_smp+set}" = set; then
enableval="$enable_smp"
if test "$enableval" = yes; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
cat >>confdefs.h <<\_ACEOF
#define BX_SUPPORT_SMP 1
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define BX_USE_CPU_SMF 0
_ACEOF
use_smp=1
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
cat >>confdefs.h <<\_ACEOF
#define BX_SUPPORT_SMP 0
_ACEOF
fi
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
cat >>confdefs.h <<\_ACEOF
#define BX_SUPPORT_SMP 0
_ACEOF
fi;
echo "$as_me:$LINENO: checking for cpu level" >&5
echo $ECHO_N "checking for cpu level... $ECHO_C" >&6
# Check whether --enable-cpu-level or --disable-cpu-level was given.
@ -33444,15 +33347,15 @@ _ACEOF
;;
esac
bx_cpu_level=$enableval
if test "$bx_procs" -gt 1 -a "$enableval" -lt 6; then
if test "$use_smp" = 1 -a "$enableval" -lt 6; then
echo "ERROR: with >1 processor, use --enable-cpu-level=6"
exit 1
fi
else
# for multiprocessors, cpu level must be 6
if test "$bx_procs" -gt 1 -o "$use_x86_64" = 1; then
# for multiprocessors or x86-64, cpu level must be 6
if test "$use_smp" = 1 -o "$use_x86_64" = 1; then
echo "$as_me:$LINENO: result: 6" >&5
echo "${ECHO_T}6" >&6
cat >>confdefs.h <<\_ACEOF
@ -33499,9 +33402,8 @@ _ACEOF
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
if test "$bx_procs" -gt 1; then
echo "Number of processors = $bx_procs"
echo "ERROR: With processors > 1 you must use --enable-apic"
if test "$use_smp" = 1; then
echo "ERROR: With SMP configuration you must use --enable-apic"
exit 1
fi
cat >>confdefs.h <<\_ACEOF
@ -33514,8 +33416,8 @@ _ACEOF
else
if test "$bx_procs" -gt 1 -o "$bx_cpu_level" -gt 5; then
# enable APIC by default, if processors>1 or if cpulevel>5
if test "$use_smp" = 1 -o "$bx_cpu_level" -gt 5; then
# enable APIC by default, if SMP configuration or if cpulevel>5
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
cat >>confdefs.h <<\_ACEOF
@ -39333,6 +39235,24 @@ echo "${ECHO_T}no" >&6
fi;
echo "$as_me:$LINENO: checking for number of processors (deprecated)" >&5
echo $ECHO_N "checking for number of processors (deprecated)... $ECHO_C" >&6
# Check whether --enable-processors or --disable-processors was given.
if test "${enable_processors+set}" = set; then
enableval="$enable_processors"
echo "$as_me:$LINENO: result: $enableval" >&5
echo "${ECHO_T}$enableval" >&6
{ { echo "$as_me:$LINENO: error: deprecated - use option --enable-smp instead" >&5
echo "$as_me: error: deprecated - use option --enable-smp instead" >&2;}
{ (exit 1); exit 1; }; }
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi;
# Create some subdirectories for when you run configure from some other
# directory.
if test ! -d instrument; then mkdir instrument; fi

View File

@ -2,7 +2,7 @@ dnl // Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT(bochs.h)
AC_REVISION([[$Id: configure.in,v 1.306 2006-01-04 18:55:43 vruppert Exp $]])
AC_REVISION([[$Id: configure.in,v 1.307 2006-01-18 18:35:36 sshwarts Exp $]])
AC_CONFIG_HEADER(config.h)
AC_CONFIG_HEADER(ltdlconf.h)
@ -480,64 +480,6 @@ if test "$bx_plugins" = 1 -a "$need_dlcompat_for_plugins" = 1; then
fi
fi
AC_MSG_CHECKING(for number of processors)
AC_ARG_ENABLE(processors,
[ --enable-processors select number of processors (1,2,4,8)],
[case "$enableval" in
1)
AC_MSG_RESULT(1)
AC_DEFINE(BX_SMP_PROCESSORS, 1)
AC_DEFINE(BX_BOOTSTRAP_PROCESSOR, 0)
AC_DEFINE(BX_IOAPIC_DEFAULT_ID, 1)
;;
2)
AC_MSG_RESULT(2)
AC_DEFINE(BX_SMP_PROCESSORS, 2)
AC_DEFINE(BX_BOOTSTRAP_PROCESSOR, 0)
AC_DEFINE(BX_IOAPIC_DEFAULT_ID, 2)
AC_DEFINE(BX_USE_CPU_SMF, 0)
;;
4)
AC_MSG_RESULT(4)
AC_DEFINE(BX_SMP_PROCESSORS, 4)
AC_DEFINE(BX_BOOTSTRAP_PROCESSOR, 0)
AC_DEFINE(BX_IOAPIC_DEFAULT_ID, 4)
AC_DEFINE(BX_USE_CPU_SMF, 0)
;;
8)
AC_MSG_RESULT(8)
AC_DEFINE(BX_SMP_PROCESSORS, 8)
AC_DEFINE(BX_BOOTSTRAP_PROCESSOR, 0)
AC_DEFINE(BX_IOAPIC_DEFAULT_ID, 8)
AC_DEFINE(BX_USE_CPU_SMF, 0)
;;
yes|no)
AC_MSG_RESULT($enableval)
AC_MSG_ERROR([--enable-processors=??? (valid number required)])
;;
*)
echo " "
echo "WARNING: processors != [1,2,4,8] can work, but you need to modify rombios.c manually"
AC_MSG_RESULT($enableval)
AC_DEFINE(BX_SMP_PROCESSORS, $enableval)
AC_DEFINE(BX_BOOTSTRAP_PROCESSOR, 0)
AC_DEFINE(BX_IOAPIC_DEFAULT_ID, $enableval)
AC_DEFINE(BX_USE_CPU_SMF, 0)
;;
esac
bx_procs="$enableval"
],
[
AC_MSG_RESULT(1)
AC_DEFINE(BX_SMP_PROCESSORS, 1)
AC_DEFINE(BX_BOOTSTRAP_PROCESSOR, 0)
AC_DEFINE(BX_IOAPIC_DEFAULT_ID, 1)
bx_procs=1
]
)
AC_MSG_CHECKING(if compiler allows blank labels)
AC_TRY_COMPILE([], [ { label1: } ],
AC_MSG_RESULT(yes),
@ -577,6 +519,26 @@ AC_ARG_ENABLE(x86-64,
)
AC_SUBST(OBJS64)
use_smp=0
AC_MSG_CHECKING(for SMP support)
AC_ARG_ENABLE(smp,
[ --enable-smp compile in support for SMP configurations],
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SUPPORT_SMP, 1)
AC_DEFINE(BX_USE_CPU_SMF, 0)
use_smp=1
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_SMP, 0)
fi
],
[
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_SMP, 0)
]
)
AC_MSG_CHECKING(for cpu level)
AC_ARG_ENABLE(cpu-level,
[ --enable-cpu-level select cpu level (3,4,5,6)],
@ -608,14 +570,14 @@ AC_ARG_ENABLE(cpu-level,
;;
esac
bx_cpu_level=$enableval
if test "$bx_procs" -gt 1 -a "$enableval" -lt 6; then
if test "$use_smp" = 1 -a "$enableval" -lt 6; then
echo "ERROR: with >1 processor, use --enable-cpu-level=6"
exit 1
fi
],
[
# for multiprocessors, cpu level must be 6
if test "$bx_procs" -gt 1 -o "$use_x86_64" = 1; then
# for multiprocessors or x86-64, cpu level must be 6
if test "$use_smp" = 1 -o "$use_x86_64" = 1; then
AC_MSG_RESULT(6)
AC_DEFINE(BX_CPU_LEVEL, 6)
AC_DEFINE(BX_CPU_LEVEL_HACKED, 6)
@ -640,9 +602,8 @@ AC_ARG_ENABLE(apic,
APIC_OBJS='apic.o'
else
AC_MSG_RESULT(no)
if test "$bx_procs" -gt 1; then
echo "Number of processors = $bx_procs"
echo "ERROR: With processors > 1 you must use --enable-apic"
if test "$use_smp" = 1; then
echo "ERROR: With SMP configuration you must use --enable-apic"
exit 1
fi
AC_DEFINE(BX_SUPPORT_APIC, 0)
@ -651,8 +612,8 @@ AC_ARG_ENABLE(apic,
fi
],
[
if test "$bx_procs" -gt 1 -o "$bx_cpu_level" -gt 5; then
# enable APIC by default, if processors>1 or if cpulevel>5
if test "$use_smp" = 1 -o "$bx_cpu_level" -gt 5; then
# enable APIC by default, if SMP configuration or if cpulevel>5
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SUPPORT_APIC, 1)
IOAPIC_OBJS='ioapic.o'
@ -2806,6 +2767,16 @@ AC_ARG_ENABLE(vga,
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(for number of processors (deprecated))
AC_ARG_ENABLE(processors,
[ --enable-processors select number of processors (deprecated)],
[AC_MSG_RESULT($enableval)
AC_MSG_ERROR([deprecated - use option --enable-smp instead])
],
[
AC_MSG_RESULT(no)
])
# Create some subdirectories for when you run configure from some other
# directory.
if test ! -d instrument; then mkdir instrument; fi

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.cc,v 1.121 2006-01-17 07:58:11 sshwarts Exp $
// $Id: cpu.cc,v 1.122 2006-01-18 18:35:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -47,11 +47,11 @@ bxPageWriteStampTable pageWriteStampTable;
void purgeICaches(void)
{
#if BX_SMP_PROCESSORS == 1
BX_CPU(0)->iCache.purgeICacheEntries();
#else
#if BX_SUPPORT_SMP
for (unsigned i=0; i<BX_SMP_PROCESSORS; i++)
BX_CPU(i)->iCache.purgeICacheEntries();
#else
BX_CPU(0)->iCache.purgeICacheEntries();
#endif
pageWriteStampTable.resetWriteStamps();
@ -59,11 +59,11 @@ void purgeICaches(void)
void flushICaches(void)
{
#if BX_SMP_PROCESSORS == 1
BX_CPU(0)->iCache.flushICacheEntries();
#else
#if BX_SUPPORT_SMP
for (unsigned i=0; i<BX_SMP_PROCESSORS; i++)
BX_CPU(i)->iCache.flushICacheEntries();
#else
BX_CPU(0)->iCache.flushICacheEntries();
#endif
pageWriteStampTable.resetWriteStamps();
@ -108,10 +108,10 @@ static unsigned iCacheMisses=0;
count--; if (count == 0) return; \
}
#if BX_SMP_PROCESSORS==1
# define BX_TICK1_IF_SINGLE_PROCESSOR() BX_TICK1()
#else
#if BX_SUPPORT_SMP
# define BX_TICK1_IF_SINGLE_PROCESSOR()
#else
# define BX_TICK1_IF_SINGLE_PROCESSOR() BX_TICK1()
#endif
// Make code more tidy with a few macros.
@ -420,7 +420,7 @@ debugger_check:
// inform instrumentation about new instruction
BX_INSTR_NEW_INSTRUCTION(BX_CPU_ID);
#if (BX_SMP_PROCESSORS>1 && BX_DEBUGGER==0)
#if (BX_SUPPORT_SMP && BX_DEBUGGER==0)
// The CHECK_MAX_INSTRUCTIONS macro allows cpu_loop to execute a few
// instructions and then return so that the other processors have a chance
// to run. This is used only when simulating multiple processors. If only
@ -502,7 +502,7 @@ unsigned BX_CPU_C::handleAsyncEvent(void)
if (BX_CPU_THIS_PTR debug_trap & 0x80000000) {
// I made up the bitmask above to mean HALT state.
#if BX_SMP_PROCESSORS==1
#if BX_SUPPORT_SMP == 0
BX_CPU_THIS_PTR debug_trap = 0; // clear traps for after resume
BX_CPU_THIS_PTR inhibit_mask = 0; // clear inhibits for after resume
// for one processor, pass the time as quickly as possible until
@ -522,7 +522,7 @@ unsigned BX_CPU_C::handleAsyncEvent(void)
}
BX_TICK1();
}
#else /* BX_SMP_PROCESSORS != 1 */
#else /* BX_SUPPORT_SMP */
// for multiprocessor simulation, even if this CPU is halted we still
// must give the others a chance to simulate. If an interrupt has
// arrived, then clear the HALT condition; otherwise just return from

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.h,v 1.251 2006-01-09 19:34:52 sshwarts Exp $
// $Id: cpu.h,v 1.252 2006-01-18 18:35:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -248,10 +248,10 @@
#define CPL (BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.rpl)
#if BX_SMP_PROCESSORS==1
#define BX_CPU_ID (0)
#else
#if BX_SUPPORT_SMP
#define BX_CPU_ID (BX_CPU_THIS_PTR bx_cpuid)
#else
#define BX_CPU_ID (0)
#endif
#endif // defined(NEED_CPU_REG_SHORTCUTS)
@ -388,12 +388,12 @@ class BX_CPU_C;
((BxExecutePtr_tR) (func)) args
#endif
#if BX_SMP_PROCESSORS==1
// single processor simulation, so there's one of everything
BOCHSAPI extern BX_CPU_C bx_cpu;
#else
#if BX_SUPPORT_SMP
// multiprocessor simulation, we need an array of cpus and memories
BOCHSAPI extern BX_CPU_C *bx_cpu_array[BX_SMP_PROCESSORS];
BOCHSAPI extern BX_CPU_C **bx_cpu_array;
#else
// single processor simulation, so there's one of everything
BOCHSAPI extern BX_CPU_C bx_cpu;
#endif
typedef struct {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: init.cc,v 1.78 2006-01-16 19:22:28 sshwarts Exp $
// $Id: init.cc,v 1.79 2006-01-18 18:35:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -43,7 +43,7 @@ BX_CPU_C::BX_CPU_C(unsigned id): bx_cpuid(id)
#if BX_WITH_WX
#if BX_SMP_PROCESSORS!=1
#if BX_SUPPORT_SMP
#ifdef __GNUC__
#warning cpu_param_handler only supports parameters for one processor.
#endif
@ -841,7 +841,7 @@ void BX_CPU_C::reset(unsigned source)
BX_CPU_THIS_PTR mxcsr.mxcsr = MXCSR_RESET;
#endif
#if (BX_SMP_PROCESSORS > 1)
#if BX_SUPPORT_SMP
// notice if I'm the bootstrap processor. If not, do the equivalent of
// a HALT instruction.
int apic_id = local_apic.get_id ();
@ -862,8 +862,8 @@ void BX_CPU_C::reset(unsigned source)
#else
BX_CPU_THIS_PTR async_event=2;
#endif
BX_CPU_THIS_PTR kill_bochs_request = 0;
BX_CPU_THIS_PTR kill_bochs_request = 0;
BX_INSTR_RESET(BX_CPU_ID);
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.h,v 1.149 2005-11-20 17:22:44 vruppert Exp $
// $Id: siminterface.h,v 1.150 2006-01-18 18:35:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Intro to siminterface by Bryce Denney:
@ -121,6 +121,7 @@ typedef enum {
// it's only important that they all be different from each other.
typedef enum {
BXP_NULL = 301,
BXP_CPU_COUNT,
BXP_IPS,
BXP_REALTIME_PIT,
BXP_TEXT_SNAPSHOT_CHECK,
@ -1551,3 +1552,4 @@ typedef struct BOCHSAPI {
BOCHSAPI extern bx_startup_flags_t bx_startup_flags;
BOCHSAPI extern bx_bool bx_user_quit;
BOCHSAPI extern Bit8u bx_cpu_count;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: ioapic.cc,v 1.24 2006-01-10 06:13:26 sshwarts Exp $
// $Id: ioapic.cc,v 1.25 2006-01-18 18:35:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
#include <stdio.h>
@ -38,6 +38,8 @@ bx_ioapic_c::bx_ioapic_c ()
bx_ioapic_c::~bx_ioapic_c () {}
#define BX_IOAPIC_DEFAULT_ID (BX_SMP_PROCESSORS)
void bx_ioapic_c::init ()
{
bx_generic_apic_c::init ();

View File

@ -1,5 +1,5 @@
////////////////////////////////////////////////////////////////////////
// $Id: virt_timer.h,v 1.7 2006-01-15 19:34:03 sshwarts Exp $
// $Id: virt_timer.h,v 1.8 2006-01-18 18:35:38 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -28,7 +28,8 @@
#ifndef _BX_VIRT_TIMER_H
#define _BX_VIRT_TIMER_H
#define BX_MAX_VIRTUAL_TIMERS (15+BX_SMP_PROCESSORS)
// should be adjusted if want to support more SMP processors
#define BX_MAX_VIRTUAL_TIMERS (32)
#define BX_NULL_VIRTUAL_TIMER_HANDLE 10000
#define BX_MAX_VIRTUAL_TIME (0x7fffffff)

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: logio.cc,v 1.50 2005-11-12 12:27:40 vruppert Exp $
// $Id: logio.cc,v 1.51 2006-01-18 18:35:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -25,7 +25,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "iodev/iodev.h"
#include <assert.h>
@ -39,18 +38,17 @@
// Just for the iofunctions
static int Allocio=0;
int Allocio=0;
void
iofunctions::flush(void) {
void iofunctions::flush(void)
{
if(logfd && magic == MAGIC_LOGNUM) {
fflush(logfd);
}
}
void
iofunctions::init(void) {
void iofunctions::init(void)
{
// iofunctions methods must not be called before this magic
// number is set.
magic=MAGIC_LOGNUM;
@ -65,22 +63,19 @@ iofunctions::init(void) {
log->ldebug ("Init(log file: '%s').",logfn);
}
void
iofunctions::add_logfn (logfunc_t *fn)
void iofunctions::add_logfn (logfunc_t *fn)
{
assert (n_logfn < MAX_LOGFNS);
logfn_list[n_logfn++] = fn;
}
void
iofunctions::set_log_action (int loglevel, int action)
void iofunctions::set_log_action (int loglevel, int action)
{
for (int i=0; i<n_logfn; i++)
logfn_list[i]->setonoff(loglevel, action);
}
void
iofunctions::init_log(const char *fn)
void iofunctions::init_log(const char *fn)
{
assert (magic==MAGIC_LOGNUM);
// use newfd/newfn so that we can log the message to the OLD log
@ -102,8 +97,7 @@ iofunctions::init_log(const char *fn)
logfn = newfn;
}
void
iofunctions::init_log(FILE *fs)
void iofunctions::init_log(FILE *fs)
{
assert (magic==MAGIC_LOGNUM);
logfd = fs;
@ -115,11 +109,9 @@ iofunctions::init_log(FILE *fs)
} else {
logfn = "(unknown)";
}
}
void
iofunctions::init_log(int fd)
void iofunctions::init_log(int fd)
{
assert (magic==MAGIC_LOGNUM);
FILE *tmpfd;
@ -129,7 +121,6 @@ iofunctions::init_log(int fd)
}
init_log(tmpfd);
return;
};
// all other functions may use genlog safely.
@ -147,8 +138,7 @@ iofunctions::set_log_prefix(const char* prefix) {
// DO NOT nest out() from ::info() and the like.
// fmt and ap retained for direct printinf from iofunctions only!
void
iofunctions::out(int f, int l, const char *prefix, const char *fmt, va_list ap)
void iofunctions::out(int f, int l, const char *prefix, const char *fmt, va_list ap)
{
char c=' ', *s;
assert (magic==MAGIC_LOGNUM);
@ -172,7 +162,7 @@ iofunctions::out(int f, int l, const char *prefix, const char *fmt, va_list ap)
while(*s) {
switch(*s) {
case '%':
if(*(s+1))s++;
if(*(s+1)) s++;
else break;
switch(*s) {
case 'd':
@ -182,7 +172,9 @@ iofunctions::out(int f, int l, const char *prefix, const char *fmt, va_list ap)
fprintf(logfd, FMT_TICK, bx_pc_system.time_ticks());
break;
case 'i':
fprintf(logfd, "%08x", BX_CPU(0)==NULL?0:BX_CPU(0)->dword.eip);
#if BX_SUPPORT_SMP == 0
fprintf(logfd, "%08x", BX_CPU(0)->dword.eip);
#endif
break;
case 'e':
fprintf(logfd, "%c", c);
@ -192,13 +184,13 @@ iofunctions::out(int f, int l, const char *prefix, const char *fmt, va_list ap)
break;
default:
fprintf(logfd,"%%%c",*s);
}
}
break;
default :
fprintf(logfd,"%c",*s);
}
}
s++;
}
}
fprintf(logfd," ");
@ -210,8 +202,6 @@ iofunctions::out(int f, int l, const char *prefix, const char *fmt, va_list ap)
vfprintf(logfd, fmt, ap);
fprintf(logfd, "\n");
fflush(logfd);
return;
}
iofunctions::iofunctions(FILE *fs)
@ -246,7 +236,8 @@ iofunctions::~iofunctions(void)
#define LOG_THIS genlog->
int logfunctions::default_onoff[N_LOGLEV] = {
int logfunctions::default_onoff[N_LOGLEV] =
{
ACT_IGNORE, // ignore debug
ACT_REPORT, // report info
ACT_REPORT, // report error
@ -295,8 +286,7 @@ logfunctions::~logfunctions(void)
}
}
void
logfunctions::setio(iofunc_t *i)
void logfunctions::setio(iofunc_t *i)
{
// add pointer to iofunction object to use
this->logio = i;
@ -304,20 +294,18 @@ logfunctions::setio(iofunc_t *i)
i->add_logfn (this);
}
void
logfunctions::put(char *p)
void logfunctions::put(char *p)
{
char *tmpbuf;
tmpbuf=strdup("[ ]");// if we ever have more than 32 chars,
// we need to rethink this
char * tmpbuf=strdup("[ ]"); // if we ever have more than 32 chars,
// we need to rethink this
if ( tmpbuf == NULL)
if (tmpbuf == NULL)
{
return ; /* allocation not successful */
return; /* allocation not successful */
}
if ( this->prefix != NULL )
if (this->prefix != NULL)
{
free(this->prefix); /* free previously allocated memory */
free(this->prefix); /* free previously allocated memory */
this->prefix = NULL;
}
int len=strlen(p);
@ -336,14 +324,12 @@ logfunctions::put(char *p)
this->prefix=tmpbuf;
}
void
logfunctions::settype(int t)
void logfunctions::settype(int t)
{
type=t;
}
void
logfunctions::info(const char *fmt, ...)
void logfunctions::info(const char *fmt, ...)
{
va_list ap;
@ -362,8 +348,7 @@ logfunctions::info(const char *fmt, ...)
}
void
logfunctions::error(const char *fmt, ...)
void logfunctions::error(const char *fmt, ...)
{
va_list ap;
@ -381,8 +366,7 @@ logfunctions::error(const char *fmt, ...)
va_end(ap);
}
void
logfunctions::panic(const char *fmt, ...)
void logfunctions::panic(const char *fmt, ...)
{
va_list ap;
@ -407,8 +391,7 @@ logfunctions::panic(const char *fmt, ...)
va_end(ap);
}
void
logfunctions::pass(const char *fmt, ...)
void logfunctions::pass(const char *fmt, ...)
{
va_list ap;
@ -433,8 +416,7 @@ logfunctions::pass(const char *fmt, ...)
va_end(ap);
}
void
logfunctions::ldebug(const char *fmt, ...)
void logfunctions::ldebug(const char *fmt, ...)
{
va_list ap;
@ -452,8 +434,7 @@ logfunctions::ldebug(const char *fmt, ...)
va_end(ap);
}
void
logfunctions::ask (int level, const char *prefix, const char *fmt, va_list ap)
void logfunctions::ask (int level, const char *prefix, const char *fmt, va_list ap)
{
// Guard against reentry on ask() function. The danger is that some
// function that's called within ask() could trigger another
@ -502,7 +483,7 @@ logfunctions::ask (int level, const char *prefix, const char *fmt, va_list ap)
// do something highly illegal that should kill the process.
// Hey, this is fun!
{
char *crashptr = (char *)0; char c = *crashptr;
char *crashptr = (char *)0; char c = *crashptr;
}
fprintf (stderr, "Sorry, I couldn't find your abort() function. Exiting.");
exit (0);
@ -514,28 +495,6 @@ logfunctions::ask (int level, const char *prefix, const char *fmt, va_list ap)
// instruction, it should notice the user interrupt and return to
// the debugger.
bx_guard.interrupt_requested = 1;
/*
// Russ Cox's CPU panic debug patch from Oct 2003 ->
// caused compilation errors when BX_DEBUGGER enabled
// actually, if this is a panic, it's very likely the caller will
// not be able to cope gracefully if we return and try to keep
// executing. so longjmp back to the cpu loop immediately.
if (level == LOGLEV_PANIC) {
BX_CPU_THIS_PTR stop_reason = STOP_CPU_PANIC;
bx_guard.special_unwind_stack = 1;
in_ask_already = 0;
longjmp(BX_CPU_THIS_PTR jmp_buf_env, 1); // go back to main decode loop
}
break;
#endif
#if BX_GDBSTUB
case BX_LOG_ASK_CHOICE_ENTER_DEBUG:
// user chose debugger (we're using gdb)
in_ask_already = 0;
BX_CPU_THIS_PTR ispanic = 1;
longjmp(BX_CPU_THIS_PTR jmp_buf_env, 1); // go back to main decode loop
*/
break;
#endif
default:
@ -589,8 +548,7 @@ static void carbonFatalDialog(const char *error, const char *exposition)
}
#endif
void
logfunctions::fatal (const char *prefix, const char *fmt, va_list ap, int exit_status)
void logfunctions::fatal (const char *prefix, const char *fmt, va_list ap, int exit_status)
{
bx_atexit();
#if BX_WITH_CARBON
@ -628,7 +586,7 @@ logfunctions::fatal (const char *prefix, const char *fmt, va_list ap, int exit_s
if (dbg_exit_called == 0) {
dbg_exit_called = 1;
bx_dbg_exit(exit_status);
}
}
#endif
// not safe to use BX_* log functions in here.
fprintf (stderr, "fatal() should never return, but it just did\n");
@ -647,5 +605,3 @@ void bx_center_print (FILE *file, char *line, int maxwidth)
for (int i=0; i<imax; i++) fputc (' ', file);
fputs (line, file);
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.305 2006-01-17 08:02:25 sshwarts Exp $
// $Id: main.cc,v 1.306 2006-01-18 18:35:37 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -82,6 +82,7 @@ logfunctions *pluginlog = &thePluginLog;
bx_startup_flags_t bx_startup_flags;
bx_bool bx_user_quit;
Bit8u bx_cpu_count;
/* typedefs */
@ -93,15 +94,14 @@ bx_pc_system_c bx_pc_system;
bx_debug_t bx_dbg;
// We have to define BX_CPU_C objects AFTER bx_pc_system_c is defined
// BX_CPU_C::local_apic object defines it own timer in constructor
// and pc_system_c constructor might overwrite it !
#if BX_SMP_PROCESSORS==1
// single processor simulation, so there's one of everything
BOCHSAPI BX_CPU_C bx_cpu;
typedef BX_CPU_C *BX_CPU_C_PTR;
#if BX_SUPPORT_SMP
// multiprocessor simulation, we need an array of cpus
BOCHSAPI BX_CPU_C_PTR *bx_cpu_array = NULL;
#else
// multiprocessor simulation, we need an array of cpus and memories
BOCHSAPI BX_CPU_C *bx_cpu_array[BX_SMP_PROCESSORS];
// single processor simulation, so there's one of everything
BOCHSAPI BX_CPU_C bx_cpu;
#endif
char *bochsrc_filename = NULL;
@ -726,6 +726,7 @@ bx_begin_simulation (int argc, char *argv[])
BX_PANIC (("no gui module was loaded"));
return 0;
}
bx_cpu_count = bx_options.Ocpu_count->get();
#if BX_DEBUGGER
// If using the debugger, it will take control and call
// bx_init_hardware() and cpu_loop()
@ -760,7 +761,7 @@ bx_begin_simulation (int argc, char *argv[])
// Not a great solution but it works. BBD
bx_options.Omouse_enabled->set (bx_options.Omouse_enabled->get());
#if BX_SMP_PROCESSORS == 1
#if BX_SUPPORT_SMP == 0
// only one processor, run as fast as possible by not messing with
// quantums and loops.
BX_CPU(0)->cpu_loop(1);
@ -883,13 +884,15 @@ int bx_init_hardware()
if (strcmp(bx_options.optram[3].Opath->getptr(), "") !=0)
BX_MEM(0)->load_RAM(bx_options.optram[3].Opath->getptr(), bx_options.optram[3].Oaddress->get(), 2);
#if BX_SMP_PROCESSORS == 1
#if BX_SUPPORT_SMP == 0
BX_CPU(0)->initialize(BX_MEM(0));
BX_CPU(0)->sanity_checks();
BX_INSTR_INIT(0);
BX_CPU(0)->reset(BX_RESET_HARDWARE);
#else
for (int i=0; i<BX_SMP_PROCESSORS; i++) {
bx_cpu_array = new BX_CPU_C_PTR[BX_SMP_PROCESSORS];
for (unsigned i=0; i<BX_SMP_PROCESSORS; i++) {
BX_CPU(i) = new BX_CPU_C(i);
BX_CPU(i)->initialize(BX_MEM(0)); // assign local apic id in 'initialize' method
BX_CPU(i)->sanity_checks();