sim: fix out-of-bounds error in syscall_desc
authorBrandon Potter <brandon.potter@amd.com>
Fri, 17 Feb 2017 17:01:50 +0000 (12:01 -0500)
committerBrandon Potter <brandon.potter@amd.com>
Fri, 17 Feb 2017 17:01:50 +0000 (12:01 -0500)
src/sim/syscall_desc.cc

index 34fb43dae2e5bc7e571ce51733b35afa42427f55..9251b1c144ad0240d5fe5d21b8e4c1409f7bcfc6 100644 (file)
@@ -49,10 +49,11 @@ SyscallDesc::doSyscall(int callnum, LiveProcess *process, ThreadContext *tc)
     /**
      * Step through the first six parameters for the system call and
      * retrieve their values. Note that index is incremented as a
-     * side-effect of the calling method.
+     * side-effect of the getSyscallArg method which is why the LHS
+     * needs the "-1".
      */
     for (int index = 0; index < 6; )
-        arg[index] = process->getSyscallArg(tc, index);
+        arg[index - 1] = process->getSyscallArg(tc, index);
 
     /**
      * Linux supports up to six system call arguments through registers