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

List:       bochs-cvs
Subject:    [Bochs-cvs] CVS: bochs/patches patch.param-tree,1.1,1.2
From:       Volker Ruppert <vruppert () users ! sourceforge ! net>
Date:       2005-07-31 16:09:19
Message-ID: E1DzGNL-0000Gh-U2 () sc8-pr-cvs1 ! sourceforge ! net
[Download RAW message or body]

Update of /cvsroot/bochs/bochs/patches
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv898

Modified Files:
	patch.param-tree 
Log Message:

- patch updated for current CVS


Index: patch.param-tree
===================================================================
RCS file: /cvsroot/bochs/bochs/patches/patch.param-tree,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- patch.param-tree	17 Mar 2003 05:29:15 -0000	1.1
+++ patch.param-tree	31 Jul 2005 16:09:17 -0000	1.2
@@ -38,31 +38,33 @@
   SIM->get_param("memory.ram.megs");
 
 
+The patch now applies to current CVS again. There are no functional changes
+present yet.
+(Volker Ruppert, July 31th 2005)
+
 Patch was created with:
-  cvs diff -u
+  diff -u
 Apply patch to what version:
-  cvs checked out on DATE, release version VER
+  cvs checked out on 31 Jul 2005
 Instructions:
   To patch, go to main bochs directory.
   Type "patch -p0 < THIS_PATCH_FILE".
 ----------------------------------------------------------------------
-
-Index: main.cc
-===================================================================
-RCS file: /cvsroot/bochs/bochs/main.cc,v
-retrieving revision 1.223
-diff -u -r1.223 main.cc
---- main.cc	13 Feb 2003 15:51:12 -0000	1.223
-+++ main.cc	17 Mar 2003 05:25:02 -0000
-@@ -52,6 +52,7 @@
- #ifndef BX_SHARE_PATH
- #define BX_SHARE_PATH NULL
- #endif
+diff -urN ../bochs/bochs.h ./bochs.h
+--- ../bochs/bochs.h	2005-07-31 17:35:01.000000000 +0200
++++ ./bochs.h	2005-07-31 17:45:13.474468584 +0200
+@@ -111,6 +111,7 @@
+ int bx_read_configuration (char *rcfile);
+ int bx_write_configuration (char *rcfile, int overwrite);
+ void bx_reset_options (void);
 +void print_tree (bx_param_c *node, int level = 0);
  
- 
- int bochsrc_include_count = 0;
-@@ -344,6 +345,8 @@
+ //
+ // some macros to interface the CPU and memory to external environment
+diff -urN ../bochs/config.cc ./config.cc
+--- ../bochs/config.cc	2005-07-31 17:35:01.000000000 +0200
++++ ./config.cc	2005-07-31 17:45:40.113418848 +0200
+@@ -372,6 +372,8 @@
  
    memset (&bx_options, 0, sizeof(bx_options));
  
@@ -71,9 +73,9 @@
    // quick start option, set by command line arg
    new bx_param_enum_c (BXP_BOCHS_START,
        "Bochs start types",
-@@ -735,8 +738,14 @@
-   menu = new bx_list_c (BXP_MENU_DISK, "Bochs Disk Options", "diskmenu", \
                disk_menu_init_list);
-   menu->get_options ()->set (menu->SHOW_PARENT);
+@@ -808,8 +810,14 @@
+   menu = new bx_list_c (BXP_BOOT, "Boot options", "", boot_init_list);
+ #endif
  
 +  // memory subtree
 +  bx_list_c *memory = new bx_list_c (root_param, "memory", "");
@@ -86,147 +88,27 @@
 +  bx_options.memory.Osize = new bx_param_num_c (ram,
        "megs",
        "Amount of RAM in megabytes",
-       1, BX_MAX_BIT32U,
-@@ -1313,6 +1322,9 @@
+       1, 2048,
+@@ -1734,6 +1742,9 @@
    };
-   menu = new bx_list_c (BXP_MENU_MISC, "Configure Everything Else", "", \
                other_init_list);
-   menu->get_options ()->set (menu->SHOW_PARENT);
+   menu = new bx_list_c (BXP_MENU_RUNTIME, "Misc runtime options", "", \
runtime_init_list); +   menu->get_options ()->set (menu->SHOW_PARENT | \
menu->SHOW_GROUP_NAME);  +
 +  printf ("parameter tree:\n");
 +  print_tree (root_param, 0);
  }
  
  void bx_reset_options ()
-@@ -1351,7 +1363,7 @@
-   // boot & memory
-   bx_options.Obootdrive->reset();
+@@ -1777,7 +1788,7 @@
+     bx_options.Obootdrive[i]->reset();
+   }
    bx_options.OfloppySigCheck->reset();
 -  bx_options.memory.Osize->reset();
 +  SIM->get_param("memory.ram.megs")->reset ();
  
    // standard ports
-   bx_options.com[0].Oenabled->reset();
-@@ -1509,8 +1521,109 @@
- }
- #endif
- 
-+void bx_test_params () {
-+  printf ("Begin\n");
-+
-+  // create numeric parameter a
-+  bx_param_num_c *ap = new bx_param_num_c (BXP_NULL,
-+    "parameter a",
-+    "description of a",
-+    0,    // minimum value
-+    10,   // maximum value
-+    1);   // default value
-+  printf ("%s is %d\n", ap->get_name(), ap->get ());
-+  ap->set(10);
-+  printf ("%s is %d\n", ap->get_name(), ap->get ());
-+  //ap->set(11);   // causes assert because 11 is out of range
-+  printf ("Resetting a to initial value.\n");
-+  ap->reset ();
-+  printf ("%s is %d\n", ap->get_name(), ap->get ());
-+  Bit32u b = 77;
-+  bx_param_num_c *bp = new bx_shadow_num_c (BXP_NULL,
-+    "shadow parameter b", 
-+    "description of b",
-+    &b);
-+  printf ("%s is %d\n", bp->get_name(), bp->get ());
-+  b = 32;
-+  printf ("%s is %d\n", bp->get_name(), bp->get ());
-+  bp->set (45);
-+  printf ("%s is %d\n", bp->get_name(), bp->get ());
-+  //printf ("Resetting b to initial value.\n");
-+  //bp->reset ();  // not supported on shadow params
-+  printf ("%s is %d\n", bp->get_name(), bp->get ());
-+  printf ("End\n");
-+}
-+
-+void print_tree (bx_param_c *node, int level)
-+{
-+  int i;
-+  for (i=0; i<level; i++)
-+    printf ("  ");
-+  if (node == NULL) {
-+      printf ("NULL pointer\n");
-+      return;
-+  }
-+  switch (node->get_type()) {
-+    case BXT_PARAM_NUM:
-+      printf ("%s = %d  (number)\n", node->get_name(), \
                ((bx_param_num_c*)node)->get());
-+      break;
-+    case BXT_PARAM_BOOL:
-+      printf ("%s = %s  (boolean)\n", node->get_name(), \
                ((bx_param_bool_c*)node)->get()?"true":"false");
-+      break;
-+    case BXT_PARAM:
-+    case BXT_PARAM_ENUM:
-+    case BXT_PARAM_STRING:
-+      printf ("%s = '%s'  (string)\n", node->get_name(), \
                ((bx_param_string_c*)node)->getptr());
-+      break;
-+    case BXT_LIST:
-+      {
-+	printf ("%s = \n", node->get_name ());
-+	bx_list_c *list = (bx_list_c*)node;
-+	for (i=0; i < list->get_size (); i++) {
-+	   print_tree (list->get(i), level+1);
-+	}
-+	break;
-+      }
-+  }
-+}
-+
-+void test_lookup (const char *pname) 
-+{
-+  printf ("looking up parameter '%s'\n", pname);
-+  bx_param_c *param = SIM->get_param (pname);
-+  print_tree (param);
-+}
-+
-+void bx_test_param_tree () {
-+  printf ("bx_test_param_tree\n");
-+  bx_list_c *top = new bx_list_c (BXP_NULL, 
-+      "bochs", "top level object",
-+      20);
-+  bx_list_c *memory = new bx_list_c (top, "memory", "", 5);
-+  bx_list_c *ram = new bx_list_c (memory, "ram", "", 5);
-+  new bx_param_num_c (ram, "size", "Size of RAM in megabytes",
-+      1, BX_MAX_BIT32U, BX_DEFAULT_MEM_MEGS);
-+  bx_list_c *rom = new bx_list_c (memory, "rom", "", 5);
-+  new bx_param_num_c (rom, "address", "ROM Address",
-+      0, 0xffff, 0xf000);
-+  print_tree (top);
-+  printf ("Finding memory size: \n");
-+  test_lookup (".");
-+  test_lookup ("memory.ram.size");
-+  test_lookup ("memory.ram");
-+  //test_lookup ("memory.ram.");  // illegal
-+  //test_lookup ("memory.ram..size");  // illegal
-+  printf ("bx_test_param_tree done\n");
-+}
-+
- int bxmain () {
-   bx_init_siminterface ();   // create the SIM object
-+  //bx_test_params ();
-+  //bx_test_param_tree ();
-+  //exit(0);
-+
-+
-+
-   static jmp_buf context;
-   if (setjmp (context) == 0) {
-     SIM->set_quit_context (&context);
-@@ -2179,7 +2292,8 @@
-   }
- 
- #if BX_SMP_PROCESSORS==1
--  BX_MEM(0)->init_memory(bx_options.memory.Osize->get () * 1024*1024);
-+  bx_param_num_c *memsize = SIM->get_param_num("memory.ram.megs");
-+  BX_MEM(0)->init_memory(memsize->get() * 1024*1024);
- 
-   // First load the optional ROM images
-   if (strcmp(bx_options.optrom[0].Opath->getptr (),"") !=0 )
-@@ -3286,7 +3400,7 @@
+   for (i=0; i<BX_N_SERIAL_PORTS; i++) {
+@@ -2771,7 +2782,7 @@
      if (num_params != 2) {
        PARSE_ERR(("%s: megs directive: wrong # args.", context));
        }
@@ -235,14 +117,10 @@
      }
    else if (!strcmp(params[0], "floppy_command_delay")) {
      if (num_params != 2) {
-Index: gui/siminterface.cc
-===================================================================
-RCS file: /cvsroot/bochs/bochs/gui/siminterface.cc,v
-retrieving revision 1.94
-diff -u -r1.94 siminterface.cc
---- gui/siminterface.cc	6 Feb 2003 23:16:55 -0000	1.94
-+++ gui/siminterface.cc	17 Mar 2003 05:25:04 -0000
-@@ -10,6 +10,7 @@
+diff -urN ../bochs/gui/siminterface.cc ./gui/siminterface.cc
+--- ../bochs/gui/siminterface.cc	2005-01-05 20:50:54.000000000 +0100
++++ ./gui/siminterface.cc	2005-07-31 12:19:59.000000000 +0200
+@@ -11,6 +11,7 @@
  
  bx_simulator_interface_c *SIM = NULL;
  logfunctions *siminterface_log = NULL;
@@ -250,7 +128,7 @@
  #define LOG_THIS siminterface_log->
  
  // bx_simulator_interface just defines the interface that the Bochs simulator
-@@ -51,10 +52,19 @@
+@@ -52,10 +53,19 @@
    virtual int register_param (bx_id id, bx_param_c *it);
    virtual void reset_all_param ();
    virtual bx_param_c *get_param (bx_id id);
@@ -270,7 +148,7 @@
    virtual int get_n_log_modules ();
    virtual char *get_prefix (int mod);
    virtual int get_log_action (int mod, int level);
-@@ -145,6 +155,56 @@
+@@ -146,6 +156,56 @@
    return retval;
  }
  
@@ -327,7 +205,7 @@
  bx_param_num_c *
  bx_real_sim_c::get_param_num (bx_id id) {
    bx_param_c *generic = get_param(id);
-@@ -159,6 +219,20 @@
+@@ -160,6 +220,20 @@
    return NULL;
  }
  
@@ -348,7 +226,7 @@
  bx_param_string_c *
  bx_real_sim_c::get_param_string (bx_id id) {
    bx_param_c *generic = get_param(id);
-@@ -172,6 +246,19 @@
+@@ -173,6 +247,19 @@
    return NULL;
  }
  
@@ -368,7 +246,7 @@
  bx_param_bool_c *
  bx_real_sim_c::get_param_bool (bx_id id) {
    bx_param_c *generic = get_param(id);
-@@ -185,6 +272,19 @@
+@@ -186,6 +273,19 @@
    return NULL;
  }
  
@@ -388,7 +266,7 @@
  bx_param_enum_c *
  bx_real_sim_c::get_param_enum (bx_id id) {
    bx_param_c *generic = get_param(id);
-@@ -198,6 +298,19 @@
+@@ -199,6 +299,19 @@
    return NULL;
  }
  
@@ -408,7 +286,7 @@
  void bx_init_siminterface ()
  {
    siminterface_log = new logfunctions ();
-@@ -205,6 +318,12 @@
+@@ -206,6 +319,12 @@
    siminterface_log->settype(CTRLLOG);
    if (SIM == NULL) 
      SIM = new bx_real_sim_c();
@@ -421,15 +299,15 @@
  }
  
  bx_simulator_interface_c::bx_simulator_interface_c ()
-@@ -795,6 +914,7 @@
-   this->ask_format = NULL;
+@@ -806,6 +925,7 @@
+   this->group_name = NULL;
    this->runtime_param = 0;
    this->enabled = 1;
 +  this->parent = NULL;
    SIM->register_param (id, this);
  }
  
-@@ -804,6 +924,22 @@
+@@ -815,6 +935,22 @@
    return old;
  }
  
@@ -452,7 +330,7 @@
  bx_param_num_c::bx_param_num_c (bx_id id,
      char *name,
      char *description,
-@@ -823,6 +959,28 @@
+@@ -835,6 +971,28 @@
    set (initial_val);
  }
  
@@ -481,16 +359,16 @@
  Bit32u bx_param_num_c::default_base = 10;
  
  Bit32u bx_param_num_c::set_default_base (Bit32u val) {
-@@ -874,7 +1032,7 @@
+@@ -892,7 +1050,7 @@
      val.number = newval;
    }
-   if ((val.number < min || val.number > max) && max != BX_MAX_BIT64U)
--    BX_PANIC (("numerical parameter %s was set to %lld, which is out of range %lld \
                to %lld", get_name (), val.number, min, max));
-+    BX_PANIC (("numerical parameter '%s' was set to %lld, which is out of range \
%lld to %lld", get_name (), val.number, min, max)); +   if ((val.number < min || \
val.number > max) && (Bit64u)max != BX_MAX_BIT64U) +-    BX_PANIC (("numerical \
parameter %s was set to " FMT_LL "d, which is out of range " FMT_LL "d to " FMT_LL \
"d", get_name (), val.number, min, max)); ++    BX_PANIC (("numerical parameter '%s' \
was set to " FMT_LL "d, which is out of range " FMT_LL "d to " FMT_LL "d", get_name \
(), val.number, min, max));  if (dependent_list != NULL) update_dependents ();
  }
  
-@@ -1083,6 +1241,12 @@
+@@ -1105,6 +1263,12 @@
    }
  }
  
@@ -503,7 +381,7 @@
  bx_param_bool_c::bx_param_bool_c (bx_id id,
      char *name,
      char *description,
-@@ -1277,6 +1441,7 @@
+@@ -1316,6 +1480,7 @@
    this->size = 0;
    this->maxsize = maxsize;
    this->list = new bx_param_c*  [maxsize];
@@ -511,7 +389,7 @@
    init ();
  }
  
-@@ -1287,6 +1452,24 @@
+@@ -1326,6 +1491,24 @@
    this->size = 0;
    this->maxsize = maxsize;
    this->list = new bx_param_c*  [maxsize];
@@ -536,7 +414,7 @@
    init ();
  }
  
-@@ -1302,6 +1485,7 @@
+@@ -1341,6 +1524,7 @@
    for (int i=0; i<this->size; i++)
      this->list[i] = init_list[i];
    init ();
@@ -544,7 +422,7 @@
  }
  
  bx_list_c::~bx_list_c()
-@@ -1342,17 +1526,15 @@
+@@ -1381,17 +1565,15 @@
    this->choice = new bx_param_num_c (BXP_NULL,
        "list_choice", "", 0, BX_MAX_BIT64S,
        1);
@@ -563,12 +441,10 @@
    return newlist;
  }
  
-@@ -1370,5 +1552,18 @@
- {
-   BX_ASSERT (index >= 0 && index < size);
+@@ -1411,3 +1593,16 @@
    return list[index];
-+}
-+
+ }
+ 
 +bx_param_c *
 +bx_list_c::get_by_name (const char *name)
 +{
@@ -580,58 +456,20 @@
 +    }
 +  }
 +  return NULL;
- }
- 
-Index: gui/siminterface.h
-===================================================================
-RCS file: /cvsroot/bochs/bochs/gui/siminterface.h,v
-retrieving revision 1.99
-diff -u -r1.99 siminterface.h
---- gui/siminterface.h	6 Feb 2003 23:16:54 -0000	1.99
-+++ gui/siminterface.h	17 Mar 2003 05:25:06 -0000
-@@ -2,6 +2,8 @@
- // $Id$
- /////////////////////////////////////////////////////////////////////////
- //
-+// Intro to siminterface by Bryce Denney:
-+//
- // Before I can describe what this file is for, I have to make the
- // distinction between a configuration interface (CI) and the VGA display
- // window (VGAW).  I will try to avoid the term 'GUI' because it is unclear 
-@@ -46,18 +48,18 @@
- // bx_floppy.s.media[2].heads = 17.  If such access is needed, then a
- // siminterface method should be written to make the change on the CI's behalf.
- // This separation is enforced by the fact that the CI does not even include
--// bochs.h.  You'll notice that control.cc include osdep.h, control.h, and
--// siminterface.h, so it doesn't know what bx_floppy or bx_cpu_c are.  I'm sure
--// some people will say is overly restrictive and/or annoying.  When I set it
--// up this way, we were still talking about making the CI in a seperate
-+// bochs.h.  You'll notice that control.cc includes osdep.h, control.h, and
-+// siminterface.h, but it doesn't know what bx_floppy or bx_cpu_c are.  I'm
-+// sure some people will say is overly restrictive and/or annoying.  When I
-+// set it up this way, we were still talking about making the CI in a seperate
- // process, where direct method calls would be impossible.  Also, we have been
--// considering turning devices into plugin modules which are dynamically 
-+// considering turning devices into plugin modules which are dynamically
- // linked.  Any direct references to something like bx_floppy.s.media[2].heads
- // would have to be reworked before a plugin interface was possible as well.
- //
- // The siminterface is the glue between the CI and the simulator.  There is
- // just one global instance of the siminterface object, which can be referred
--// to by the global variable bx_simulator_interface_c *SIM; The base class
-+// to by the global variable bx_simulator_interface_c *SIM.  The base class
- // bx_simulator_interface_c, contains only virtual functions and it defines the
- // interface that the CI is allowed to use.  In siminterface.cc, a class
- // called bx_real_sim_c is defined with bx_simulator_interface_c as its parent
-@@ -777,6 +779,7 @@
++}
++
+diff -urN ../bochs/gui/siminterface.h ./gui/siminterface.h
+--- ../bochs/gui/siminterface.h	2005-07-31 16:49:45.000000000 +0200
++++ ./gui/siminterface.h	2005-07-31 17:04:35.189144296 +0200
+@@ -885,6 +885,7 @@
  class BOCHSAPI bx_param_c : public bx_object_c {
    BOCHSAPI_CYGONLY static const char *default_text_format;
  protected:
 +  bx_list_c *parent;
    char *name;
    char *description;
-   const char *text_format;  // printf format string. %d for ints, %s for strings, \
                etc.
-@@ -785,6 +788,7 @@
+   char *label; // label string for text menus and gui dialogs
+@@ -895,6 +896,7 @@
    int enabled;
  public:
    bx_param_c (bx_id id, char *name, char *description);
@@ -639,7 +477,7 @@
    void set_format (const char *format) {text_format = format;}
    const char *get_format () {return text_format;}
    void set_ask_format (char *format) {ask_format = format; }
-@@ -794,7 +798,7 @@
+@@ -909,7 +911,7 @@
    char *get_description () { return description; }
    int get_enabled () { return enabled; }
    virtual void set_enabled (int enabled) { this->enabled = enabled; }
@@ -648,7 +486,7 @@
    int getint () {return -1;}
    static const char* set_default_format (const char *f);
    static const char *get_default_format () { return default_text_format; }
-@@ -832,7 +836,11 @@
+@@ -955,7 +957,11 @@
        char *name,
        char *description,
        Bit64s min, Bit64s max, Bit64s initial_val);
@@ -659,18 +497,9 @@
 +      Bit64s min, Bit64s max, Bit64s initial_val);
 +  virtual void reset ();
    void set_handler (param_event_handler handler);
+   void set_enable_handler (param_enable_handler handler);
    virtual bx_list_c *get_dependent_list () { return dependent_list; }
-   void set_dependent_list (bx_list_c *l);
-@@ -857,7 +865,7 @@
- // a bx_shadow_num_c is like a bx_param_num_c except that it doesn't
- // store the actual value with its data. Instead, it uses val.p32bit
- // to keep a pointer to the actual data.  This is used to register
--// existing variables as parameters, without have to access it via
-+// existing variables as parameters, without having to access it via
- // set/get methods.
- class BOCHSAPI bx_shadow_num_c : public bx_param_num_c {
-   Bit8u varsize;   // must be 64, 32, 16, or 8
-@@ -914,6 +922,7 @@
+@@ -1040,6 +1046,7 @@
        Bit8u lowbit = 0);
    virtual Bit64s get64 ();
    virtual void set (Bit64s val);
@@ -678,16 +507,16 @@
  };
  
  class BOCHSAPI bx_param_bool_c : public bx_param_num_c {
-@@ -987,7 +996,7 @@
+@@ -1114,7 +1121,7 @@
        char *initial_val,
        int maxsize=-1);
    virtual ~bx_param_string_c ();
 -  void reset ();
 +  virtual void reset ();
    void set_handler (param_string_event_handler handler);
-   Bit32s get (char *buf, int len);
-   char *getptr () {return val; }
-@@ -1013,8 +1022,10 @@
+   void set_enable_handler (param_enable_handler handler);
+   virtual void set_enabled (int enabled);
+@@ -1144,8 +1151,10 @@
        int maxsize=-1);
  };
  
@@ -699,7 +528,7 @@
    // just a list of bx_param_c objects.  size tells current number of
    // objects in the list, and maxsize tells how many list items are
    // allocated in the constructor.
-@@ -1031,8 +1042,7 @@
+@@ -1162,8 +1171,7 @@
    // title of the menu or series
    bx_param_string_c *title;
    // if the menu shows a "return to previous menu" type of choice,
@@ -709,9 +538,9 @@
    void init ();
  public:
    enum {
-@@ -1049,19 +1059,21 @@
-     // of parameters.
-     USE_TAB_WINDOW = (1<<2)
+@@ -1188,19 +1196,21 @@
+     // item (used in the runtime menu).
+     SHOW_GROUP_NAME = (1<<4)
    } bx_listopt_bits;
 -  bx_list_c (bx_id id, int maxsize);
 +  bx_list_c (bx_id id, int maxsize = BX_DEFAULT_LIST_SIZE);
@@ -732,9 +561,9 @@
 -  void set_parent (bx_param_c *newparent) { parent = newparent; }
 +  void set_parent (bx_param_c *newparent);
    bx_param_c *get_parent () { return parent; }
- #if BX_UI_TEXT
+ #if BX_USE_TEXTCONFIG
    virtual void text_print (FILE *);
-@@ -1206,10 +1218,19 @@
+@@ -1404,10 +1414,19 @@
    virtual int register_param (bx_id id, bx_param_c *it) {return -1;}
    virtual void reset_all_param () {}
    virtual bx_param_c *get_param (bx_id id) {return NULL;}
@@ -754,3 +583,131 @@
    virtual int get_n_log_modules () {return -1;}
    virtual char *get_prefix (int mod) {return 0;}
    virtual int get_log_action (int mod, int level) {return -1;}
+diff -urN ../bochs/main.cc ./main.cc
+--- ../bochs/main.cc	2005-07-31 17:35:01.000000000 +0200
++++ ./main.cc	2005-07-31 17:47:06.079350040 +0200
+@@ -176,6 +176,101 @@
+ }
+ #endif
+ 
++void bx_test_params () {
++  printf ("Begin\n");
++
++  // create numeric parameter a
++  bx_param_num_c *ap = new bx_param_num_c (BXP_NULL,
++    "parameter a",
++    "description of a",
++    0,    // minimum value
++    10,   // maximum value
++    1);   // default value
++  printf ("%s is %d\n", ap->get_name(), ap->get ());
++  ap->set(10);
++  printf ("%s is %d\n", ap->get_name(), ap->get ());
++  //ap->set(11);   // causes assert because 11 is out of range
++  printf ("Resetting a to initial value.\n");
++  ap->reset ();
++  printf ("%s is %d\n", ap->get_name(), ap->get ());
++  Bit32u b = 77;
++  bx_param_num_c *bp = new bx_shadow_num_c (BXP_NULL,
++    "shadow parameter b", 
++    "description of b",
++    &b);
++  printf ("%s is %d\n", bp->get_name(), bp->get ());
++  b = 32;
++  printf ("%s is %d\n", bp->get_name(), bp->get ());
++  bp->set (45);
++  printf ("%s is %d\n", bp->get_name(), bp->get ());
++  //printf ("Resetting b to initial value.\n");
++  //bp->reset ();  // not supported on shadow params
++  printf ("%s is %d\n", bp->get_name(), bp->get ());
++  printf ("End\n");
++}
++
++void print_tree (bx_param_c *node, int level)
++{
++  int i;
++  for (i=0; i<level; i++)
++    printf ("  ");
++  if (node == NULL) {
++      printf ("NULL pointer\n");
++      return;
++  }
++  switch (node->get_type()) {
++    case BXT_PARAM_NUM:
++      printf ("%s = %d  (number)\n", node->get_name(), \
((bx_param_num_c*)node)->get()); ++      break;
++    case BXT_PARAM_BOOL:
++      printf ("%s = %s  (boolean)\n", node->get_name(), \
((bx_param_bool_c*)node)->get()?"true":"false"); ++      break;
++    case BXT_PARAM:
++    case BXT_PARAM_ENUM:
++    case BXT_PARAM_STRING:
++      printf ("%s = '%s'  (string)\n", node->get_name(), \
((bx_param_string_c*)node)->getptr()); ++      break;
++    case BXT_LIST:
++      {
++	printf ("%s = \n", node->get_name ());
++	bx_list_c *list = (bx_list_c*)node;
++	for (i=0; i < list->get_size (); i++) {
++	   print_tree (list->get(i), level+1);
++	}
++	break;
++      }
++  }
++}
++
++void test_lookup (const char *pname) 
++{
++  printf ("looking up parameter '%s'\n", pname);
++  bx_param_c *param = SIM->get_param (pname);
++  print_tree (param);
++}
++
++void bx_test_param_tree () {
++  printf ("bx_test_param_tree\n");
++  bx_list_c *top = new bx_list_c (BXP_NULL, 
++      "bochs", "top level object",
++      20);
++  bx_list_c *memory = new bx_list_c (top, "memory", "", 5);
++  bx_list_c *ram = new bx_list_c (memory, "ram", "", 5);
++  new bx_param_num_c (ram, "size", "Size of RAM in megabytes",
++      1, BX_MAX_BIT32U, BX_DEFAULT_MEM_MEGS);
++  bx_list_c *rom = new bx_list_c (memory, "rom", "", 5);
++  new bx_param_num_c (rom, "address", "ROM Address",
++      0, 0xffff, 0xf000);
++  print_tree (top);
++  printf ("Finding memory size: \n");
++  test_lookup (".");
++  test_lookup ("memory.ram.size");
++  test_lookup ("memory.ram");
++  //test_lookup ("memory.ram.");  // illegal
++  //test_lookup ("memory.ram..size");  // illegal
++  printf ("bx_test_param_tree done\n");
++}
++
+ int bxmain () {
+ #ifdef HAVE_LOCALE_H
+   // Initialize locale (for isprint() and other functions)
+@@ -183,6 +278,12 @@
+ #endif
+   bx_user_quit = 0;
+   bx_init_siminterface ();   // create the SIM object
++  //bx_test_params ();
++  //bx_test_param_tree ();
++  //exit(0);
++
++
++
+   static jmp_buf context;
+   if (setjmp (context) == 0) {
+     SIM->set_quit_context (&context);
+@@ -838,7 +939,8 @@
+     BX_ERROR(("No romimage to load. Is your bochsrc file loaded/valid ?"));
+   }
+ 
+-  Bit32u memSize = bx_options.memory.Osize->get ()*1024*1024;
++  bx_param_num_c *bxp_memsize = SIM->get_param_num("memory.ram.megs");
++  Bit32u memSize = bxp_memsize->get() * 1024*1024;
+ 
+ #if BX_SUPPORT_ICACHE
+   pageWriteStampTable.alloc(memSize);



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
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