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 process(_process), |
57#endif |
58 port(NULL), virtPort(NULL), physPort(NULL), funcExeInst(0), 59 storeCondFailures(0) |
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 |
158 |
159TranslatingPort * 160ThreadState::getMemPort() 161{ 162 if (port != NULL) 163 return port; 164 165 /* Use this port to for syscall emulation writes to memory. */ |
166 port = new TranslatingPort(csprintf("%s-%d-funcport", baseCpu->name(), 167 _threadId), 168#if !FULL_SYSTEM 169 process, 170#endif 171 TranslatingPort::NextPage); |
172 173 connectToMemFunc(port); 174 175 return port; 176} |
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} |