From 2d91e741e8ffc8ae3d40f1e849db87e69af7bfa9 Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Sat, 6 Feb 2016 17:21:20 -0800 Subject: x86: create function to check miscreg validity In the process of trying to get rid of an '== false' comparison, it became apparent that a slightly more involved solution was needed. Split this out into its own changeset since it's not a totally trivial local change like the others. --- src/arch/x86/utility.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/arch/x86/utility.cc') diff --git a/src/arch/x86/utility.cc b/src/arch/x86/utility.cc index cf6d2d910..cf3072348 100644 --- a/src/arch/x86/utility.cc +++ b/src/arch/x86/utility.cc @@ -217,11 +217,9 @@ copyMiscRegs(ThreadContext *src, ThreadContext *dest) // need to be considered while copying state. That will likely not be // true in the future. for (int i = 0; i < NUM_MISCREGS; ++i) { - if ( ( i != MISCREG_CR1 && - !(i > MISCREG_CR4 && i < MISCREG_CR8) && - !(i > MISCREG_CR8 && i <= MISCREG_CR15) ) == false) { + if (!isValidMiscReg(i)) continue; - } + dest->setMiscRegNoEffect(i, src->readMiscRegNoEffect(i)); } -- cgit v1.2.3