cpu.cc (13818:f0126488ef9e) cpu.cc (13831:4fba790d88be)
1/*
2 * Copyright (c) 2011-2012, 2014, 2016, 2017, 2019 ARM Limited
3 * Copyright (c) 2013 Advanced Micro Devices, Inc.
4 * All rights reserved
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating

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

684
685template <class Impl>
686void
687FullO3CPU<Impl>::activateThread(ThreadID tid)
688{
689 list<ThreadID>::iterator isActive =
690 std::find(activeThreads.begin(), activeThreads.end(), tid);
691
1/*
2 * Copyright (c) 2011-2012, 2014, 2016, 2017, 2019 ARM Limited
3 * Copyright (c) 2013 Advanced Micro Devices, Inc.
4 * All rights reserved
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating

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

684
685template <class Impl>
686void
687FullO3CPU<Impl>::activateThread(ThreadID tid)
688{
689 list<ThreadID>::iterator isActive =
690 std::find(activeThreads.begin(), activeThreads.end(), tid);
691
692 DPRINTF(O3CPU, "[tid:%i]: Calling activate thread.\n", tid);
692 DPRINTF(O3CPU, "[tid:%i] Calling activate thread.\n", tid);
693 assert(!switchedOut());
694
695 if (isActive == activeThreads.end()) {
693 assert(!switchedOut());
694
695 if (isActive == activeThreads.end()) {
696 DPRINTF(O3CPU, "[tid:%i]: Adding to active threads list\n",
696 DPRINTF(O3CPU, "[tid:%i] Adding to active threads list\n",
697 tid);
698
699 activeThreads.push_back(tid);
700 }
701}
702
703template <class Impl>
704void
705FullO3CPU<Impl>::deactivateThread(ThreadID tid)
706{
707 //Remove From Active List, if Active
708 list<ThreadID>::iterator thread_it =
709 std::find(activeThreads.begin(), activeThreads.end(), tid);
710
697 tid);
698
699 activeThreads.push_back(tid);
700 }
701}
702
703template <class Impl>
704void
705FullO3CPU<Impl>::deactivateThread(ThreadID tid)
706{
707 //Remove From Active List, if Active
708 list<ThreadID>::iterator thread_it =
709 std::find(activeThreads.begin(), activeThreads.end(), tid);
710
711 DPRINTF(O3CPU, "[tid:%i]: Calling deactivate thread.\n", tid);
711 DPRINTF(O3CPU, "[tid:%i] Calling deactivate thread.\n", tid);
712 assert(!switchedOut());
713
714 if (thread_it != activeThreads.end()) {
712 assert(!switchedOut());
713
714 if (thread_it != activeThreads.end()) {
715 DPRINTF(O3CPU,"[tid:%i]: Removing from active threads list\n",
715 DPRINTF(O3CPU,"[tid:%i] Removing from active threads list\n",
716 tid);
717 activeThreads.erase(thread_it);
718 }
719
720 fetch.deactivateThread(tid);
721 commit.deactivateThread(tid);
722}
723

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

785 BaseCPU::activateContext(tid);
786 }
787}
788
789template <class Impl>
790void
791FullO3CPU<Impl>::suspendContext(ThreadID tid)
792{
716 tid);
717 activeThreads.erase(thread_it);
718 }
719
720 fetch.deactivateThread(tid);
721 commit.deactivateThread(tid);
722}
723

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

785 BaseCPU::activateContext(tid);
786 }
787}
788
789template <class Impl>
790void
791FullO3CPU<Impl>::suspendContext(ThreadID tid)
792{
793 DPRINTF(O3CPU,"[tid: %i]: Suspending Thread Context.\n", tid);
793 DPRINTF(O3CPU,"[tid:%i] Suspending Thread Context.\n", tid);
794 assert(!switchedOut());
795
796 deactivateThread(tid);
797
798 // If this was the last thread then unschedule the tick event.
799 if (activeThreads.size() == 0) {
800 unscheduleTickEvent();
801 lastRunningCycle = curCycle();

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

807 BaseCPU::suspendContext(tid);
808}
809
810template <class Impl>
811void
812FullO3CPU<Impl>::haltContext(ThreadID tid)
813{
814 //For now, this is the same as deallocate
794 assert(!switchedOut());
795
796 deactivateThread(tid);
797
798 // If this was the last thread then unschedule the tick event.
799 if (activeThreads.size() == 0) {
800 unscheduleTickEvent();
801 lastRunningCycle = curCycle();

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

807 BaseCPU::suspendContext(tid);
808}
809
810template <class Impl>
811void
812FullO3CPU<Impl>::haltContext(ThreadID tid)
813{
814 //For now, this is the same as deallocate
815 DPRINTF(O3CPU,"[tid:%i]: Halt Context called. Deallocating\n", tid);
815 DPRINTF(O3CPU,"[tid:%i] Halt Context called. Deallocating\n", tid);
816 assert(!switchedOut());
817
818 deactivateThread(tid);
819 removeThread(tid);
820
821 updateCycleCounters(BaseCPU::CPU_STATE_SLEEP);
822}
823

--- 1108 unchanged lines hidden ---
816 assert(!switchedOut());
817
818 deactivateThread(tid);
819 removeThread(tid);
820
821 updateCycleCounters(BaseCPU::CPU_STATE_SLEEP);
822}
823

--- 1108 unchanged lines hidden ---