O3CPU: Add a hack to ensure that nextPC is set correctly after syscalls.
authorKevin Lim <ktlim@umich.edu>
Fri, 26 Sep 2008 14:44:06 +0000 (07:44 -0700)
committerKevin Lim <ktlim@umich.edu>
Fri, 26 Sep 2008 14:44:06 +0000 (07:44 -0700)
Just check CPU's nextPC before and after syscall and if it changes,
update this instruction's nextPC because the syscall must have changed
the nextPC.

src/cpu/o3/alpha/dyn_inst_impl.hh

index 6dfe0ccdd3bd4b13db63aba7e969a4c7f197cb30..610a313cfcd39e897480c4752a63c7100e36c076 100644 (file)
@@ -161,7 +161,15 @@ template <class Impl>
 void
 AlphaDynInst<Impl>::syscall(int64_t callnum)
 {
+    // HACK: check CPU's nextPC before and after syscall. If it
+    // changes, update this instruction's nextPC because the syscall
+    // must have changed the nextPC.
+    Addr cpu_next_pc = this->cpu->readNextPC(this->threadNumber);
     this->cpu->syscall(callnum, this->threadNumber);
+    Addr new_next_pc = this->cpu->readNextPC(this->threadNumber);
+    if (cpu_next_pc != new_next_pc) {
+        this->setNextPC(new_next_pc);
+    }
 }
 #endif