main.cc (2770:07a93a0da45b) main.cc (2797:b5f26b4eacef)
1/*
2 * Copyright (c) 2000-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;

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

57#include "base/time.hh"
58#include "cpu/base.hh"
59#include "cpu/smt.hh"
60#include "mem/mem_object.hh"
61#include "mem/port.hh"
62#include "sim/async.hh"
63#include "sim/builder.hh"
64#include "sim/host.hh"
1/*
2 * Copyright (c) 2000-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;

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

57#include "base/time.hh"
58#include "cpu/base.hh"
59#include "cpu/smt.hh"
60#include "mem/mem_object.hh"
61#include "mem/port.hh"
62#include "sim/async.hh"
63#include "sim/builder.hh"
64#include "sim/host.hh"
65#include "sim/serialize.hh"
65#include "sim/sim_events.hh"
66#include "sim/sim_exit.hh"
67#include "sim/sim_object.hh"
68#include "sim/stat_control.hh"
69#include "sim/stats.hh"
70#include "sim/root.hh"
71
72using namespace std;

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

516 pollQueue.service();
517 }
518 }
519 }
520
521 // not reached... only exit is return on SimLoopExitEvent
522}
523
66#include "sim/sim_events.hh"
67#include "sim/sim_exit.hh"
68#include "sim/sim_object.hh"
69#include "sim/stat_control.hh"
70#include "sim/stats.hh"
71#include "sim/root.hh"
72
73using namespace std;

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

517 pollQueue.service();
518 }
519 }
520 }
521
522 // not reached... only exit is return on SimLoopExitEvent
523}
524
525Event *
526createCountedQuiesce()
527{
528 return new CountedQuiesceEvent();
529}
530
531void
532cleanupCountedQuiesce(Event *counted_quiesce)
533{
534 CountedQuiesceEvent *event =
535 dynamic_cast<CountedQuiesceEvent *>(counted_quiesce);
536 if (event == NULL) {
537 fatal("Called cleanupCountedQuiesce() on an event that was not "
538 "a CountedQuiesceEvent.");
539 }
540 assert(event->getCount() == 0);
541 delete event;
542}
543
544void
545serializeAll()
546{
547 Serializable::serializeAll();
548}
549
550void
551unserializeAll()
552{
553 Serializable::unserializeAll();
554}
555
524/**
525 * Queue of C++ callbacks to invoke on simulator exit.
526 */
527CallbackQueue exitCallbacks;
528
529/**
530 * Register an exit callback.
531 */
532void
533registerExitCallback(Callback *callback)
534{
535 exitCallbacks.add(callback);
536}
537
556/**
557 * Queue of C++ callbacks to invoke on simulator exit.
558 */
559CallbackQueue exitCallbacks;
560
561/**
562 * Register an exit callback.
563 */
564void
565registerExitCallback(Callback *callback)
566{
567 exitCallbacks.add(callback);
568}
569
570BaseCPU *
571convertToBaseCPUPtr(SimObject *obj)
572{
573 BaseCPU *ptr = dynamic_cast<BaseCPU *>(obj);
574
575 if (ptr == NULL)
576 warn("Casting to BaseCPU pointer failed");
577 return ptr;
578}
579
538/**
539 * Do C++ simulator exit processing. Exported to SWIG to be invoked
540 * when simulator terminates via Python's atexit mechanism.
541 */
542void
543doExitCleanup()
544{
545 exitCallbacks.process();
546 exitCallbacks.clear();
547
548 cout.flush();
549
550 ParamContext::cleanupAllContexts();
551
552 // print simulation stats
553 Stats::DumpNow();
554}
580/**
581 * Do C++ simulator exit processing. Exported to SWIG to be invoked
582 * when simulator terminates via Python's atexit mechanism.
583 */
584void
585doExitCleanup()
586{
587 exitCallbacks.process();
588 exitCallbacks.clear();
589
590 cout.flush();
591
592 ParamContext::cleanupAllContexts();
593
594 // print simulation stats
595 Stats::DumpNow();
596}