[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bochs-cvs
Subject:    [Bochs-cvs] CVS: bochs .bochsrc, 1.131, 1.132 CHANGES, 1.230,
From:       Stanislav Shwartsman <sshwarts () users ! sourceforge ! net>
Date:       2006-06-21 20:42:29
Message-ID: E1Ft9Wv-0006TN-Bi () sc8-pr-cvs3 ! sourceforge ! net
[Download RAW message or body]

Update of /cvsroot/bochs/bochs
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24478

Modified Files:
	.bochsrc CHANGES config.cc config.h.in main.cc 
Log Message:
  - Allow to control SMP quantum value through .bochsrc CPU
    option parameter. Previous Bochs version used hardcoded quantum=5
    value.



Index: .bochsrc
===================================================================
RCS file: /cvsroot/bochs/bochs/.bochsrc,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -d -r1.131 -r1.132
--- .bochsrc	17 Jun 2006 07:45:21 -0000	1.131
+++ .bochsrc	21 Jun 2006 20:42:26 -0000	1.132
@@ -89,6 +89,11 @@
 #  If Bochs is compiled without SMP support, it won't accept values 
 #  different from 1.
 #
+#  QUANTUM:
+#  Maximum amount of instruction allowed to execute by processor before
+#  returning control to another cpu. This option exits only in Bochs 
+#  binary compiled with SMP support.
+#
 #  RESET_ON_TRIPLE_FAULT:
 #  Reset the CPU when triple fault occur (highly recommended) rather than
 #  PANIC. Remember that if you trying to continue after triple fault the 

Index: CHANGES
===================================================================
RCS file: /cvsroot/bochs/bochs/CHANGES,v
retrieving revision 1.230
retrieving revision 1.231
diff -u -d -r1.230 -r1.231
--- CHANGES	20 Jun 2006 17:05:57 -0000	1.230
+++ CHANGES	21 Jun 2006 20:42:26 -0000	1.231
@@ -27,6 +27,9 @@
   - Support for Dual Core and Intel(R) HyperThreading Technology. Now you
     could choose amount of cores per processor and amount of HT threads per
     core from .bochsrc for SMP simulation (Stanislav Shwartsman)
+  - Allow to control SMP quantum value through .bochsrc CPU
+    option parameter. Previous Bochs version used hardcoded quantum=5
+    value.
   - Fixed interrupt priority bug in service_local_apic()
   - Fixed again reading of APIC IRR/ISR/TMR registers. Finally it becomes
     fully correct :-)
@@ -41,26 +44,26 @@
     processor emulation (i.e. if cpu-level >= 6 and MMX is enabled)
 
 - general
-  - limited save/restore support added. The state of CPU, memory and all
+  - Limited save/restore support added. The state of CPU, memory and all
     devices can be saved now (state of harddisk images not handled yet).
-  - fixed several memory leaks
+  - Fixed several memory leaks
 
 - configuration interface
-  - configuration parameter handling rewritten to a parameter tree. This is
+  - Configuration parameter handling rewritten to a parameter tree. This is
     required for dynamic menus/dialogs, user-defined options and save/restore.
-  - support for user-defined bochsrc options added
+  - Support for user-defined bochsrc options added
 
 - I/O devices (Volker)
-  - floppy
+  - Floppy
     - partial sector transfers fixed
-  - hard drive /cdrom
+  - Hard drive /cdrom
     - several fixes to the IDE register behaviour in case of a channel with
       only one drive connected
     - fixed data alignment of 'growing' hard drive images (sharing images
       between Windows and Linux now possible)
     - disk geometry autodetection now supported by most of the image types
       (unsupported: external, dll and compressed modes)
-  - pci
+  - PCI
     - forward PIRQ register changes to the I/O APIC (if present)
 
 - SF patches applied

Index: config.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/config.cc,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- config.cc	5 Jun 2006 19:06:36 -0000	1.108
+++ config.cc	21 Jun 2006 20:42:26 -0000	1.109
@@ -397,6 +397,13 @@
       "Emulated instructions per second, used to calibrate bochs emulated time with \
wall clock time.",  1, BX_MAX_BIT32U,
       2000000);
+#if BX_SUPPORT_SMP
+  new bx_param_num_c(cpu_param,
+      "quantum", "Quantum ticks in SMP simulation",
+      "Maximum amount of instructions allowed to execute before returning control to \
another CPU.", +      BX_SMP_QUANTUM_MIN, BX_SMP_QUANTUM_MAX,
+      5);
+#endif
   new bx_param_bool_c(cpu_param,
       "reset_on_triple_fault", "Enable CPU reset on triple fault",
       "Enable CPU reset if triple fault occured (highly recommended)",
@@ -2146,10 +2153,10 @@
         PARSE_ERR(("%s: ataX directive malformed.", context));
       }
       else {
-        if ( (params[2][8] == '0') && (params[2][9] == 'x') )
-          SIM->get_param_num("ioaddr1", base)->set(strtoul (&params[2][8], NULL, \
16)); +        if ((params[2][8] == '0') && (params[2][9] == 'x'))
+          SIM->get_param_num("ioaddr1", base)->set(strtoul(&params[2][8], NULL, \
16));  else
-          SIM->get_param_num("ioaddr1", base)->set(strtoul (&params[2][8], NULL, \
10)); +          SIM->get_param_num("ioaddr1", base)->set(strtoul(&params[2][8], \
NULL, 10));  }
     }
 
@@ -2158,10 +2165,10 @@
         PARSE_ERR(("%s: ataX directive malformed.", context));
       }
       else {
-        if ( (params[3][8] == '0') && (params[3][9] == 'x') )
-          SIM->get_param_num("ioaddr2", base)->set(strtoul (&params[3][8], NULL, \
16)); +        if ((params[3][8] == '0') && (params[3][9] == 'x'))
+          SIM->get_param_num("ioaddr2", base)->set(strtoul(&params[3][8], NULL, \
16));  else
-          SIM->get_param_num("ioaddr2", base)->set(strtoul (&params[3][8], NULL, \
10)); +          SIM->get_param_num("ioaddr2", base)->set(strtoul(&params[3][8], \
NULL, 10));  }
     }
 
@@ -2396,6 +2403,10 @@
         if (SIM->get_param_num(BXPN_IPS)->get() < BX_MIN_IPS) {
           PARSE_WARN(("%s: WARNING: ips is AWFULLY low!", context));
         }
+#if BX_SUPPORT_SMP
+      } else if (!strncmp(params[i], "quantum=", 8)) {
+        SIM->get_param_num(BXPN_SMP_QUANTUM)->set(atol(&params[i][8]));
+#endif
       } else if (!strncmp(params[i], "reset_on_triple_fault=", 22)) {
         if (params[i][22] == '0' || params[i][22] == '1') {
           SIM->get_param_bool(BXPN_RESET_ON_TRIPLE_FAULT)->set (params[i][22] - \
'0'); @@ -2423,9 +2434,9 @@
     if (num_params == 3) {
       if (!strncmp(params[2], "address=", 8)) {
         if ((params[2][8] == '0') && (params[2][9] == 'x'))
-          SIM->get_param_num(BXPN_ROM_ADDRESS)->set(strtoul (&params[2][8], NULL, \
16)); +          SIM->get_param_num(BXPN_ROM_ADDRESS)->set(strtoul(&params[2][8], \
NULL, 16));  else
-          SIM->get_param_num(BXPN_ROM_ADDRESS)->set(strtoul (&params[2][8], NULL, \
10)); +          SIM->get_param_num(BXPN_ROM_ADDRESS)->set(strtoul(&params[2][8], \
NULL, 10));  } else {
         PARSE_ERR(("%s: romimage directive malformed.", context));
       }
@@ -2440,7 +2451,7 @@
       SIM->get_param_string(BXPN_VGA_ROM_PATH)->set(&params[1][5]);
     } else {
       BX_INFO(("WARNING: syntax has changed, please use 'vgaromimage: file=...' \
                now"));
-      SIM->get_param_string(BXPN_VGA_ROM_PATH)->set (params[1]);
+      SIM->get_param_string(BXPN_VGA_ROM_PATH)->set(params[1]);
     }
   } else if (!strncmp(params[0], "optromimage", 11)) {
     int num = atoi(&params[0][11]);
@@ -2458,9 +2469,9 @@
         SIM->get_param_string(tmppath)->set(&params[i][5]);
       } else if (!strncmp(params[i], "address=", 8)) {
         if ((params[i][8] == '0') && (params[2][9] == 'x'))
-          SIM->get_param_num(tmpaddr)->set(strtoul (&params[i][8], NULL, 16));
+          SIM->get_param_num(tmpaddr)->set(strtoul(&params[i][8], NULL, 16));
         else
-          SIM->get_param_num(tmpaddr)->set(strtoul (&params[i][8], NULL, 10));
+          SIM->get_param_num(tmpaddr)->set(strtoul(&params[i][8], NULL, 10));
       } else {
         PARSE_ERR(("%s: optromimage%d directive malformed.", context, num));
       }
@@ -2481,9 +2492,9 @@
         SIM->get_param_string(tmppath)->set(&params[i][5]);
       } else if (!strncmp(params[i], "address=", 8)) {
         if ((params[i][8] == '0') && (params[2][9] == 'x'))
-          SIM->get_param_num(tmpaddr)->set(strtoul (&params[i][8], NULL, 16));
+          SIM->get_param_num(tmpaddr)->set(strtoul(&params[i][8], NULL, 16));
         else
-          SIM->get_param_num(tmpaddr)->set(strtoul (&params[i][8], NULL, 10));
+          SIM->get_param_num(tmpaddr)->set(strtoul(&params[i][8], NULL, 10));
       } else {
         PARSE_ERR(("%s: optramimage%d directive malformed.", context, num));
       }
@@ -3417,9 +3428,10 @@
   fprintf(fp, "vga_update_interval: %u\n", \
SIM->get_param_num(BXPN_VGA_UPDATE_INTERVAL)->get());  fprintf(fp, "vga: \
extension=%s\n", SIM->get_param_string(BXPN_VGA_EXTENSION)->getptr());  #if \
                BX_SUPPORT_SMP
-  fprintf(fp, "cpu: count=%u:%u:%u, ips=%u, reset_on_triple_fault=%d\n", 
+  fprintf(fp, "cpu: count=%u:%u:%u, ips=%u, quantum=%d, reset_on_triple_fault=%d\n", \
                
     SIM->get_param_num(BXPN_CPU_NPROCESSORS)->get(), \
                SIM->get_param_num(BXPN_CPU_NCORES)->get(),
     SIM->get_param_num(BXPN_CPU_NTHREADS)->get(), \
SIM->get_param_num(BXPN_IPS)->get(), +    \
SIM->get_param_num(BXPN_SMP_QUANTUM)->get(),  \
SIM->get_param_bool(BXPN_RESET_ON_TRIPLE_FAULT)->get());  #else
   fprintf(fp, "cpu: count=1, ips=%u, reset_on_triple_fault=%d\n", 

Index: config.h.in
===================================================================
RCS file: /cvsroot/bochs/bochs/config.h.in,v
retrieving revision 1.187
retrieving revision 1.188
diff -u -d -r1.187 -r1.188
--- config.h.in	31 May 2006 17:20:52 -0000	1.187
+++ config.h.in	21 Jun 2006 20:42:26 -0000	1.188
@@ -210,6 +210,12 @@
 // IPS value set in the config file.
 #define BX_MIN_IPS 200000
 
+// Minimum and maximum values for SMP quantum variable. Defines
+// how many instructions each CPU could execute execute in one 
+// shot (one cpu_loop call)
+#define BX_SMP_QUANTUM_MIN  1
+#define BX_SMP_QUANTUM_MAX 16
+
 // Use Static Member Funtions to eliminate 'this' pointer passing
 // If you want the efficiency of 'C', you can make all the
 // members of the C++ CPU class to be static.

Index: main.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/main.cc,v
retrieving revision 1.337
retrieving revision 1.338
diff -u -d -r1.337 -r1.338
--- main.cc	30 May 2006 19:46:31 -0000	1.337
+++ main.cc	21 Jun 2006 20:42:26 -0000	1.338
@@ -399,7 +399,7 @@
 // NOTE: It could probably be written so that it can safely be called for all
 // win32 builds.  Right now it appears to have absolutely no error checking:
 // for example if AllocConsole returns false we should probably return early.
-void RedirectIOToConsole ()
+void RedirectIOToConsole()
 {
   int hConHandle;
   long lStdHandle;
@@ -409,13 +409,13 @@
   // redirect unbuffered STDOUT to the console
   lStdHandle = (long)GetStdHandle(STD_OUTPUT_HANDLE);
   hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
-  fp = _fdopen( hConHandle, "w" );
+  fp = _fdopen(hConHandle, "w");
   *stdout = *fp;
   setvbuf( stdout, NULL, _IONBF, 0 );
   // redirect unbuffered STDIN to the console
   lStdHandle = (long)GetStdHandle(STD_INPUT_HANDLE);
   hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
-  fp = _fdopen( hConHandle, "r" );
+  fp = _fdopen(hConHandle, "r");
   *stdin = *fp;
   setvbuf( stdin, NULL, _IONBF, 0 );
   // redirect unbuffered STDERR to the console
@@ -423,7 +423,7 @@
   hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
   fp = _fdopen( hConHandle, "w" );
   *stderr = *fp;
-  setvbuf( stderr, NULL, _IONBF, 0 );
+  setvbuf(stderr, NULL, _IONBF, 0);
 }
 #endif  /* if defined(__WXMSW__) || (BX_WITH_SDL && defined(WIN32)) */
 
@@ -443,8 +443,8 @@
   RedirectIOToConsole ();
   int max_argv = 20;
   bx_startup_flags.argv = (char**) malloc (max_argv * sizeof (char*));
-  split_string_into_argv (m_lpCmdLine, &bx_startup_flags.argc, \
                bx_startup_flags.argv, max_argv);
-  return bxmain ();
+  split_string_into_argv(m_lpCmdLine, &bx_startup_flags.argc, bx_startup_flags.argv, \
max_argv); +  return bxmain();
 }
 #endif
 
@@ -462,7 +462,7 @@
 #if defined(WIN32)
   SetConsoleTitle("Bochs for Windows - Console");
 #endif
-  return bxmain ();
+  return bxmain();
 }
 #endif
 
@@ -683,7 +683,7 @@
 #endif
     if (bochsrc_filename == NULL) bochsrc_filename = bx_find_bochsrc ();
     if (bochsrc_filename)
-      norcfile = bx_read_configuration (bochsrc_filename);
+      norcfile = bx_read_configuration(bochsrc_filename);
   }
 
   if (norcfile) {
@@ -722,7 +722,7 @@
   return 0;
 }
 
-bx_bool load_and_init_display_lib ()
+bx_bool load_and_init_display_lib()
 {
   if (bx_gui != NULL) {
     // bx_gui has already been filled in.  This happens when you start
@@ -876,7 +876,7 @@
     // to another.  Increasing quantum speeds up overall performance, but
     // reduces granularity of synchronization between processors.
     int processor = 0;
-    int quantum = 5;
+    int quantum = SIM->get_param_num(BXPN_SMP_QUANTUM)->get();
     while (1) {
       // do some instructions in each processor
       BX_CPU(processor)->cpu_loop(quantum);
@@ -924,8 +924,8 @@
 
   if (SIM->get_param_enum(BXPN_BOCHS_START)->get()==BX_QUICK_START) {
     for (int level=0; level<N_LOGLEV; level++) {
-      int action = SIM->get_default_log_action (level);
-      io->set_log_action (level, action);
+      int action = SIM->get_default_log_action(level);
+      io->set_log_action(level, action);
     }
   }
 
@@ -949,13 +949,18 @@
   BX_INFO(("  APIC support: %s",BX_SUPPORT_APIC?"yes":"no"));
   BX_INFO(("CPU configuration"));
   BX_INFO(("  level: %d",BX_CPU_LEVEL));
-  BX_INFO(("  fpu support: %s",BX_SUPPORT_FPU?"yes":"no"));
   BX_INFO(("  paging support: %s, tlb enabled: \
                %s",BX_SUPPORT_PAGING?"yes":"no",BX_USE_TLB?"yes":"no"));
-  BX_INFO(("  mmx support: %s",BX_SUPPORT_MMX?"yes":"no"));
+#if BX_SUPPORT_SMP
+  BX_INFO(("  SMP support: yes, quantum=%d", \
SIM->get_param_num(BXPN_SMP_QUANTUM)->get())); +#else
+  BX_INFO(("  SMP support: no"));
+#endif
+  BX_INFO(("  FPU support: %s",BX_SUPPORT_FPU?"yes":"no"));
+  BX_INFO(("  MMX support: %s",BX_SUPPORT_MMX?"yes":"no"));
   if (BX_SUPPORT_SSE == 0)
-    BX_INFO(("  sse support: no"));
+    BX_INFO(("  SSE support: no"));
   else
-    BX_INFO(("  sse support: %d",BX_SUPPORT_SSE));
+    BX_INFO(("  SSE support: %d",BX_SUPPORT_SSE));
   BX_INFO(("  v8086 mode support: %s",BX_SUPPORT_V8086_MODE?"yes":"no"));
   BX_INFO(("  VME support: %s",BX_SUPPORT_VME?"yes":"no"));
   BX_INFO(("  3dnow! support: %s",BX_SUPPORT_3DNOW?"yes":"no"));
@@ -1126,21 +1131,21 @@
 
   // in case we ended up in simulation mode, change back to config mode
   // so that the user can see any messages left behind on the console.
-  SIM->set_display_mode (DISP_MODE_CONFIG);
+  SIM->set_display_mode(DISP_MODE_CONFIG);
 
 #if BX_PROVIDE_DEVICE_MODELS==1
   bx_pc_system.exit();
 #endif
 
 #if BX_DEBUGGER == 0
-  if (SIM && SIM->get_init_done ()) {
+  if (SIM && SIM->get_init_done()) {
     for (int cpu=0; cpu<BX_SMP_PROCESSORS; cpu++)
       if (BX_CPU(cpu)) BX_CPU(cpu)->atexit();
   }
 #endif
 
 #if BX_SUPPORT_PCI
-  if (SIM && SIM->get_init_done ()) {
+  if (SIM && SIM->get_init_done()) {
     if (SIM->get_param_bool(BXPN_I440FX_SUPPORT)->get()) {
       bx_devices.pluginPciBridge->print_i440fx_state();
     }
@@ -1149,7 +1154,7 @@
 
   // restore signal handling to defaults
 #if !BX_DEBUGGER
-  BX_INFO (("restoring default signal behavior"));
+  BX_INFO(("restoring default signal behavior"));
   signal(SIGINT, SIG_DFL);
 #endif
 
@@ -1170,15 +1175,15 @@
   // Otherwise the BX_PANIC() below can be called in multiple threads at
   // once, leading to multiple threads trying to display a dialog box,
   // leading to GUI deadlock.
-  if (!SIM->is_sim_thread ()) {
+  if (!SIM->is_sim_thread()) {
     BX_INFO (("bx_signal_handler: ignored sig %d because it wasn't called from the \
simulator thread", signum));  return;
   }
 #if BX_GUI_SIGHANDLER
   if (bx_gui_sighandler) {
     // GUI signal handler gets first priority, if the mask says it's wanted
-    if ((1<<signum) & bx_gui->get_sighandler_mask ()) {
-      bx_gui->sighandler (signum);
+    if ((1<<signum) & bx_gui->get_sighandler_mask()) {
+      bx_gui->sighandler(signum);
       return;
     }
   }


All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Bochs-cvs mailing list
Bochs-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bochs-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic