summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2007-07-26 22:13:14 -0700
committerGabe Black <gblack@eecs.umich.edu>2007-07-26 22:13:14 -0700
commitd1e533a1e243b75b3257e2f96deb385a3b10e09b (patch)
tree5cde70506a663c83efceced11273cca47fed9586 /src/sim
parent876849724d0e5a990018dc025a8166c5131be567 (diff)
downloadgem5-d1e533a1e243b75b3257e2f96deb385a3b10e09b.tar.xz
X86: Fix argument register indexing.
Code was assuming that all argument registers followed in order from ArgumentReg0. There is now an ArgumentReg array which is indexed to find the right index. There is a constant, NumArgumentRegs, which can be used to protect against using an invalid ArgumentReg. --HG-- extra : convert_revision : f448a3ca4d6adc3fc3323562870f70eec05a8a1f
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/process.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/sim/process.cc b/src/sim/process.cc
index c556ade12..7343039df 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -405,8 +405,9 @@ LiveProcess::argsInit(int intSize, int pageSize)
copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem);
copyStringArray(envp, envp_array_base, env_data_base, initVirtMem);
- threadContexts[0]->setIntReg(ArgumentReg0, argc);
- threadContexts[0]->setIntReg(ArgumentReg1, argv_array_base);
+ assert(NumArgumentRegs >= 2);
+ threadContexts[0]->setIntReg(ArgumentReg[0], argc);
+ threadContexts[0]->setIntReg(ArgumentReg[1], argv_array_base);
threadContexts[0]->setIntReg(StackPointerReg, stack_min);
Addr prog_entry = objFile->entryPoint();