From 4a52a6ea2d84933a1ac8418fe2ba9222832a690d Mon Sep 17 00:00:00 2001 From: Brad Beckmann Date: Tue, 10 Jul 2012 22:51:53 -0700 Subject: [PATCH] cpu: added assertions to ensure the correct proxies are used --- src/cpu/thread_state.cc | 24 ++++++++++++++++++++++++ src/cpu/thread_state.hh | 6 +++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/cpu/thread_state.cc b/src/cpu/thread_state.cc index eda62dad1..d0f946989 100644 --- a/src/cpu/thread_state.cc +++ b/src/cpu/thread_state.cc @@ -122,6 +122,30 @@ ThreadState::initMemProxies(ThreadContext *tc) } } +PortProxy & +ThreadState::getPhysProxy() +{ + assert(FullSystem); + assert(physProxy != NULL); + return *physProxy; +} + +FSTranslatingPortProxy & +ThreadState::getVirtProxy() +{ + assert(FullSystem); + assert(virtProxy != NULL); + return *virtProxy; +} + +SETranslatingPortProxy & +ThreadState::getMemProxy() +{ + assert(!FullSystem); + assert(proxy != NULL); + return *proxy; +} + void ThreadState::profileClear() { diff --git a/src/cpu/thread_state.hh b/src/cpu/thread_state.hh index 995a870f5..d8dccc4ae 100644 --- a/src/cpu/thread_state.hh +++ b/src/cpu/thread_state.hh @@ -99,13 +99,13 @@ struct ThreadState { TheISA::Kernel::Statistics *getKernelStats() { return kernelStats; } - PortProxy &getPhysProxy() { return *physProxy; } + PortProxy &getPhysProxy(); - FSTranslatingPortProxy &getVirtProxy() { return *virtProxy; } + FSTranslatingPortProxy &getVirtProxy(); Process *getProcessPtr() { return process; } - SETranslatingPortProxy &getMemProxy() { return *proxy; } + SETranslatingPortProxy &getMemProxy(); /** Reads the number of instructions functionally executed and * committed. -- 2.30.2