thread_state.cc (8761:20322354b80b) thread_state.cc (8764:e4660687c49f)
1/*
2 * Copyright (c) 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;

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

48ThreadState::ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process)
49#endif
50 : numInst(0), numLoad(0), _status(ThreadContext::Halted),
51 baseCpu(cpu), _threadId(_tid), lastActivate(0), lastSuspend(0),
52#if FULL_SYSTEM
53 profile(NULL), profileNode(NULL), profilePC(0), quiesceEvent(NULL),
54 kernelStats(NULL),
55#else
1/*
2 * Copyright (c) 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;

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

48ThreadState::ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process)
49#endif
50 : numInst(0), numLoad(0), _status(ThreadContext::Halted),
51 baseCpu(cpu), _threadId(_tid), lastActivate(0), lastSuspend(0),
52#if FULL_SYSTEM
53 profile(NULL), profileNode(NULL), profilePC(0), quiesceEvent(NULL),
54 kernelStats(NULL),
55#else
56 port(NULL), process(_process),
56 process(_process),
57#endif
57#endif
58 virtPort(NULL), physPort(NULL), funcExeInst(0), storeCondFailures(0)
58 port(NULL), virtPort(NULL), physPort(NULL), funcExeInst(0),
59 storeCondFailures(0)
59{
60}
61
62ThreadState::~ThreadState()
63{
64#if !FULL_SYSTEM
65 if (port) {
66 delete port->getPeer();

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

148}
149
150void
151ThreadState::profileSample()
152{
153 if (profile)
154 profile->sample(profileNode, profilePC);
155}
60{
61}
62
63ThreadState::~ThreadState()
64{
65#if !FULL_SYSTEM
66 if (port) {
67 delete port->getPeer();

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

149}
150
151void
152ThreadState::profileSample()
153{
154 if (profile)
155 profile->sample(profileNode, profilePC);
156}
157#endif
156
158
157#else
158TranslatingPort *
159ThreadState::getMemPort()
160{
161 if (port != NULL)
162 return port;
163
164 /* Use this port to for syscall emulation writes to memory. */
159TranslatingPort *
160ThreadState::getMemPort()
161{
162 if (port != NULL)
163 return port;
164
165 /* Use this port to for syscall emulation writes to memory. */
165 port = new TranslatingPort(csprintf("%s-%d-funcport", baseCpu->name(), _threadId),
166 process, TranslatingPort::NextPage);
166 port = new TranslatingPort(csprintf("%s-%d-funcport", baseCpu->name(),
167 _threadId),
168#if !FULL_SYSTEM
169 process,
170#endif
171 TranslatingPort::NextPage);
167
168 connectToMemFunc(port);
169
170 return port;
171}
172
173 connectToMemFunc(port);
174
175 return port;
176}
172#endif
173
174void
175ThreadState::connectToMemFunc(Port *port)
176{
177 Port *dcache_port, *func_mem_port;
178
179 dcache_port = baseCpu->getPort("dcache_port");
180 assert(dcache_port != NULL);
181
182 MemObject *mem_object = dcache_port->getPeer()->getOwner();
183 assert(mem_object != NULL);
184
185 func_mem_port = mem_object->getPort("functional");
186 assert(func_mem_port != NULL);
187
188 func_mem_port->setPeer(port);
189 port->setPeer(func_mem_port);
190}
177
178void
179ThreadState::connectToMemFunc(Port *port)
180{
181 Port *dcache_port, *func_mem_port;
182
183 dcache_port = baseCpu->getPort("dcache_port");
184 assert(dcache_port != NULL);
185
186 MemObject *mem_object = dcache_port->getPeer()->getOwner();
187 assert(mem_object != NULL);
188
189 func_mem_port = mem_object->getPort("functional");
190 assert(func_mem_port != NULL);
191
192 func_mem_port->setPeer(port);
193 port->setPeer(func_mem_port);
194}