system.cc (12449:2260f4a68210) system.cc (12515:e3d1a64d0260)
1/*
2 * Copyright (c) 2011-2014,2017 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

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

42 * Lisa Hsu
43 * Nathan Binkert
44 * Ali Saidi
45 * Rick Strong
46 */
47
48#include "sim/system.hh"
49
1/*
2 * Copyright (c) 2011-2014,2017 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

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

42 * Lisa Hsu
43 * Nathan Binkert
44 * Ali Saidi
45 * Rick Strong
46 */
47
48#include "sim/system.hh"
49
50#include <algorithm>
51
50#include "arch/remote_gdb.hh"
51#include "arch/utility.hh"
52#include "base/loader/object_file.hh"
53#include "base/loader/symtab.hh"
54#include "base/str.hh"
55#include "base/trace.hh"
56#include "config/use_kvm.hh"
57#if USE_KVM

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

82using namespace TheISA;
83
84vector<System *> System::systemList;
85
86int System::numSystemsRunning = 0;
87
88System::System(Params *p)
89 : MemObject(p), _systemPort("system_port", this),
52#include "arch/remote_gdb.hh"
53#include "arch/utility.hh"
54#include "base/loader/object_file.hh"
55#include "base/loader/symtab.hh"
56#include "base/str.hh"
57#include "base/trace.hh"
58#include "config/use_kvm.hh"
59#if USE_KVM

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

84using namespace TheISA;
85
86vector<System *> System::systemList;
87
88int System::numSystemsRunning = 0;
89
90System::System(Params *p)
91 : MemObject(p), _systemPort("system_port", this),
90 _numContexts(0),
91 multiThread(p->multi_thread),
92 pagePtr(0),
93 init_param(p->init_param),
94 physProxy(_systemPort, p->cache_line_size),
95 kernelSymtab(nullptr),
96 kernel(nullptr),
97 loadAddrMask(p->load_addr_mask),
98 loadAddrOffset(p->load_offset),

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

251
252 if (threadContexts.size() <= id)
253 threadContexts.resize(id + 1);
254
255 fatal_if(threadContexts[id],
256 "Cannot have two CPUs with the same id (%d)\n", id);
257
258 threadContexts[id] = tc;
92 multiThread(p->multi_thread),
93 pagePtr(0),
94 init_param(p->init_param),
95 physProxy(_systemPort, p->cache_line_size),
96 kernelSymtab(nullptr),
97 kernel(nullptr),
98 loadAddrMask(p->load_addr_mask),
99 loadAddrOffset(p->load_offset),

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

252
253 if (threadContexts.size() <= id)
254 threadContexts.resize(id + 1);
255
256 fatal_if(threadContexts[id],
257 "Cannot have two CPUs with the same id (%d)\n", id);
258
259 threadContexts[id] = tc;
259 _numContexts++;
260
261#if THE_ISA != NULL_ISA
262 int port = getRemoteGDBPort();
263 if (port) {
264 RemoteGDB *rgdb = new RemoteGDB(this, tc, port + id);
265 rgdb->listen();
266
267 BaseCPU *cpu = tc->getCpuPtr();

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

282 activeCpus.push_back(false);
283
284 return id;
285}
286
287int
288System::numRunningContexts()
289{
260
261#if THE_ISA != NULL_ISA
262 int port = getRemoteGDBPort();
263 if (port) {
264 RemoteGDB *rgdb = new RemoteGDB(this, tc, port + id);
265 rgdb->listen();
266
267 BaseCPU *cpu = tc->getCpuPtr();

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

282 activeCpus.push_back(false);
283
284 return id;
285}
286
287int
288System::numRunningContexts()
289{
290 int running = 0;
291 for (int i = 0; i < _numContexts; ++i) {
292 if (threadContexts[i]->status() != ThreadContext::Halted)
293 ++running;
294 }
295 return running;
290 return std::count_if(
291 threadContexts.cbegin(),
292 threadContexts.cend(),
293 [] (ThreadContext* tc) {
294 return tc->status() != ThreadContext::Halted;
295 }
296 );
296}
297
298void
299System::initState()
300{
301 if (FullSystem) {
302 for (int i = 0; i < threadContexts.size(); i++)
303 TheISA::startupCPU(threadContexts[i], i);

--- 231 unchanged lines hidden ---
297}
298
299void
300System::initState()
301{
302 if (FullSystem) {
303 for (int i = 0; i < threadContexts.size(); i++)
304 TheISA::startupCPU(threadContexts[i], i);

--- 231 unchanged lines hidden ---