summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/riscv/process.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/arch/riscv/process.cc b/src/arch/riscv/process.cc
index c1a67ec15..4eb3159af 100644
--- a/src/arch/riscv/process.cc
+++ b/src/arch/riscv/process.cc
@@ -217,7 +217,13 @@ RiscvLiveProcess::argsInit(int pageSize)
RiscvISA::IntReg
RiscvLiveProcess::getSyscallArg(ThreadContext *tc, int &i)
{
- return tc->readIntReg(SyscallArgumentRegs[i++]);
+ // RISC-V only has four system call argument registers by convention, so
+ // if a larger index is requested return 0
+ RiscvISA::IntReg retval = 0;
+ if (i < 4)
+ retval = tc->readIntReg(SyscallArgumentRegs[i]);
+ i++;
+ return retval;
}
void