From: Ali Saidi Date: Thu, 2 Mar 2006 22:49:12 +0000 (-0500) Subject: Fix fault handling, dereferincing a null pointer is bad. X-Git-Tag: m5_2.0_beta1~87^2~39^2~3 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0fed64a6a47a62a94a53c5f41ac89b34a2fd6786;p=gem5.git Fix fault handling, dereferincing a null pointer is bad. --HG-- extra : convert_revision : a4f658bfd39b7f1d219ad8929b8f45457f49299f --- diff --git a/cpu/simple/cpu.cc b/cpu/simple/cpu.cc index d826c589e..ca5d54694 100644 --- a/cpu/simple/cpu.cc +++ b/cpu/simple/cpu.cc @@ -347,12 +347,12 @@ SimpleCPU::copySrcTranslate(Addr src) // translate to physical address Fault fault = xc->translateDataReadReq(memReq); - assert(!fault->isAlignmentFault()); - if (fault == NoFault) { xc->copySrcAddr = src; xc->copySrcPhysAddr = memReq->paddr + offset; } else { + assert(!fault->isAlignmentFault()); + xc->copySrcAddr = 0; xc->copySrcPhysAddr = 0; } @@ -382,8 +382,6 @@ SimpleCPU::copy(Addr dest) // translate to physical address Fault fault = xc->translateDataWriteReq(memReq); - assert(!fault->isAlignmentFault()); - if (fault == NoFault) { Addr dest_addr = memReq->paddr + offset; // Need to read straight from memory since we have more than 8 bytes. @@ -402,6 +400,9 @@ SimpleCPU::copy(Addr dest) dcacheInterface->access(memReq); } } + else + assert(!fault->isAlignmentFault()); + return fault; }