From: Gabe Black Date: Sun, 11 Mar 2007 00:29:31 +0000 (-0500) Subject: Fix bounds check for the cwp X-Git-Tag: m5_2.0_beta3~118^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7e363e14f7f348d8b10fa020e572867659f7e6c6;p=gem5.git Fix bounds check for the cwp --HG-- extra : convert_revision : 097e6b0c80d71417329b2a4cd118046aa5ed777a --- diff --git a/src/arch/sparc/miscregfile.cc b/src/arch/sparc/miscregfile.cc index 20bc4ae5d..ac30afde9 100644 --- a/src/arch/sparc/miscregfile.cc +++ b/src/arch/sparc/miscregfile.cc @@ -654,7 +654,12 @@ void MiscRegFile::setReg(int miscReg, #endif return; case MISCREG_CWP: - new_val = val > NWindows ? NWindows - 1 : val; + new_val = val >= NWindows ? NWindows - 1 : val; + if (val >= NWindows) { + new_val = NWindows - 1; + warn("Attempted to set the CWP to %d with NWindows = %d\n", + val, NWindows); + } tc->changeRegFileContext(CONTEXT_CWP, new_val); break; case MISCREG_GL: