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.
This commit is contained in:
parent
ac575a9d82
commit
1d1837ee98
1 changed files with 6 additions and 5 deletions
|
@ -899,6 +899,12 @@ BaseDynInst<Impl>::readBytes(Addr addr, uint8_t *data,
|
||||||
this->setExecuted();
|
this->setExecuted();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fault != NoFault) {
|
||||||
|
// Return a fixed value to keep simulation deterministic even
|
||||||
|
// along misspeculated paths.
|
||||||
|
bzero(data, size);
|
||||||
|
}
|
||||||
|
|
||||||
if (traceData) {
|
if (traceData) {
|
||||||
traceData->setAddr(addr);
|
traceData->setAddr(addr);
|
||||||
}
|
}
|
||||||
|
@ -913,11 +919,6 @@ BaseDynInst<Impl>::read(Addr addr, T &data, unsigned flags)
|
||||||
{
|
{
|
||||||
Fault fault = readBytes(addr, (uint8_t *)&data, sizeof(T), 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);
|
data = TheISA::gtoh(data);
|
||||||
|
|
||||||
if (traceData) {
|
if (traceData) {
|
||||||
|
|
Loading…
Reference in a new issue