cast sizeof(MachInst) to Addr before generating a mask
authorAli Saidi <saidi@eecs.umich.edu>
Fri, 1 Jun 2007 18:16:58 +0000 (14:16 -0400)
committerAli Saidi <saidi@eecs.umich.edu>
Fri, 1 Jun 2007 18:16:58 +0000 (14:16 -0400)
--HG--
extra : convert_revision : 1ae34a069bbd997a8f888f69415fbeaaf4ade0b3

src/cpu/simple/base.cc

index 5e078c502df3fb29beb6b726fcb5d790a8ed954b..da50a3eb0a42057d6068ca86326b408201a29e39 100644 (file)
@@ -329,7 +329,7 @@ BaseSimpleCPU::checkForInterrupts()
 Fault
 BaseSimpleCPU::setupFetchRequest(Request *req)
 {
-    uint64_t threadPC = thread->readPC();
+    Addr threadPC = thread->readPC();
 
     // set up memory request for instruction fetch
 #if ISA_HAS_DELAY_SLOT
@@ -340,9 +340,9 @@ BaseSimpleCPU::setupFetchRequest(Request *req)
             thread->readNextPC());
 #endif
 
-    const Addr PCMask = ~(sizeof(MachInst) - 1);
-    Addr fetchPC = thread->readPC() + fetchOffset;
-    req->setVirt(0, fetchPC & PCMask, sizeof(MachInst), 0, threadPC());
+    const Addr PCMask = ~((Addr)sizeof(MachInst) - 1);
+    Addr fetchPC = threadPC + fetchOffset;
+    req->setVirt(0, fetchPC & PCMask, sizeof(MachInst), 0, threadPC);
 
     Fault fault = thread->translateInstReq(req);
 
@@ -380,7 +380,7 @@ BaseSimpleCPU::preExecute()
         //This should go away once the constructor can be set up properly
         predecoder.setTC(thread->getTC());
         //If more fetch data is needed, pass it in.
-        const Addr PCMask = ~(sizeof(MachInst) - 1);
+        const Addr PCMask = ~((Addr)sizeof(MachInst) - 1);
         if(predecoder.needMoreBytes())
             predecoder.moreBytes((thread->readPC() & PCMask) + fetchOffset,
                     0, inst);