system.cc (3812:eaa215123a26) system.cc (3960:1dca397b2bab)
1/*
2 * Copyright (c) 2003-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;

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

27 *
28 * Authors: Steve Reinhardt
29 * Lisa Hsu
30 * Nathan Binkert
31 * Ali Saidi
32 */
33
34#include "arch/isa_traits.hh"
1/*
2 * Copyright (c) 2003-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;

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

27 *
28 * Authors: Steve Reinhardt
29 * Lisa Hsu
30 * Nathan Binkert
31 * Ali Saidi
32 */
33
34#include "arch/isa_traits.hh"
35#include "arch/remote_gdb.hh"
35#include "base/loader/object_file.hh"
36#include "base/loader/symtab.hh"
37#include "base/trace.hh"
38#include "cpu/thread_context.hh"
39#include "mem/mem_object.hh"
40#include "mem/physical.hh"
41#include "sim/builder.hh"
42#include "sim/byteswap.hh"
43#include "sim/system.hh"
44#if FULL_SYSTEM
45#include "arch/vtophys.hh"
36#include "base/loader/object_file.hh"
37#include "base/loader/symtab.hh"
38#include "base/trace.hh"
39#include "cpu/thread_context.hh"
40#include "mem/mem_object.hh"
41#include "mem/physical.hh"
42#include "sim/builder.hh"
43#include "sim/byteswap.hh"
44#include "sim/system.hh"
45#if FULL_SYSTEM
46#include "arch/vtophys.hh"
46#include "arch/remote_gdb.hh"
47#include "kern/kernel_stats.hh"
48#endif
49
50using namespace std;
51using namespace TheISA;
52
53vector<System *> System::systemList;
54

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

136 delete kernelSymtab;
137 delete kernel;
138#else
139 panic("System::fixFuncEventAddr needs to be rewritten "
140 "to work with syscall emulation");
141#endif // FULL_SYSTEM}
142}
143
47#include "kern/kernel_stats.hh"
48#endif
49
50using namespace std;
51using namespace TheISA;
52
53vector<System *> System::systemList;
54

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

136 delete kernelSymtab;
137 delete kernel;
138#else
139 panic("System::fixFuncEventAddr needs to be rewritten "
140 "to work with syscall emulation");
141#endif // FULL_SYSTEM}
142}
143
144#if FULL_SYSTEM
145
146
147int rgdb_wait = -1;
148
144int rgdb_wait = -1;
145
149#endif // FULL_SYSTEM
150
151
152void
153System::setMemoryMode(MemoryMode mode)
154{
155 assert(getState() == Drained);
156 memoryMode = mode;
157}
158
146void
147System::setMemoryMode(MemoryMode mode)
148{
149 assert(getState() == Drained);
150 memoryMode = mode;
151}
152
153bool System::breakpoint()
154{
155 return remoteGDB[0]->breakpoint();
156}
157
159int
160System::registerThreadContext(ThreadContext *tc, int id)
161{
162 if (id == -1) {
163 for (id = 0; id < threadContexts.size(); id++) {
164 if (!threadContexts[id])
165 break;
166 }
167 }
168
169 if (threadContexts.size() <= id)
170 threadContexts.resize(id + 1);
171
172 if (threadContexts[id])
173 panic("Cannot have two CPUs with the same id (%d)\n", id);
174
175 threadContexts[id] = tc;
176 numcpus++;
177
158int
159System::registerThreadContext(ThreadContext *tc, int id)
160{
161 if (id == -1) {
162 for (id = 0; id < threadContexts.size(); id++) {
163 if (!threadContexts[id])
164 break;
165 }
166 }
167
168 if (threadContexts.size() <= id)
169 threadContexts.resize(id + 1);
170
171 if (threadContexts[id])
172 panic("Cannot have two CPUs with the same id (%d)\n", id);
173
174 threadContexts[id] = tc;
175 numcpus++;
176
178#if FULL_SYSTEM
179 RemoteGDB *rgdb = new RemoteGDB(this, tc);
180 GDBListener *gdbl = new GDBListener(rgdb, 7000 + id);
181 gdbl->listen();
182 /**
183 * Uncommenting this line waits for a remote debugger to connect
184 * to the simulator before continuing.
185 */
186 if (rgdb_wait != -1 && rgdb_wait == id)
187 gdbl->accept();
188
189 if (remoteGDB.size() <= id) {
190 remoteGDB.resize(id + 1);
191 }
192
193 remoteGDB[id] = rgdb;
177 RemoteGDB *rgdb = new RemoteGDB(this, tc);
178 GDBListener *gdbl = new GDBListener(rgdb, 7000 + id);
179 gdbl->listen();
180 /**
181 * Uncommenting this line waits for a remote debugger to connect
182 * to the simulator before continuing.
183 */
184 if (rgdb_wait != -1 && rgdb_wait == id)
185 gdbl->accept();
186
187 if (remoteGDB.size() <= id) {
188 remoteGDB.resize(id + 1);
189 }
190
191 remoteGDB[id] = rgdb;
194#endif // FULL_SYSTEM
195
196 return id;
197}
198
199void
200System::startup()
201{
202 int i;

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

208System::replaceThreadContext(ThreadContext *tc, int id)
209{
210 if (id >= threadContexts.size()) {
211 panic("replaceThreadContext: bad id, %d >= %d\n",
212 id, threadContexts.size());
213 }
214
215 threadContexts[id] = tc;
192
193 return id;
194}
195
196void
197System::startup()
198{
199 int i;

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

205System::replaceThreadContext(ThreadContext *tc, int id)
206{
207 if (id >= threadContexts.size()) {
208 panic("replaceThreadContext: bad id, %d >= %d\n",
209 id, threadContexts.size());
210 }
211
212 threadContexts[id] = tc;
216#if FULL_SYSTEM
217 remoteGDB[id]->replaceThreadContext(tc);
213 remoteGDB[id]->replaceThreadContext(tc);
218#endif // FULL_SYSTEM
219}
220
221#if !FULL_SYSTEM
222Addr
223System::new_page()
224{
225 Addr return_addr = page_ptr << LogVMPageSize;
226 ++page_ptr;

--- 79 unchanged lines hidden ---
214}
215
216#if !FULL_SYSTEM
217Addr
218System::new_page()
219{
220 Addr return_addr = page_ptr << LogVMPageSize;
221 ++page_ptr;

--- 79 unchanged lines hidden ---