system.cc (2640:266b80dd5eca) system.cc (2680:246e7104f744)
1#include "arch/isa_traits.hh"
2#include "base/loader/object_file.hh"
3#include "base/loader/symtab.hh"
4#include "base/trace.hh"
1#include "arch/isa_traits.hh"
2#include "base/loader/object_file.hh"
3#include "base/loader/symtab.hh"
4#include "base/trace.hh"
5#include "cpu/exec_context.hh"
5#include "cpu/thread_context.hh"
6#include "mem/mem_object.hh"
7#include "mem/physical.hh"
8#include "sim/builder.hh"
9#include "sim/byteswap.hh"
10#include "sim/system.hh"
11#if FULL_SYSTEM
12#include "arch/vtophys.hh"
13#include "base/remote_gdb.hh"

--- 96 unchanged lines hidden (view full) ---

110#if FULL_SYSTEM
111
112
113int rgdb_wait = -1;
114
115#endif // FULL_SYSTEM
116
117int
6#include "mem/mem_object.hh"
7#include "mem/physical.hh"
8#include "sim/builder.hh"
9#include "sim/byteswap.hh"
10#include "sim/system.hh"
11#if FULL_SYSTEM
12#include "arch/vtophys.hh"
13#include "base/remote_gdb.hh"

--- 96 unchanged lines hidden (view full) ---

110#if FULL_SYSTEM
111
112
113int rgdb_wait = -1;
114
115#endif // FULL_SYSTEM
116
117int
118System::registerExecContext(ExecContext *xc, int id)
118System::registerThreadContext(ThreadContext *tc, int id)
119{
120 if (id == -1) {
119{
120 if (id == -1) {
121 for (id = 0; id < execContexts.size(); id++) {
122 if (!execContexts[id])
121 for (id = 0; id < threadContexts.size(); id++) {
122 if (!threadContexts[id])
123 break;
124 }
125 }
126
123 break;
124 }
125 }
126
127 if (execContexts.size() <= id)
128 execContexts.resize(id + 1);
127 if (threadContexts.size() <= id)
128 threadContexts.resize(id + 1);
129
129
130 if (execContexts[id])
130 if (threadContexts[id])
131 panic("Cannot have two CPUs with the same id (%d)\n", id);
132
131 panic("Cannot have two CPUs with the same id (%d)\n", id);
132
133 execContexts[id] = xc;
133 threadContexts[id] = tc;
134 numcpus++;
135
136#if FULL_SYSTEM
134 numcpus++;
135
136#if FULL_SYSTEM
137 RemoteGDB *rgdb = new RemoteGDB(this, xc);
137 RemoteGDB *rgdb = new RemoteGDB(this, tc);
138 GDBListener *gdbl = new GDBListener(rgdb, 7000 + id);
139 gdbl->listen();
140 /**
141 * Uncommenting this line waits for a remote debugger to connect
142 * to the simulator before continuing.
143 */
144 if (rgdb_wait != -1 && rgdb_wait == id)
145 gdbl->accept();

--- 7 unchanged lines hidden (view full) ---

153
154 return id;
155}
156
157void
158System::startup()
159{
160 int i;
138 GDBListener *gdbl = new GDBListener(rgdb, 7000 + id);
139 gdbl->listen();
140 /**
141 * Uncommenting this line waits for a remote debugger to connect
142 * to the simulator before continuing.
143 */
144 if (rgdb_wait != -1 && rgdb_wait == id)
145 gdbl->accept();

--- 7 unchanged lines hidden (view full) ---

153
154 return id;
155}
156
157void
158System::startup()
159{
160 int i;
161 for (i = 0; i < execContexts.size(); i++)
162 execContexts[i]->activate(0);
161 for (i = 0; i < threadContexts.size(); i++)
162 threadContexts[i]->activate(0);
163}
164
165void
163}
164
165void
166System::replaceExecContext(ExecContext *xc, int id)
166System::replaceThreadContext(ThreadContext *tc, int id)
167{
167{
168 if (id >= execContexts.size()) {
169 panic("replaceExecContext: bad id, %d >= %d\n",
170 id, execContexts.size());
168 if (id >= threadContexts.size()) {
169 panic("replaceThreadContext: bad id, %d >= %d\n",
170 id, threadContexts.size());
171 }
172
171 }
172
173 execContexts[id] = xc;
173 threadContexts[id] = tc;
174#if FULL_SYSTEM
174#if FULL_SYSTEM
175 remoteGDB[id]->replaceExecContext(xc);
175 remoteGDB[id]->replaceThreadContext(tc);
176#endif // FULL_SYSTEM
177}
178
179#if !FULL_SYSTEM
180Addr
181System::new_page()
182{
183 Addr return_addr = page_ptr << LogVMPageSize;

--- 84 unchanged lines hidden ---
176#endif // FULL_SYSTEM
177}
178
179#if !FULL_SYSTEM
180Addr
181System::new_page()
182{
183 Addr return_addr = page_ptr << LogVMPageSize;

--- 84 unchanged lines hidden ---