system.cc revision 8703
12689Sktlim@umich.edu/*
28703Sandreas.hansson@arm.com * Copyright (c) 2011-2012 ARM Limited
38666SPrakash.Ramrakhyani@arm.com * All rights reserved
48666SPrakash.Ramrakhyani@arm.com *
58666SPrakash.Ramrakhyani@arm.com * The license below extends only to copyright in the software and shall
68666SPrakash.Ramrakhyani@arm.com * not be construed as granting a license to any other intellectual
78666SPrakash.Ramrakhyani@arm.com * property including but not limited to intellectual property relating
88666SPrakash.Ramrakhyani@arm.com * to a hardware implementation of the functionality of the software
98666SPrakash.Ramrakhyani@arm.com * licensed hereunder.  You may use the software subject to the license
108666SPrakash.Ramrakhyani@arm.com * terms below provided that you ensure that this notice is replicated
118666SPrakash.Ramrakhyani@arm.com * unmodified and in its entirety in all distributions of the software,
128666SPrakash.Ramrakhyani@arm.com * modified or unmodified, in source code or in binary form.
138666SPrakash.Ramrakhyani@arm.com *
142689Sktlim@umich.edu * Copyright (c) 2003-2006 The Regents of The University of Michigan
157897Shestness@cs.utexas.edu * Copyright (c) 2011 Regents of the University of California
162689Sktlim@umich.edu * All rights reserved.
172689Sktlim@umich.edu *
182689Sktlim@umich.edu * Redistribution and use in source and binary forms, with or without
192689Sktlim@umich.edu * modification, are permitted provided that the following conditions are
202689Sktlim@umich.edu * met: redistributions of source code must retain the above copyright
212689Sktlim@umich.edu * notice, this list of conditions and the following disclaimer;
222689Sktlim@umich.edu * redistributions in binary form must reproduce the above copyright
232689Sktlim@umich.edu * notice, this list of conditions and the following disclaimer in the
242689Sktlim@umich.edu * documentation and/or other materials provided with the distribution;
252689Sktlim@umich.edu * neither the name of the copyright holders nor the names of its
262689Sktlim@umich.edu * contributors may be used to endorse or promote products derived from
272689Sktlim@umich.edu * this software without specific prior written permission.
282689Sktlim@umich.edu *
292689Sktlim@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
302689Sktlim@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
312689Sktlim@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
322689Sktlim@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
332689Sktlim@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
342689Sktlim@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
352689Sktlim@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
362689Sktlim@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
372689Sktlim@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
382689Sktlim@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
392689Sktlim@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
402689Sktlim@umich.edu *
412689Sktlim@umich.edu * Authors: Steve Reinhardt
422689Sktlim@umich.edu *          Lisa Hsu
432689Sktlim@umich.edu *          Nathan Binkert
442689Sktlim@umich.edu *          Ali Saidi
457897Shestness@cs.utexas.edu *          Rick Strong
462689Sktlim@umich.edu */
472689Sktlim@umich.edu
482521SN/A#include "arch/isa_traits.hh"
493960Sgblack@eecs.umich.edu#include "arch/remote_gdb.hh"
504194Ssaidi@eecs.umich.edu#include "arch/utility.hh"
511070SN/A#include "base/loader/object_file.hh"
521070SN/A#include "base/loader/symtab.hh"
532521SN/A#include "base/trace.hh"
546658Snate@binkert.org#include "config/full_system.hh"
556658Snate@binkert.org#include "config/the_isa.hh"
568229Snate@binkert.org#include "cpu/thread_context.hh"
578232Snate@binkert.org#include "debug/Loader.hh"
588666SPrakash.Ramrakhyani@arm.com#include "debug/WorkItems.hh"
592521SN/A#include "mem/mem_object.hh"
602522SN/A#include "mem/physical.hh"
612037SN/A#include "sim/byteswap.hh"
628229Snate@binkert.org#include "sim/debug.hh"
6356SN/A#include "sim/system.hh"
646658Snate@binkert.org
652378SN/A#if FULL_SYSTEM
662521SN/A#include "arch/vtophys.hh"
672378SN/A#include "kern/kernel_stats.hh"
687723SAli.Saidi@ARM.com#include "mem/vport.hh"
694762Snate@binkert.org#else
704762Snate@binkert.org#include "params/System.hh"
712378SN/A#endif
722SN/A
732SN/Ausing namespace std;
742107SN/Ausing namespace TheISA;
752SN/A
762SN/Avector<System *> System::systemList;
772SN/A
782SN/Aint System::numSystemsRunning = 0;
792SN/A
801070SN/ASystem::System(Params *p)
818703Sandreas.hansson@arm.com    : MemObject(p), _systemPort("system_port", this),
828703Sandreas.hansson@arm.com      physmem(p->physmem),
838703Sandreas.hansson@arm.com      _numContexts(0),
842378SN/A#if FULL_SYSTEM
852521SN/A      init_param(p->init_param),
867580SAli.Saidi@arm.com      loadAddrMask(p->load_addr_mask),
872378SN/A#else
887770SAli.Saidi@ARM.com      pagePtr(0),
897770SAli.Saidi@ARM.com      nextPID(0),
902378SN/A#endif
917914SBrad.Beckmann@amd.com      memoryMode(p->mem_mode),
927914SBrad.Beckmann@amd.com      workItemsBegin(0),
937914SBrad.Beckmann@amd.com      workItemsEnd(0),
948666SPrakash.Ramrakhyani@arm.com      numWorkIds(p->num_work_ids),
957914SBrad.Beckmann@amd.com      _params(p),
968666SPrakash.Ramrakhyani@arm.com      totalNumInsts(0),
977897Shestness@cs.utexas.edu      instEventQueue("system instruction-based event queue")
982SN/A{
991070SN/A    // add self to global system list
1001070SN/A    systemList.push_back(this);
1011070SN/A
1028460SAli.Saidi@ARM.com    /** Keep track of all memories we can execute code out of
1038460SAli.Saidi@ARM.com     * in our system
1048460SAli.Saidi@ARM.com     */
1058460SAli.Saidi@ARM.com    for (int x = 0; x < p->memories.size(); x++) {
1068460SAli.Saidi@ARM.com        if (!p->memories[x])
1078460SAli.Saidi@ARM.com            continue;
1088460SAli.Saidi@ARM.com        memRanges.push_back(RangeSize(p->memories[x]->start(),
1098460SAli.Saidi@ARM.com                                      p->memories[x]->size()));
1108460SAli.Saidi@ARM.com    }
1118460SAli.Saidi@ARM.com
1122378SN/A#if FULL_SYSTEM
1131070SN/A    kernelSymtab = new SymbolTable;
1144838Ssaidi@eecs.umich.edu    if (!debugSymbolTable)
1154838Ssaidi@eecs.umich.edu        debugSymbolTable = new SymbolTable;
1161070SN/A
1172520SN/A
1182520SN/A    /**
1192520SN/A     * Get a functional port to memory
1202520SN/A     */
1212520SN/A    Port *mem_port;
1227723SAli.Saidi@ARM.com    functionalPort = new FunctionalPort(name() + "-fport");
1232520SN/A    mem_port = physmem->getPort("functional");
1247723SAli.Saidi@ARM.com    functionalPort->setPeer(mem_port);
1257723SAli.Saidi@ARM.com    mem_port->setPeer(functionalPort);
1262520SN/A
1277723SAli.Saidi@ARM.com    virtPort = new VirtualPort(name() + "-fport");
1282521SN/A    mem_port = physmem->getPort("functional");
1297723SAli.Saidi@ARM.com    virtPort->setPeer(mem_port);
1307723SAli.Saidi@ARM.com    mem_port->setPeer(virtPort);
1312521SN/A
1322520SN/A
1331070SN/A    /**
1342158SN/A     * Load the kernel code into memory
1351070SN/A     */
1364762Snate@binkert.org    if (params()->kernel == "") {
1375823Ssaidi@eecs.umich.edu        inform("No kernel set for full system simulation. Assuming you know what"
1383812Ssaidi@eecs.umich.edu                " you're doing...\n");
1393812Ssaidi@eecs.umich.edu    } else {
1403812Ssaidi@eecs.umich.edu        // Load kernel code
1414762Snate@binkert.org        kernel = createObjectFile(params()->kernel);
1425823Ssaidi@eecs.umich.edu        inform("kernel located at: %s", params()->kernel);
1435222Sksewell@umich.edu
1443812Ssaidi@eecs.umich.edu        if (kernel == NULL)
1454762Snate@binkert.org            fatal("Could not load kernel file %s", params()->kernel);
1461070SN/A
1473812Ssaidi@eecs.umich.edu        // Load program sections into memory
1487723SAli.Saidi@ARM.com        kernel->loadSections(functionalPort, loadAddrMask);
1491070SN/A
1503812Ssaidi@eecs.umich.edu        // setup entry points
1513812Ssaidi@eecs.umich.edu        kernelStart = kernel->textBase();
1523812Ssaidi@eecs.umich.edu        kernelEnd = kernel->bssBase() + kernel->bssSize();
1533812Ssaidi@eecs.umich.edu        kernelEntry = kernel->entryPoint();
1541070SN/A
1553812Ssaidi@eecs.umich.edu        // load symbols
1563812Ssaidi@eecs.umich.edu        if (!kernel->loadGlobalSymbols(kernelSymtab))
1575823Ssaidi@eecs.umich.edu            fatal("could not load kernel symbols\n");
1581070SN/A
1593812Ssaidi@eecs.umich.edu        if (!kernel->loadLocalSymbols(kernelSymtab))
1605823Ssaidi@eecs.umich.edu            fatal("could not load kernel local symbols\n");
1611070SN/A
1623812Ssaidi@eecs.umich.edu        if (!kernel->loadGlobalSymbols(debugSymbolTable))
1635823Ssaidi@eecs.umich.edu            fatal("could not load kernel symbols\n");
1641074SN/A
1653812Ssaidi@eecs.umich.edu        if (!kernel->loadLocalSymbols(debugSymbolTable))
1665823Ssaidi@eecs.umich.edu            fatal("could not load kernel local symbols\n");
1671074SN/A
1683812Ssaidi@eecs.umich.edu        DPRINTF(Loader, "Kernel start = %#x\n", kernelStart);
1693812Ssaidi@eecs.umich.edu        DPRINTF(Loader, "Kernel end   = %#x\n", kernelEnd);
1703812Ssaidi@eecs.umich.edu        DPRINTF(Loader, "Kernel entry = %#x\n", kernelEntry);
1713812Ssaidi@eecs.umich.edu        DPRINTF(Loader, "Kernel loaded...\n");
1723812Ssaidi@eecs.umich.edu    }
1732378SN/A#endif // FULL_SYSTEM
1742378SN/A
1751070SN/A    // increment the number of running systms
176878SN/A    numSystemsRunning++;
1777914SBrad.Beckmann@amd.com
1787914SBrad.Beckmann@amd.com    activeCpus.clear();
1792SN/A}
1802SN/A
1812SN/ASystem::~System()
1822SN/A{
1832378SN/A#if FULL_SYSTEM
1841070SN/A    delete kernelSymtab;
1851070SN/A    delete kernel;
1862378SN/A#else
1872378SN/A    panic("System::fixFuncEventAddr needs to be rewritten "
1882378SN/A          "to work with syscall emulation");
1892378SN/A#endif // FULL_SYSTEM}
1908666SPrakash.Ramrakhyani@arm.com
1918666SPrakash.Ramrakhyani@arm.com    for (uint32_t j = 0; j < numWorkIds; j++)
1928666SPrakash.Ramrakhyani@arm.com        delete workItemStats[j];
1932SN/A}
1942SN/A
1958703Sandreas.hansson@arm.comPort*
1968703Sandreas.hansson@arm.comSystem::getPort(const std::string &if_name, int idx)
1978703Sandreas.hansson@arm.com{
1988703Sandreas.hansson@arm.com    // no need to distinguish at the moment (besides checking)
1998703Sandreas.hansson@arm.com    return &_systemPort;
2008703Sandreas.hansson@arm.com}
2018703Sandreas.hansson@arm.com
2022901Ssaidi@eecs.umich.eduvoid
2034762Snate@binkert.orgSystem::setMemoryMode(Enums::MemoryMode mode)
2042901Ssaidi@eecs.umich.edu{
2052901Ssaidi@eecs.umich.edu    assert(getState() == Drained);
2062901Ssaidi@eecs.umich.edu    memoryMode = mode;
2072901Ssaidi@eecs.umich.edu}
2082901Ssaidi@eecs.umich.edu
2093960Sgblack@eecs.umich.edubool System::breakpoint()
2103960Sgblack@eecs.umich.edu{
2114095Sbinkertn@umich.edu    if (remoteGDB.size())
2124095Sbinkertn@umich.edu        return remoteGDB[0]->breakpoint();
2134095Sbinkertn@umich.edu    return false;
2143960Sgblack@eecs.umich.edu}
2153960Sgblack@eecs.umich.edu
2167445Ssteve.reinhardt@amd.com/**
2177445Ssteve.reinhardt@amd.com * Setting rgdb_wait to a positive integer waits for a remote debugger to
2187445Ssteve.reinhardt@amd.com * connect to that context ID before continuing.  This should really
2197445Ssteve.reinhardt@amd.com   be a parameter on the CPU object or something...
2207445Ssteve.reinhardt@amd.com */
2217445Ssteve.reinhardt@amd.comint rgdb_wait = -1;
2227445Ssteve.reinhardt@amd.com
223180SN/Aint
2245718Shsul@eecs.umich.eduSystem::registerThreadContext(ThreadContext *tc, int assigned)
2252SN/A{
2265712Shsul@eecs.umich.edu    int id;
2275718Shsul@eecs.umich.edu    if (assigned == -1) {
2285718Shsul@eecs.umich.edu        for (id = 0; id < threadContexts.size(); id++) {
2295718Shsul@eecs.umich.edu            if (!threadContexts[id])
2305718Shsul@eecs.umich.edu                break;
2315718Shsul@eecs.umich.edu        }
2325718Shsul@eecs.umich.edu
2335718Shsul@eecs.umich.edu        if (threadContexts.size() <= id)
2345718Shsul@eecs.umich.edu            threadContexts.resize(id + 1);
2355718Shsul@eecs.umich.edu    } else {
2365718Shsul@eecs.umich.edu        if (threadContexts.size() <= assigned)
2375718Shsul@eecs.umich.edu            threadContexts.resize(assigned + 1);
2385718Shsul@eecs.umich.edu        id = assigned;
2391806SN/A    }
2401806SN/A
2412680Sktlim@umich.edu    if (threadContexts[id])
2425823Ssaidi@eecs.umich.edu        fatal("Cannot have two CPUs with the same id (%d)\n", id);
2431806SN/A
2442680Sktlim@umich.edu    threadContexts[id] = tc;
2455714Shsul@eecs.umich.edu    _numContexts++;
2461070SN/A
2475512SMichael.Adler@intel.com    int port = getRemoteGDBPort();
2487445Ssteve.reinhardt@amd.com    if (port) {
2494095Sbinkertn@umich.edu        RemoteGDB *rgdb = new RemoteGDB(this, tc);
2505512SMichael.Adler@intel.com        GDBListener *gdbl = new GDBListener(rgdb, port + id);
2514095Sbinkertn@umich.edu        gdbl->listen();
2527445Ssteve.reinhardt@amd.com
2534095Sbinkertn@umich.edu        if (rgdb_wait != -1 && rgdb_wait == id)
2544095Sbinkertn@umich.edu            gdbl->accept();
2551070SN/A
2564095Sbinkertn@umich.edu        if (remoteGDB.size() <= id) {
2574095Sbinkertn@umich.edu            remoteGDB.resize(id + 1);
2584095Sbinkertn@umich.edu        }
2594095Sbinkertn@umich.edu
2604095Sbinkertn@umich.edu        remoteGDB[id] = rgdb;
2611070SN/A    }
2621070SN/A
2637914SBrad.Beckmann@amd.com    activeCpus.push_back(false);
2647914SBrad.Beckmann@amd.com
2651806SN/A    return id;
266180SN/A}
26775SN/A
2686029Ssteve.reinhardt@amd.comint
2696029Ssteve.reinhardt@amd.comSystem::numRunningContexts()
2706029Ssteve.reinhardt@amd.com{
2716029Ssteve.reinhardt@amd.com    int running = 0;
2726029Ssteve.reinhardt@amd.com    for (int i = 0; i < _numContexts; ++i) {
2736029Ssteve.reinhardt@amd.com        if (threadContexts[i]->status() != ThreadContext::Halted)
2746029Ssteve.reinhardt@amd.com            ++running;
2756029Ssteve.reinhardt@amd.com    }
2766029Ssteve.reinhardt@amd.com    return running;
2776029Ssteve.reinhardt@amd.com}
2786029Ssteve.reinhardt@amd.com
279180SN/Avoid
2807733SAli.Saidi@ARM.comSystem::initState()
2811129SN/A{
2825713Shsul@eecs.umich.edu#if FULL_SYSTEM
2832114SN/A    int i;
2842680Sktlim@umich.edu    for (i = 0; i < threadContexts.size(); i++)
2854194Ssaidi@eecs.umich.edu        TheISA::startupCPU(threadContexts[i], i);
2865713Shsul@eecs.umich.edu#endif
2871129SN/A}
2881129SN/A
2891129SN/Avoid
2905713Shsul@eecs.umich.eduSystem::replaceThreadContext(ThreadContext *tc, int context_id)
291180SN/A{
2925713Shsul@eecs.umich.edu    if (context_id >= threadContexts.size()) {
2932680Sktlim@umich.edu        panic("replaceThreadContext: bad id, %d >= %d\n",
2945713Shsul@eecs.umich.edu              context_id, threadContexts.size());
295180SN/A    }
296180SN/A
2975713Shsul@eecs.umich.edu    threadContexts[context_id] = tc;
2985713Shsul@eecs.umich.edu    if (context_id < remoteGDB.size())
2995713Shsul@eecs.umich.edu        remoteGDB[context_id]->replaceThreadContext(tc);
3002SN/A}
3012SN/A
3022378SN/A#if !FULL_SYSTEM
3032378SN/AAddr
3048601Ssteve.reinhardt@amd.comSystem::allocPhysPages(int npages)
3052378SN/A{
3067770SAli.Saidi@ARM.com    Addr return_addr = pagePtr << LogVMPageSize;
3078601Ssteve.reinhardt@amd.com    pagePtr += npages;
3083162Ssaidi@eecs.umich.edu    if (return_addr >= physmem->size())
3093162Ssaidi@eecs.umich.edu        fatal("Out of memory, please increase size of physical memory.");
3102378SN/A    return return_addr;
3112378SN/A}
3125795Ssaidi@eecs.umich.edu
3135795Ssaidi@eecs.umich.eduAddr
3145795Ssaidi@eecs.umich.eduSystem::memSize()
3155795Ssaidi@eecs.umich.edu{
3165795Ssaidi@eecs.umich.edu    return physmem->size();
3175795Ssaidi@eecs.umich.edu}
3185795Ssaidi@eecs.umich.edu
3195795Ssaidi@eecs.umich.eduAddr
3205795Ssaidi@eecs.umich.eduSystem::freeMemSize()
3215795Ssaidi@eecs.umich.edu{
3227770SAli.Saidi@ARM.com   return physmem->size() - (pagePtr << LogVMPageSize);
3235795Ssaidi@eecs.umich.edu}
3245795Ssaidi@eecs.umich.edu
3252378SN/A#endif
3262378SN/A
3278460SAli.Saidi@ARM.combool
3288460SAli.Saidi@ARM.comSystem::isMemory(const Addr addr) const
3298460SAli.Saidi@ARM.com{
3308460SAli.Saidi@ARM.com    std::list<Range<Addr> >::const_iterator i;
3318460SAli.Saidi@ARM.com    for (i = memRanges.begin(); i != memRanges.end(); i++) {
3328460SAli.Saidi@ARM.com        if (*i == addr)
3338460SAli.Saidi@ARM.com            return true;
3348460SAli.Saidi@ARM.com    }
3358460SAli.Saidi@ARM.com    return false;
3368460SAli.Saidi@ARM.com}
3378460SAli.Saidi@ARM.com
3381070SN/Avoid
3397897Shestness@cs.utexas.eduSystem::resume()
3407897Shestness@cs.utexas.edu{
3417897Shestness@cs.utexas.edu    SimObject::resume();
3427897Shestness@cs.utexas.edu    totalNumInsts = 0;
3437897Shestness@cs.utexas.edu}
3447897Shestness@cs.utexas.edu
3457897Shestness@cs.utexas.eduvoid
3461070SN/ASystem::serialize(ostream &os)
3471070SN/A{
3482378SN/A#if FULL_SYSTEM
3491984SN/A    kernelSymtab->serialize("kernel_symtab", os);
3505183Ssaidi@eecs.umich.edu#else // !FULL_SYSTEM
3517770SAli.Saidi@ARM.com    SERIALIZE_SCALAR(pagePtr);
3527770SAli.Saidi@ARM.com    SERIALIZE_SCALAR(nextPID);
3535183Ssaidi@eecs.umich.edu#endif
3541070SN/A}
3551070SN/A
3561070SN/A
3571070SN/Avoid
3581070SN/ASystem::unserialize(Checkpoint *cp, const string &section)
3591070SN/A{
3602378SN/A#if FULL_SYSTEM
3611984SN/A    kernelSymtab->unserialize("kernel_symtab", cp, section);
3625183Ssaidi@eecs.umich.edu#else // !FULL_SYSTEM
3637770SAli.Saidi@ARM.com    UNSERIALIZE_SCALAR(pagePtr);
3647770SAli.Saidi@ARM.com    UNSERIALIZE_SCALAR(nextPID);
3655183Ssaidi@eecs.umich.edu#endif
3661070SN/A}
3672SN/A
3682SN/Avoid
3698666SPrakash.Ramrakhyani@arm.comSystem::regStats()
3708666SPrakash.Ramrakhyani@arm.com{
3718666SPrakash.Ramrakhyani@arm.com    for (uint32_t j = 0; j < numWorkIds ; j++) {
3728666SPrakash.Ramrakhyani@arm.com        workItemStats[j] = new Stats::Histogram();
3738666SPrakash.Ramrakhyani@arm.com        stringstream namestr;
3748666SPrakash.Ramrakhyani@arm.com        ccprintf(namestr, "work_item_type%d", j);
3758666SPrakash.Ramrakhyani@arm.com        workItemStats[j]->init(20)
3768666SPrakash.Ramrakhyani@arm.com                         .name(name() + "." + namestr.str())
3778666SPrakash.Ramrakhyani@arm.com                         .desc("Run time stat for" + namestr.str())
3788666SPrakash.Ramrakhyani@arm.com                         .prereq(*workItemStats[j]);
3798666SPrakash.Ramrakhyani@arm.com    }
3808666SPrakash.Ramrakhyani@arm.com}
3818666SPrakash.Ramrakhyani@arm.com
3828666SPrakash.Ramrakhyani@arm.comvoid
3838666SPrakash.Ramrakhyani@arm.comSystem::workItemEnd(uint32_t tid, uint32_t workid)
3848666SPrakash.Ramrakhyani@arm.com{
3858666SPrakash.Ramrakhyani@arm.com    std::pair<uint32_t,uint32_t> p(tid, workid);
3868666SPrakash.Ramrakhyani@arm.com    if (!lastWorkItemStarted.count(p))
3878666SPrakash.Ramrakhyani@arm.com        return;
3888666SPrakash.Ramrakhyani@arm.com
3898666SPrakash.Ramrakhyani@arm.com    Tick samp = curTick() - lastWorkItemStarted[p];
3908666SPrakash.Ramrakhyani@arm.com    DPRINTF(WorkItems, "Work item end: %d\t%d\t%lld\n", tid, workid, samp);
3918666SPrakash.Ramrakhyani@arm.com
3928666SPrakash.Ramrakhyani@arm.com    if (workid >= numWorkIds)
3938666SPrakash.Ramrakhyani@arm.com        fatal("Got workid greater than specified in system configuration\n");
3948666SPrakash.Ramrakhyani@arm.com
3958666SPrakash.Ramrakhyani@arm.com    workItemStats[workid]->sample(samp);
3968666SPrakash.Ramrakhyani@arm.com    lastWorkItemStarted.erase(p);
3978666SPrakash.Ramrakhyani@arm.com}
3988666SPrakash.Ramrakhyani@arm.com
3998666SPrakash.Ramrakhyani@arm.comvoid
4002SN/ASystem::printSystems()
4012SN/A{
4022SN/A    vector<System *>::iterator i = systemList.begin();
4032SN/A    vector<System *>::iterator end = systemList.end();
4042SN/A    for (; i != end; ++i) {
4052SN/A        System *sys = *i;
4062SN/A        cerr << "System " << sys->name() << ": " << hex << sys << endl;
4072SN/A    }
4082SN/A}
4092SN/A
4102SN/Avoid
4112SN/AprintSystems()
4122SN/A{
4132SN/A    System::printSystems();
4142SN/A}
4152SN/A
4162902Ssaidi@eecs.umich.educonst char *System::MemoryModeStrings[3] = {"invalid", "atomic",
4172902Ssaidi@eecs.umich.edu    "timing"};
4182902Ssaidi@eecs.umich.edu
4194762Snate@binkert.org#if !FULL_SYSTEM
4202424SN/A
4214762Snate@binkert.orgSystem *
4224762Snate@binkert.orgSystemParams::create()
4232424SN/A{
4245530Snate@binkert.org    return new System(this);
4252424SN/A}
4262424SN/A
4272424SN/A#endif
428