2 * Copyright (c) 2003 The Regents of The University of Michigan
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.
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.
29 #include "cpu/exec_context.hh"
30 #include "targetarch/vtophys.hh"
31 #include "sim/param.hh"
32 #include "sim/system.hh"
36 vector
<System
*> System::systemList
;
38 int System::numSystemsRunning
= 0;
40 System::System(const std::string _name
,
41 const uint64_t _init_param
,
42 MemoryController
*_memCtrl
,
43 PhysicalMemory
*_physmem
,
46 init_param(_init_param
),
51 // add self to global system list
52 systemList
.push_back(this);
55 nonPath
= new Statistics::MainBin("non TCPIP path stats");
69 System::registerExecContext(ExecContext
*xc
)
71 int myIndex
= execContexts
.size();
72 execContexts
.push_back(xc
);
78 System::replaceExecContext(int xcIndex
, ExecContext
*xc
)
80 if (xcIndex
>= execContexts
.size()) {
81 panic("replaceExecContext: bad xcIndex, %d >= %d\n",
82 xcIndex
, execContexts
.size());
85 execContexts
[xcIndex
] = xc
;
90 System::printSystems()
92 vector
<System
*>::iterator i
= systemList
.begin();
93 vector
<System
*>::iterator end
= systemList
.end();
94 for (; i
!= end
; ++i
) {
96 cerr
<< "System " << sys
->name() << ": " << hex
<< sys
<< endl
;
104 System::printSystems();
108 Statistics::MainBin
*
109 System::getBin(const std::string
&name
)
111 std::map
<const std::string
, Statistics::MainBin
*>::const_iterator i
;
112 i
= fnBins
.find(name
);
113 if (i
== fnBins
.end())
114 panic("trying to getBin that is not on system map!");
119 System::findContext(Addr pcb
)
121 std::map
<Addr
, SWContext
*>::const_iterator iter
;
122 iter
= swCtxMap
.find(pcb
);
123 if (iter
!= swCtxMap
.end()) {
124 SWContext
*ctx
= (*iter
).second
;
125 assert(ctx
!= NULL
&& "should never have a null ctx in ctxMap");
132 DEFINE_SIM_OBJECT_CLASS_NAME("System", System
)