system.cc (9292:e57c7d9736a5) system.cc (10905:a6ca6831e775)
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#include "arch/vtophys.hh"
33#include "base/loader/object_file.hh"
34#include "base/loader/symtab.hh"
35#include "base/trace.hh"
36#include "mem/physical.hh"
37#include "params/SparcSystem.hh"
38#include "sim/byteswap.hh"
39
40using namespace BigEndianGuest;
41
42SparcSystem::SparcSystem(Params *p)
43 : System(p), sysTick(0)
44{
45 resetSymtab = new SymbolTable;
46 hypervisorSymtab = new SymbolTable;
47 openbootSymtab = new SymbolTable;
48 nvramSymtab = new SymbolTable;
49 hypervisorDescSymtab = new SymbolTable;
50 partitionDescSymtab = new SymbolTable;
51
52 /**
53 * Load the boot code, and hypervisor into memory.
54 */
55 // Read the reset binary
56 reset = createObjectFile(params()->reset_bin, true);
57 if (reset == NULL)
58 fatal("Could not load reset binary %s", params()->reset_bin);
59
60 // Read the openboot binary
61 openboot = createObjectFile(params()->openboot_bin, true);
62 if (openboot == NULL)
63 fatal("Could not load openboot bianry %s", params()->openboot_bin);
64
65 // Read the hypervisor binary
66 hypervisor = createObjectFile(params()->hypervisor_bin, true);
67 if (hypervisor == NULL)
68 fatal("Could not load hypervisor binary %s", params()->hypervisor_bin);
69
70 // Read the nvram image
71 nvram = createObjectFile(params()->nvram_bin, true);
72 if (nvram == NULL)
73 fatal("Could not load nvram image %s", params()->nvram_bin);
74
75 // Read the hypervisor description image
76 hypervisor_desc = createObjectFile(params()->hypervisor_desc_bin, true);
77 if (hypervisor_desc == NULL)
78 fatal("Could not load hypervisor description image %s",
79 params()->hypervisor_desc_bin);
80
81 // Read the partition description image
82 partition_desc = createObjectFile(params()->partition_desc_bin, true);
83 if (partition_desc == NULL)
84 fatal("Could not load partition description image %s",
85 params()->partition_desc_bin);
86
87 // load symbols
88 if (!reset->loadGlobalSymbols(resetSymtab))
89 panic("could not load reset symbols\n");
90
91 if (!openboot->loadGlobalSymbols(openbootSymtab))
92 panic("could not load openboot symbols\n");
93
94 if (!hypervisor->loadLocalSymbols(hypervisorSymtab))
95 panic("could not load hypervisor symbols\n");
96
97 if (!nvram->loadLocalSymbols(nvramSymtab))
98 panic("could not load nvram symbols\n");
99
100 if (!hypervisor_desc->loadLocalSymbols(hypervisorDescSymtab))
101 panic("could not load hypervisor description symbols\n");
102
103 if (!partition_desc->loadLocalSymbols(partitionDescSymtab))
104 panic("could not load partition description symbols\n");
105
106 // load symbols into debug table
107 if (!reset->loadGlobalSymbols(debugSymbolTable))
108 panic("could not load reset symbols\n");
109
110 if (!openboot->loadGlobalSymbols(debugSymbolTable))
111 panic("could not load openboot symbols\n");
112
113 if (!hypervisor->loadLocalSymbols(debugSymbolTable))
114 panic("could not load hypervisor symbols\n");
115
116 // Strip off the rom address so when the hypervisor is copied into memory we
117 // have symbols still
118 if (!hypervisor->loadLocalSymbols(debugSymbolTable, 0xFFFFFF))
119 panic("could not load hypervisor symbols\n");
120
121 if (!nvram->loadGlobalSymbols(debugSymbolTable))
122 panic("could not load reset symbols\n");
123
124 if (!hypervisor_desc->loadGlobalSymbols(debugSymbolTable))
125 panic("could not load hypervisor description symbols\n");
126
127 if (!partition_desc->loadLocalSymbols(debugSymbolTable))
128 panic("could not load partition description symbols\n");
129
130}
131
132void
133SparcSystem::initState()
134{
135 // Call the initialisation of the super class
136 System::initState();
137
138 // Load reset binary into memory
139 reset->setTextBase(params()->reset_addr);
140 reset->loadSections(physProxy);
141 // Load the openboot binary
142 openboot->setTextBase(params()->openboot_addr);
143 openboot->loadSections(physProxy);
144 // Load the hypervisor binary
145 hypervisor->setTextBase(params()->hypervisor_addr);
146 hypervisor->loadSections(physProxy);
147 // Load the nvram image
148 nvram->setTextBase(params()->nvram_addr);
149 nvram->loadSections(physProxy);
150 // Load the hypervisor description image
151 hypervisor_desc->setTextBase(params()->hypervisor_desc_addr);
152 hypervisor_desc->loadSections(physProxy);
153 // Load the partition description image
154 partition_desc->setTextBase(params()->partition_desc_addr);
155 partition_desc->loadSections(physProxy);
156
157
158 // @todo any fixup code over writing data in binaries on setting break
159 // events on functions should happen here.
160
161}
162
163SparcSystem::~SparcSystem()
164{
165 delete resetSymtab;
166 delete hypervisorSymtab;
167 delete openbootSymtab;
168 delete nvramSymtab;
169 delete hypervisorDescSymtab;
170 delete partitionDescSymtab;
171 delete reset;
172 delete openboot;
173 delete hypervisor;
174 delete nvram;
175 delete hypervisor_desc;
176 delete partition_desc;
177}
178
179void
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#include "arch/vtophys.hh"
33#include "base/loader/object_file.hh"
34#include "base/loader/symtab.hh"
35#include "base/trace.hh"
36#include "mem/physical.hh"
37#include "params/SparcSystem.hh"
38#include "sim/byteswap.hh"
39
40using namespace BigEndianGuest;
41
42SparcSystem::SparcSystem(Params *p)
43 : System(p), sysTick(0)
44{
45 resetSymtab = new SymbolTable;
46 hypervisorSymtab = new SymbolTable;
47 openbootSymtab = new SymbolTable;
48 nvramSymtab = new SymbolTable;
49 hypervisorDescSymtab = new SymbolTable;
50 partitionDescSymtab = new SymbolTable;
51
52 /**
53 * Load the boot code, and hypervisor into memory.
54 */
55 // Read the reset binary
56 reset = createObjectFile(params()->reset_bin, true);
57 if (reset == NULL)
58 fatal("Could not load reset binary %s", params()->reset_bin);
59
60 // Read the openboot binary
61 openboot = createObjectFile(params()->openboot_bin, true);
62 if (openboot == NULL)
63 fatal("Could not load openboot bianry %s", params()->openboot_bin);
64
65 // Read the hypervisor binary
66 hypervisor = createObjectFile(params()->hypervisor_bin, true);
67 if (hypervisor == NULL)
68 fatal("Could not load hypervisor binary %s", params()->hypervisor_bin);
69
70 // Read the nvram image
71 nvram = createObjectFile(params()->nvram_bin, true);
72 if (nvram == NULL)
73 fatal("Could not load nvram image %s", params()->nvram_bin);
74
75 // Read the hypervisor description image
76 hypervisor_desc = createObjectFile(params()->hypervisor_desc_bin, true);
77 if (hypervisor_desc == NULL)
78 fatal("Could not load hypervisor description image %s",
79 params()->hypervisor_desc_bin);
80
81 // Read the partition description image
82 partition_desc = createObjectFile(params()->partition_desc_bin, true);
83 if (partition_desc == NULL)
84 fatal("Could not load partition description image %s",
85 params()->partition_desc_bin);
86
87 // load symbols
88 if (!reset->loadGlobalSymbols(resetSymtab))
89 panic("could not load reset symbols\n");
90
91 if (!openboot->loadGlobalSymbols(openbootSymtab))
92 panic("could not load openboot symbols\n");
93
94 if (!hypervisor->loadLocalSymbols(hypervisorSymtab))
95 panic("could not load hypervisor symbols\n");
96
97 if (!nvram->loadLocalSymbols(nvramSymtab))
98 panic("could not load nvram symbols\n");
99
100 if (!hypervisor_desc->loadLocalSymbols(hypervisorDescSymtab))
101 panic("could not load hypervisor description symbols\n");
102
103 if (!partition_desc->loadLocalSymbols(partitionDescSymtab))
104 panic("could not load partition description symbols\n");
105
106 // load symbols into debug table
107 if (!reset->loadGlobalSymbols(debugSymbolTable))
108 panic("could not load reset symbols\n");
109
110 if (!openboot->loadGlobalSymbols(debugSymbolTable))
111 panic("could not load openboot symbols\n");
112
113 if (!hypervisor->loadLocalSymbols(debugSymbolTable))
114 panic("could not load hypervisor symbols\n");
115
116 // Strip off the rom address so when the hypervisor is copied into memory we
117 // have symbols still
118 if (!hypervisor->loadLocalSymbols(debugSymbolTable, 0xFFFFFF))
119 panic("could not load hypervisor symbols\n");
120
121 if (!nvram->loadGlobalSymbols(debugSymbolTable))
122 panic("could not load reset symbols\n");
123
124 if (!hypervisor_desc->loadGlobalSymbols(debugSymbolTable))
125 panic("could not load hypervisor description symbols\n");
126
127 if (!partition_desc->loadLocalSymbols(debugSymbolTable))
128 panic("could not load partition description symbols\n");
129
130}
131
132void
133SparcSystem::initState()
134{
135 // Call the initialisation of the super class
136 System::initState();
137
138 // Load reset binary into memory
139 reset->setTextBase(params()->reset_addr);
140 reset->loadSections(physProxy);
141 // Load the openboot binary
142 openboot->setTextBase(params()->openboot_addr);
143 openboot->loadSections(physProxy);
144 // Load the hypervisor binary
145 hypervisor->setTextBase(params()->hypervisor_addr);
146 hypervisor->loadSections(physProxy);
147 // Load the nvram image
148 nvram->setTextBase(params()->nvram_addr);
149 nvram->loadSections(physProxy);
150 // Load the hypervisor description image
151 hypervisor_desc->setTextBase(params()->hypervisor_desc_addr);
152 hypervisor_desc->loadSections(physProxy);
153 // Load the partition description image
154 partition_desc->setTextBase(params()->partition_desc_addr);
155 partition_desc->loadSections(physProxy);
156
157
158 // @todo any fixup code over writing data in binaries on setting break
159 // events on functions should happen here.
160
161}
162
163SparcSystem::~SparcSystem()
164{
165 delete resetSymtab;
166 delete hypervisorSymtab;
167 delete openbootSymtab;
168 delete nvramSymtab;
169 delete hypervisorDescSymtab;
170 delete partitionDescSymtab;
171 delete reset;
172 delete openboot;
173 delete hypervisor;
174 delete nvram;
175 delete hypervisor_desc;
176 delete partition_desc;
177}
178
179void
180SparcSystem::serializeSymtab(std::ostream &os)
180SparcSystem::serializeSymtab(CheckpointOut &cp) const
181{
181{
182 resetSymtab->serialize("reset_symtab", os);
183 hypervisorSymtab->serialize("hypervisor_symtab", os);
184 openbootSymtab->serialize("openboot_symtab", os);
185 nvramSymtab->serialize("nvram_symtab", os);
186 hypervisorDescSymtab->serialize("hypervisor_desc_symtab", os);
187 partitionDescSymtab->serialize("partition_desc_symtab", os);
182 resetSymtab->serialize("reset_symtab", cp);
183 hypervisorSymtab->serialize("hypervisor_symtab", cp);
184 openbootSymtab->serialize("openboot_symtab", cp);
185 nvramSymtab->serialize("nvram_symtab", cp);
186 hypervisorDescSymtab->serialize("hypervisor_desc_symtab", cp);
187 partitionDescSymtab->serialize("partition_desc_symtab", cp);
188}
189
190
191void
188}
189
190
191void
192SparcSystem::unserializeSymtab(Checkpoint *cp, const std::string &section)
192SparcSystem::unserializeSymtab(CheckpointIn &cp)
193{
193{
194 resetSymtab->unserialize("reset_symtab", cp, section);
195 hypervisorSymtab->unserialize("hypervisor_symtab", cp, section);
196 openbootSymtab->unserialize("openboot_symtab", cp, section);
197 nvramSymtab->unserialize("nvram_symtab", cp, section);
198 hypervisorDescSymtab->unserialize("hypervisor_desc_symtab", cp, section);
199 partitionDescSymtab->unserialize("partition_desc_symtab", cp, section);
194 resetSymtab->unserialize("reset_symtab", cp);
195 hypervisorSymtab->unserialize("hypervisor_symtab", cp);
196 openbootSymtab->unserialize("openboot_symtab", cp);
197 nvramSymtab->unserialize("nvram_symtab", cp);
198 hypervisorDescSymtab->unserialize("hypervisor_desc_symtab", cp);
199 partitionDescSymtab->unserialize("partition_desc_symtab", cp);
200}
201
202SparcSystem *
203SparcSystemParams::create()
204{
205 return new SparcSystem(this);
206}
200}
201
202SparcSystem *
203SparcSystemParams::create()
204{
205 return new SparcSystem(this);
206}