system.cc (8601:af28085882dc) system.cc (8666:97d873b8b13e)
1/*
1/*
2 * Copyright (c) 2011 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
2 * Copyright (c) 2003-2006 The Regents of The University of Michigan
3 * Copyright (c) 2011 Regents of the University of California
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer;

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

38#include "arch/utility.hh"
39#include "base/loader/object_file.hh"
40#include "base/loader/symtab.hh"
41#include "base/trace.hh"
42#include "config/full_system.hh"
43#include "config/the_isa.hh"
44#include "cpu/thread_context.hh"
45#include "debug/Loader.hh"
14 * Copyright (c) 2003-2006 The Regents of The University of Michigan
15 * Copyright (c) 2011 Regents of the University of California
16 * All rights reserved.
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions are
20 * met: redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer;

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

50#include "arch/utility.hh"
51#include "base/loader/object_file.hh"
52#include "base/loader/symtab.hh"
53#include "base/trace.hh"
54#include "config/full_system.hh"
55#include "config/the_isa.hh"
56#include "cpu/thread_context.hh"
57#include "debug/Loader.hh"
58#include "debug/WorkItems.hh"
46#include "mem/mem_object.hh"
47#include "mem/physical.hh"
48#include "sim/byteswap.hh"
49#include "sim/debug.hh"
50#include "sim/system.hh"
51
52#if FULL_SYSTEM
53#include "arch/vtophys.hh"

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

71 loadAddrMask(p->load_addr_mask),
72#else
73 pagePtr(0),
74 nextPID(0),
75#endif
76 memoryMode(p->mem_mode),
77 workItemsBegin(0),
78 workItemsEnd(0),
59#include "mem/mem_object.hh"
60#include "mem/physical.hh"
61#include "sim/byteswap.hh"
62#include "sim/debug.hh"
63#include "sim/system.hh"
64
65#if FULL_SYSTEM
66#include "arch/vtophys.hh"

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

84 loadAddrMask(p->load_addr_mask),
85#else
86 pagePtr(0),
87 nextPID(0),
88#endif
89 memoryMode(p->mem_mode),
90 workItemsBegin(0),
91 workItemsEnd(0),
92 numWorkIds(p->num_work_ids),
79 _params(p),
93 _params(p),
80 totalNumInsts(0),
94 totalNumInsts(0),
81 instEventQueue("system instruction-based event queue")
82{
83 // add self to global system list
84 systemList.push_back(this);
85
86 /** Keep track of all memories we can execute code out of
87 * in our system
88 */

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

166{
167#if FULL_SYSTEM
168 delete kernelSymtab;
169 delete kernel;
170#else
171 panic("System::fixFuncEventAddr needs to be rewritten "
172 "to work with syscall emulation");
173#endif // FULL_SYSTEM}
95 instEventQueue("system instruction-based event queue")
96{
97 // add self to global system list
98 systemList.push_back(this);
99
100 /** Keep track of all memories we can execute code out of
101 * in our system
102 */

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

180{
181#if FULL_SYSTEM
182 delete kernelSymtab;
183 delete kernel;
184#else
185 panic("System::fixFuncEventAddr needs to be rewritten "
186 "to work with syscall emulation");
187#endif // FULL_SYSTEM}
188
189 for (uint32_t j = 0; j < numWorkIds; j++)
190 delete workItemStats[j];
174}
175
176void
177System::setMemoryMode(Enums::MemoryMode mode)
178{
179 assert(getState() == Drained);
180 memoryMode = mode;
181}

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

335 kernelSymtab->unserialize("kernel_symtab", cp, section);
336#else // !FULL_SYSTEM
337 UNSERIALIZE_SCALAR(pagePtr);
338 UNSERIALIZE_SCALAR(nextPID);
339#endif
340}
341
342void
191}
192
193void
194System::setMemoryMode(Enums::MemoryMode mode)
195{
196 assert(getState() == Drained);
197 memoryMode = mode;
198}

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

352 kernelSymtab->unserialize("kernel_symtab", cp, section);
353#else // !FULL_SYSTEM
354 UNSERIALIZE_SCALAR(pagePtr);
355 UNSERIALIZE_SCALAR(nextPID);
356#endif
357}
358
359void
360System::regStats()
361{
362 for (uint32_t j = 0; j < numWorkIds ; j++) {
363 workItemStats[j] = new Stats::Histogram();
364 stringstream namestr;
365 ccprintf(namestr, "work_item_type%d", j);
366 workItemStats[j]->init(20)
367 .name(name() + "." + namestr.str())
368 .desc("Run time stat for" + namestr.str())
369 .prereq(*workItemStats[j]);
370 }
371}
372
373void
374System::workItemEnd(uint32_t tid, uint32_t workid)
375{
376 std::pair<uint32_t,uint32_t> p(tid, workid);
377 if (!lastWorkItemStarted.count(p))
378 return;
379
380 Tick samp = curTick() - lastWorkItemStarted[p];
381 DPRINTF(WorkItems, "Work item end: %d\t%d\t%lld\n", tid, workid, samp);
382
383 if (workid >= numWorkIds)
384 fatal("Got workid greater than specified in system configuration\n");
385
386 workItemStats[workid]->sample(samp);
387 lastWorkItemStarted.erase(p);
388}
389
390void
343System::printSystems()
344{
345 vector<System *>::iterator i = systemList.begin();
346 vector<System *>::iterator end = systemList.end();
347 for (; i != end; ++i) {
348 System *sys = *i;
349 cerr << "System " << sys->name() << ": " << hex << sys << endl;
350 }

--- 20 unchanged lines hidden ---
391System::printSystems()
392{
393 vector<System *>::iterator i = systemList.begin();
394 vector<System *>::iterator end = systemList.end();
395 for (; i != end; ++i) {
396 System *sys = *i;
397 cerr << "System " << sys->name() << ": " << hex << sys << endl;
398 }

--- 20 unchanged lines hidden ---