base.cc (3495:884bf1f0c0c9) | base.cc (3520:4f4a2054fd85) |
---|---|
1/* 2 * Copyright (c) 2002-2005 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; --- 154 unchanged lines hidden (view full) --- 163 int *counter = new int; 164 *counter = number_of_threads; 165 for (int i = 0; i < number_of_threads; ++i) 166 new CountedExitEvent(comLoadEventQueue[i], 167 "all threads reached the max load count", 168 p->max_loads_all_threads, *counter); 169 } 170 | 1/* 2 * Copyright (c) 2002-2005 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; --- 154 unchanged lines hidden (view full) --- 163 int *counter = new int; 164 *counter = number_of_threads; 165 for (int i = 0; i < number_of_threads; ++i) 166 new CountedExitEvent(comLoadEventQueue[i], 167 "all threads reached the max load count", 168 p->max_loads_all_threads, *counter); 169 } 170 |
171#if FULL_SYSTEM 172 memset(interrupts, 0, sizeof(interrupts)); 173 intstatus = 0; 174#endif 175 | |
176 functionTracingEnabled = false; 177 if (p->functionTrace) { 178 functionTraceStream = simout.find(csprintf("ftrace.%s", name())); 179 currentFunctionStart = currentFunctionEnd = 0; 180 functionEntryTick = p->functionTraceStart; 181 182 if (p->functionTraceStart == 0) { 183 functionTracingEnabled = true; --- 70 unchanged lines hidden (view full) --- 254 } 255 } else if (size == 1) 256 threadContexts[0]->regStats(name()); 257 258#if FULL_SYSTEM 259#endif 260} 261 | 171 functionTracingEnabled = false; 172 if (p->functionTrace) { 173 functionTraceStream = simout.find(csprintf("ftrace.%s", name())); 174 currentFunctionStart = currentFunctionEnd = 0; 175 functionEntryTick = p->functionTraceStart; 176 177 if (p->functionTraceStart == 0) { 178 functionTracingEnabled = true; --- 70 unchanged lines hidden (view full) --- 249 } 250 } else if (size == 1) 251 threadContexts[0]->regStats(name()); 252 253#if FULL_SYSTEM 254#endif 255} 256 |
262Tick 263BaseCPU::nextCycle() 264{ 265 Tick next_tick = curTick + clock - 1; 266 next_tick -= (next_tick % clock); 267 return next_tick; 268} | |
269 | 257 |
270Tick 271BaseCPU::nextCycle(Tick begin_tick) 272{ 273 Tick next_tick = begin_tick; 274 275 while (next_tick < curTick) 276 next_tick += clock; 277 278 next_tick -= (next_tick % clock); 279 assert(next_tick >= curTick); 280 return next_tick; 281} 282 | |
283void 284BaseCPU::registerThreadContexts() 285{ 286 for (int i = 0; i < threadContexts.size(); ++i) { 287 ThreadContext *tc = threadContexts[i]; 288 289#if FULL_SYSTEM 290 int id = params->cpu_id; --- 38 unchanged lines hidden (view full) --- 329 assert(newTC->getProcessPtr() == oldTC->getProcessPtr()); 330 newTC->getProcessPtr()->replaceThreadContext(newTC, newTC->readCpuId()); 331#endif 332 333// TheISA::compareXCs(oldXC, newXC); 334 } 335 336#if FULL_SYSTEM | 258void 259BaseCPU::registerThreadContexts() 260{ 261 for (int i = 0; i < threadContexts.size(); ++i) { 262 ThreadContext *tc = threadContexts[i]; 263 264#if FULL_SYSTEM 265 int id = params->cpu_id; --- 38 unchanged lines hidden (view full) --- 304 assert(newTC->getProcessPtr() == oldTC->getProcessPtr()); 305 newTC->getProcessPtr()->replaceThreadContext(newTC, newTC->readCpuId()); 306#endif 307 308// TheISA::compareXCs(oldXC, newXC); 309 } 310 311#if FULL_SYSTEM |
337 for (int i = 0; i < TheISA::NumInterruptLevels; ++i) 338 interrupts[i] = oldCPU->interrupts[i]; 339 intstatus = oldCPU->intstatus; | 312 interrupts = oldCPU->interrupts; |
340 checkInterrupts = oldCPU->checkInterrupts; 341 342 for (int i = 0; i < threadContexts.size(); ++i) 343 threadContexts[i]->profileClear(); 344 345 // The Sampler must take care of this! 346// if (profileEvent) 347// profileEvent->schedule(curTick); --- 15 unchanged lines hidden (view full) --- 363 } 364 365 schedule(curTick + interval); 366} 367 368void 369BaseCPU::post_interrupt(int int_num, int index) 370{ | 313 checkInterrupts = oldCPU->checkInterrupts; 314 315 for (int i = 0; i < threadContexts.size(); ++i) 316 threadContexts[i]->profileClear(); 317 318 // The Sampler must take care of this! 319// if (profileEvent) 320// profileEvent->schedule(curTick); --- 15 unchanged lines hidden (view full) --- 336 } 337 338 schedule(curTick + interval); 339} 340 341void 342BaseCPU::post_interrupt(int int_num, int index) 343{ |
371 DPRINTF(Interrupt, "Interrupt %d:%d posted\n", int_num, index); 372 373 if (int_num < 0 || int_num >= TheISA::NumInterruptLevels) 374 panic("int_num out of bounds\n"); 375 376 if (index < 0 || index >= sizeof(uint64_t) * 8) 377 panic("int_num out of bounds\n"); 378 | |
379 checkInterrupts = true; | 344 checkInterrupts = true; |
380 interrupts[int_num] |= 1 << index; 381 intstatus |= (ULL(1) << int_num); | 345 interrupts.post(int_num, index); |
382} 383 384void 385BaseCPU::clear_interrupt(int int_num, int index) 386{ | 346} 347 348void 349BaseCPU::clear_interrupt(int int_num, int index) 350{ |
387 DPRINTF(Interrupt, "Interrupt %d:%d cleared\n", int_num, index); 388 389 if (int_num < 0 || int_num >= TheISA::NumInterruptLevels) 390 panic("int_num out of bounds\n"); 391 392 if (index < 0 || index >= sizeof(uint64_t) * 8) 393 panic("int_num out of bounds\n"); 394 395 interrupts[int_num] &= ~(1 << index); 396 if (interrupts[int_num] == 0) 397 intstatus &= ~(ULL(1) << int_num); | 351 interrupts.clear(int_num, index); |
398} 399 400void 401BaseCPU::clear_interrupts() 402{ | 352} 353 354void 355BaseCPU::clear_interrupts() 356{ |
403 DPRINTF(Interrupt, "Interrupts all cleared\n"); 404 405 memset(interrupts, 0, sizeof(interrupts)); 406 intstatus = 0; | 357 interrupts.clear_all(); |
407} 408 409 410void 411BaseCPU::serialize(std::ostream &os) 412{ | 358} 359 360 361void 362BaseCPU::serialize(std::ostream &os) 363{ |
413 SERIALIZE_ARRAY(interrupts, TheISA::NumInterruptLevels); 414 SERIALIZE_SCALAR(intstatus); | 364 interrupts.serialize(os); |
415} 416 417void 418BaseCPU::unserialize(Checkpoint *cp, const std::string §ion) 419{ | 365} 366 367void 368BaseCPU::unserialize(Checkpoint *cp, const std::string §ion) 369{ |
420 UNSERIALIZE_ARRAY(interrupts, TheISA::NumInterruptLevels); 421 UNSERIALIZE_SCALAR(intstatus); | 370 interrupts.unserialize(cp, section); |
422} 423 424#endif // FULL_SYSTEM 425 426void 427BaseCPU::traceFunctionsInternal(Addr pc) 428{ 429 if (!debugSymbolTable) --- 25 unchanged lines hidden --- | 371} 372 373#endif // FULL_SYSTEM 374 375void 376BaseCPU::traceFunctionsInternal(Addr pc) 377{ 378 if (!debugSymbolTable) --- 25 unchanged lines hidden --- |