gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
system.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2006 The Regents of The University of Michigan
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * 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  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * Authors: Ali Saidi
29  */
30 
31 #include "arch/sparc/system.hh"
32 
33 #include "arch/vtophys.hh"
35 #include "base/loader/symtab.hh"
36 #include "base/trace.hh"
37 #include "mem/physical.hh"
38 #include "params/SparcSystem.hh"
39 #include "sim/byteswap.hh"
40 
41 using namespace BigEndianGuest;
42 
44  : System(p), sysTick(0)
45 {
52 
56  // Read the reset binary
57  reset = createObjectFile(params()->reset_bin, true);
58  if (reset == NULL)
59  fatal("Could not load reset binary %s", params()->reset_bin);
60 
61  // Read the openboot binary
62  openboot = createObjectFile(params()->openboot_bin, true);
63  if (openboot == NULL)
64  fatal("Could not load openboot bianry %s", params()->openboot_bin);
65 
66  // Read the hypervisor binary
67  hypervisor = createObjectFile(params()->hypervisor_bin, true);
68  if (hypervisor == NULL)
69  fatal("Could not load hypervisor binary %s", params()->hypervisor_bin);
70 
71  // Read the nvram image
72  nvram = createObjectFile(params()->nvram_bin, true);
73  if (nvram == NULL)
74  fatal("Could not load nvram image %s", params()->nvram_bin);
75 
76  // Read the hypervisor description image
77  hypervisor_desc = createObjectFile(params()->hypervisor_desc_bin, true);
78  if (hypervisor_desc == NULL)
79  fatal("Could not load hypervisor description image %s",
80  params()->hypervisor_desc_bin);
81 
82  // Read the partition description image
83  partition_desc = createObjectFile(params()->partition_desc_bin, true);
84  if (partition_desc == NULL)
85  fatal("Could not load partition description image %s",
86  params()->partition_desc_bin);
87 
88  // load symbols
90  panic("could not load reset symbols\n");
91 
93  panic("could not load openboot symbols\n");
94 
96  panic("could not load hypervisor symbols\n");
97 
99  panic("could not load nvram symbols\n");
100 
102  panic("could not load hypervisor description symbols\n");
103 
105  panic("could not load partition description symbols\n");
106 
107  // load symbols into debug table
109  panic("could not load reset symbols\n");
110 
112  panic("could not load openboot symbols\n");
113 
115  panic("could not load hypervisor symbols\n");
116 
117  // Strip off the rom address so when the hypervisor is copied into memory we
118  // have symbols still
119  if (!hypervisor->loadLocalSymbols(debugSymbolTable, 0, 0, 0xFFFFFF))
120  panic("could not load hypervisor symbols\n");
121 
123  panic("could not load reset symbols\n");
124 
126  panic("could not load hypervisor description symbols\n");
127 
129  panic("could not load partition description symbols\n");
130 
131 }
132 
133 void
135 {
136  // Call the initialisation of the super class
138 
139  // Load reset binary into memory
140  reset->setTextBase(params()->reset_addr);
142  // Load the openboot binary
143  openboot->setTextBase(params()->openboot_addr);
145  // Load the hypervisor binary
146  hypervisor->setTextBase(params()->hypervisor_addr);
148  // Load the nvram image
149  nvram->setTextBase(params()->nvram_addr);
151  // Load the hypervisor description image
152  hypervisor_desc->setTextBase(params()->hypervisor_desc_addr);
154  // Load the partition description image
155  partition_desc->setTextBase(params()->partition_desc_addr);
157 
158 
159  // @todo any fixup code over writing data in binaries on setting break
160  // events on functions should happen here.
161 
162 }
163 
165 {
166  delete resetSymtab;
167  delete hypervisorSymtab;
168  delete openbootSymtab;
169  delete nvramSymtab;
170  delete hypervisorDescSymtab;
171  delete partitionDescSymtab;
172  delete reset;
173  delete openboot;
174  delete hypervisor;
175  delete nvram;
176  delete hypervisor_desc;
177  delete partition_desc;
178 }
179 
180 void
182 {
183  resetSymtab->serialize("reset_symtab", cp);
184  hypervisorSymtab->serialize("hypervisor_symtab", cp);
185  openbootSymtab->serialize("openboot_symtab", cp);
186  nvramSymtab->serialize("nvram_symtab", cp);
187  hypervisorDescSymtab->serialize("hypervisor_desc_symtab", cp);
188  partitionDescSymtab->serialize("partition_desc_symtab", cp);
189 }
190 
191 
192 void
194 {
195  resetSymtab->unserialize("reset_symtab", cp);
196  hypervisorSymtab->unserialize("hypervisor_symtab", cp);
197  openbootSymtab->unserialize("openboot_symtab", cp);
198  nvramSymtab->unserialize("nvram_symtab", cp);
199  hypervisorDescSymtab->unserialize("hypervisor_desc_symtab", cp);
200  partitionDescSymtab->unserialize("partition_desc_symtab", cp);
201 }
202 
203 SparcSystem *
204 SparcSystemParams::create()
205 {
206  return new SparcSystem(this);
207 }
SymbolTable * partitionDescSymtab
partition desc symbol table?
Definition: system.hh:76
#define panic(...)
Definition: misc.hh:153
virtual bool loadGlobalSymbols(SymbolTable *symtab, Addr base=0, Addr offset=0, Addr mask=maxAddr)=0
SymbolTable * hypervisorDescSymtab
hypervisor desc symbol table?
Definition: system.hh:73
ObjectFile * hypervisor
Object pointer for the hypervisor code.
Definition: system.hh:82
SymbolTable * openbootSymtab
openboot symbol table
Definition: system.hh:67
SymbolTable * debugSymbolTable
Global unified debugging symbol table (for target).
Definition: symtab.cc:45
Definition: system.hh:83
void unserializeSymtab(CheckpointIn &cp) override
If needed, unserialize additional symbol table entries for a specific subclass of this system...
Definition: system.cc:193
const Params * params() const
Definition: system.hh:100
virtual bool loadLocalSymbols(SymbolTable *symtab, Addr base=0, Addr offset=0, Addr mask=maxAddr)=0
SparcSystem(Params *p)
Definition: system.cc:43
PortProxy physProxy
Port to physical memory used for writing object files into ram at boot.
Definition: system.hh:224
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: system.cc:289
SymbolTable * hypervisorSymtab
hypervison binary symbol table
Definition: system.hh:64
void serialize(const std::string &base, CheckpointOut &cp) const
Definition: symtab.cc:113
~SparcSystem()
Definition: system.cc:164
#define fatal(...)
Definition: misc.hh:163
SymbolTable * resetSymtab
reset binary symbol table
Definition: system.hh:61
ObjectFile * reset
Object pointer for the reset binary.
Definition: system.hh:79
virtual bool loadSections(PortProxy &mem_proxy, Addr mask=maxAddr, Addr offset=0)
Definition: object_file.cc:93
SparcSystemParams Params
Definition: system.hh:47
SymbolTable * nvramSymtab
nvram symbol table?
Definition: system.hh:70
std::ostream CheckpointOut
Definition: serialize.hh:67
ObjectFile * createObjectFile(const string &fname, bool raw)
Definition: object_file.cc:157
ObjectFile * nvram
Object pointer for the nvram image.
Definition: system.hh:88
void unserialize(const std::string &base, CheckpointIn &cp)
Definition: symtab.cc:127
ObjectFile * partition_desc
Object pointer for the partition description image.
Definition: system.hh:94
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: system.cc:134
void setTextBase(Addr a)
Definition: object_file.hh:151
void serializeSymtab(CheckpointOut &cp) const override
Serialization stuff.
Definition: system.cc:181
ObjectFile * openboot
Object pointer for the openboot code.
Definition: system.hh:85
Bitfield< 0 > p
ObjectFile * hypervisor_desc
Object pointer for the hypervisor description image.
Definition: system.hh:91

Generated on Fri Jun 9 2017 13:03:34 for gem5 by doxygen 1.8.6