thread_state.cc (3476:0e26b5458236) thread_state.cc (3486:11b71489efd6)
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;

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

54 port(NULL), process(_process), asid(_asid),
55 microPC(0), nextMicroPC(1), funcExeInst(0), storeCondFailures(0)
56#endif
57{
58 numInst = 0;
59 numLoad = 0;
60}
61
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;

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

54 port(NULL), process(_process), asid(_asid),
55 microPC(0), nextMicroPC(1), funcExeInst(0), storeCondFailures(0)
56#endif
57{
58 numInst = 0;
59 numLoad = 0;
60}
61
62ThreadState::~ThreadState()
63{
64#if !FULL_SYSTEM
65 if (port) {
66 delete port->getPeer();
67 delete port;
68 }
69#endif
70}
71
62void
63ThreadState::serialize(std::ostream &os)
64{
65 SERIALIZE_ENUM(_status);
66 // thread_num and cpu_id are deterministic from the config
67 SERIALIZE_SCALAR(funcExeInst);
68 SERIALIZE_SCALAR(inst);
69 SERIALIZE_SCALAR(microPC);

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

119#else
120TranslatingPort *
121ThreadState::getMemPort()
122{
123 if (port != NULL)
124 return port;
125
126 /* Use this port to for syscall emulation writes to memory. */
72void
73ThreadState::serialize(std::ostream &os)
74{
75 SERIALIZE_ENUM(_status);
76 // thread_num and cpu_id are deterministic from the config
77 SERIALIZE_SCALAR(funcExeInst);
78 SERIALIZE_SCALAR(inst);
79 SERIALIZE_SCALAR(microPC);

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

129#else
130TranslatingPort *
131ThreadState::getMemPort()
132{
133 if (port != NULL)
134 return port;
135
136 /* Use this port to for syscall emulation writes to memory. */
127 Port *dcache_port, *func_mem_port;
128 port = new TranslatingPort(csprintf("%s-%d-funcport",
129 baseCpu->name(), tid),
130 process->pTable, false);
131
137 port = new TranslatingPort(csprintf("%s-%d-funcport",
138 baseCpu->name(), tid),
139 process->pTable, false);
140
141 Port *func_port = getMemFuncPort();
142
143 func_port->setPeer(port);
144 port->setPeer(func_port);
145
146 return port;
147}
148#endif
149
150Port *
151ThreadState::getMemFuncPort()
152{
153 Port *dcache_port, *func_mem_port;
154
132 dcache_port = baseCpu->getPort("dcache_port");
133 assert(dcache_port != NULL);
134
135 MemObject *mem_object = dcache_port->getPeer()->getOwner();
136 assert(mem_object != NULL);
137
138 func_mem_port = mem_object->getPort("functional");
139 assert(func_mem_port != NULL);
140
155 dcache_port = baseCpu->getPort("dcache_port");
156 assert(dcache_port != NULL);
157
158 MemObject *mem_object = dcache_port->getPeer()->getOwner();
159 assert(mem_object != NULL);
160
161 func_mem_port = mem_object->getPort("functional");
162 assert(func_mem_port != NULL);
163
141 func_mem_port->setPeer(port);
142 port->setPeer(func_mem_port);
143
144 return port;
164 return func_mem_port;
145}
165}
146#endif