SGI_IP32_Machine.cc Source File

Back to the index.

SGI_IP32_Machine.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009-2010 Anders Gavare. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. The name of the author may not be used to endorse or promote products
13  * derived from this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  */
27 
29 #include "ComponentFactory.h"
30 #include "GXemul.h"
31 
32 
34 {
35  // Defaults:
37  settings["cpu"] = "R5000"; // R5000, RM7000, R10000, R12000
38  settings["ram"] = "0x8000000";
39 
40  if (!ComponentFactory::GetCreationArgOverrides(settings, args))
41  return NULL;
42 
45  if (machine.IsNULL())
46  return NULL;
47 
48  machine->SetVariableValue("template", "\"sgi_ip32\"");
49 
50  refcount_ptr<Component> mainbus =
52  if (mainbus.IsNULL())
53  return NULL;
54 
55  machine->AddChild(mainbus);
56 
58  if (ram.IsNULL())
59  return NULL;
60 
61  ram->SetVariableValue("memoryMappedBase", "0");
62  ram->SetVariableValue("memoryMappedSize", settings["ram"]);
63  mainbus->AddChild(ram);
64 
66  if (prom.IsNULL())
67  return NULL;
68 
69  prom->SetVariableValue("name", "\"prom0\"");
70  prom->SetVariableValue("memoryMappedBase", "0x1fc00000");
71  prom->SetVariableValue("memoryMappedSize", "0x80000");
72  // The prom (or at least part of it) is flashable/writeable.
73  mainbus->AddChild(prom);
74 
76  "mips_cpu(model=" + settings["cpu"] + ")");
77  if (cpu.IsNULL())
78  return NULL;
79 
80  mainbus->AddChild(cpu);
81 
82  return machine;
83 }
84 
85 
86 string SGI_IP32_Machine::GetAttribute(const string& attributeName)
87 {
88  if (attributeName == "template")
89  return "yes";
90 
91  if (attributeName == "machine")
92  return "yes";
93 
94  // if (attributeName == "stable")
95  // return "yes";
96 
97  if (attributeName == "comments")
98  return "For experiments with <a href=\"http://www.netbsd.org/ports/sgimips/\">NetBSD/sgimips</a>,"
99  " <a href=\"http://www.openbsd.org/sgi.html\">OpenBSD/sgi</a>, "
100  "Linux for O2, and possibly also <a href=\"http://en.wikipedia.org/wiki/SGI_O2\">SGI O2</a> PROMs and/or"
101  " <a href=\"http://en.wikipedia.org/wiki/IRIX\">IRIX</a> in the future.";
102 
103  if (attributeName == "description")
104  return "SGI IP32 (O2) machine.";
105 
106  return "";
107 }
108 
static refcount_ptr< Component > CreateComponent(const string &componentNameAndOptionalArgs, GXemul *gxemul=NULL)
Creates a component given a short component name.
map< string, string > ComponentCreationSettings
Definition: Component.h:46
static refcount_ptr< Component > Create(const ComponentCreateArgs &args)
Creates a "sgi_ip32" Component tree.
Definition: cpu.h:326
bool SetVariableValue(const string &name, const string &expression)
Sets a variable to a new value.
Definition: Component.cc:1030
void AddChild(refcount_ptr< Component > childComponent, size_t insertPosition=(size_t) -1)
Adds a reference to a child component.
Definition: Component.cc:595
static bool GetCreationArgOverrides(ComponentCreationSettings &settings, const ComponentCreateArgs &createArgs)
Get override arguments for component creation.
static string GetAttribute(const string &attributeName)
Gets a Component attribute value.
bool IsNULL() const
Checks whether or not an object is referenced by the reference counted pointer.
Definition: refcount_ptr.h:216

Generated on Fri Dec 7 2018 19:52:23 for GXemul by doxygen 1.8.13