Alec Roelke has uploaded this change for review. (
https://gem5-review.googlesource.com/7061
Change subject: arch-riscv: Remove "magic" syscall number constant
......................................................................
arch-riscv: Remove "magic" syscall number constant
getSyscallArg() in RISC-V has an explicit check to make sure that the
register index is within the bounds of the system call register indices
vector. This patch fixes it so that it uses SyscallArgumentRegs.size()
rather than a "magic" constant that has to be updated every time
SyscallArgumentRegs is changed.
Change-Id: I2935d811177dc8028cb3df64b250ba997bc970d8
---
M src/arch/riscv/process.cc
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/arch/riscv/process.cc b/src/arch/riscv/process.cc
index 6fe935c..b4fe1ee 100644
--- a/src/arch/riscv/process.cc
+++ b/src/arch/riscv/process.cc
@@ -215,10 +215,10 @@
RiscvISA::IntReg
RiscvProcess::getSyscallArg(ThreadContext *tc, int &i)
{
- // RISC-V only has four system call argument registers by convention,
so
- // if a larger index is requested return 0
+ // If a larger index is requested than there are syscall argument
+ // registers, return 0
RiscvISA::IntReg retval = 0;
- if (i < 4)
+ if (i < SyscallArgumentRegs.size())
retval = tc->readIntReg(SyscallArgumentRegs[i]);
i++;
return retval;
--
To view, visit https://gem5-review.googlesource.com/7061
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2935d811177dc8028cb3df64b250ba997bc970d8
Gerrit-Change-Number: 7061
Gerrit-PatchSet: 1
Gerrit-Owner: Alec Roelke <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev