riscv: Fix crash when syscall argument reg index is too high
Review Request #3780 - Created Jan. 12, 2017 and submitted
| Information | |
|---|---|
| Alec Roelke | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 11795:3ac8305dbf60 --------------------------- riscv: Fix crash when syscall argument reg index is too high By default, doSyscall gets the values of six registers to be used for system call arguments. RISC-V, by convention, only has four. Because RISC-V's implementation of these indices is as arrays of integers rather than as base indices plus offsets, trying to get the fifth argument register's value will cause a crash. This patch fixes that by returning 0 for any index higher than 3.
Posted (Jan. 18, 2017, 8:06 a.m.)
-
src/arch/riscv/process.cc (Diff revision 1) -
Two comments:
1. Shouldn't this at least have a warning? If the syscall arg register > 3 there is definitely a bug, right?
2. Can you return "0" instead of the last register? I think that's a better failover case.
Review request changed
Updated (Jan. 18, 2017, 9:39 a.m.)
Description: |
|
|||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+7 -1) |
Ship It!
Ship It!
