summaryrefslogtreecommitdiff
path: root/src/cpu/thread_state.cc
blob: 9712ffa23886c1604ba021eb3da4833c4705e122 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "base/output.hh"
#include "cpu/profile.hh"
#include "cpu/thread_state.hh"

#if FULL_SYSTEM
ThreadState::ThreadState(int _cpuId, int _tid)
    : cpuId(_cpuId), tid(_tid), lastActivate(0), lastSuspend(0),
      profile(NULL), profileNode(NULL), profilePC(0), quiesceEvent(NULL),
      funcExeInst(0), storeCondFailures(0)
#else
ThreadState::ThreadState(int _cpuId, int _tid, MemObject *mem,
                         Process *_process, short _asid)
    : cpuId(_cpuId), tid(_tid), lastActivate(0), lastSuspend(0),
      process(_process), asid(_asid),
      funcExeInst(0), storeCondFailures(0)
#endif
{
#if !FULL_SYSTEM
        /* Use this port to for syscall emulation writes to memory. */
        Port *mem_port;
        port = new TranslatingPort(csprintf("%d-funcport",
                                            tid),
                                   process->pTable, false);
        mem_port = mem->getPort("functional");
        mem_port->setPeer(port);
        port->setPeer(mem_port);
#endif
}

#if FULL_SYSTEM

void
ThreadState::profileClear()
{
    if (profile)
        profile->clear();
}

void
ThreadState::profileSample()
{
    if (profile)
        profile->sample(profileNode, profilePC);
}

#endif