From: Ali Saidi Date: Mon, 23 Aug 2010 16:18:39 +0000 (-0500) Subject: CPU: Set a default value when readBytes faults. X-Git-Tag: stable_2012_02_02~918 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1d1837ee9855f06af963f96948c33623bf905e7d;p=gem5.git CPU: Set a default value when readBytes faults. This was being done in read(), but if readBytes was called directly it wouldn't happen. Also, instead of setting the memory blob being read to -1 which would (I believe) require using memset with -1 as a parameter, this now uses bzero. It's hoped that it's more specialized behavior will make it slightly faster. --- diff --git a/src/cpu/base_dyn_inst.hh b/src/cpu/base_dyn_inst.hh index 3ecec0f0c..6ea00dd3d 100644 --- a/src/cpu/base_dyn_inst.hh +++ b/src/cpu/base_dyn_inst.hh @@ -899,6 +899,12 @@ BaseDynInst::readBytes(Addr addr, uint8_t *data, this->setExecuted(); } + if (fault != NoFault) { + // Return a fixed value to keep simulation deterministic even + // along misspeculated paths. + bzero(data, size); + } + if (traceData) { traceData->setAddr(addr); } @@ -913,11 +919,6 @@ BaseDynInst::read(Addr addr, T &data, unsigned flags) { Fault fault = readBytes(addr, (uint8_t *)&data, sizeof(T), flags); - if (fault != NoFault) { - // Return a fixed value to keep simulation deterministic even - // along misspeculated paths. - data = (T)-1; - } data = TheISA::gtoh(data); if (traceData) {