diff options
author | Robert Kovacsics <rmk35@cl.cam.ac.uk> | 2018-07-13 17:28:11 +0100 |
---|---|---|
committer | Kovacsics RĂ³bert <kovirobi@gmail.com> | 2018-07-19 13:43:35 +0000 |
commit | cbfe914f885cc54a3c8763c0ed6aed8e425d6357 (patch) | |
tree | 0c187b8c43cf1b2f148f509bdebcca9ecafc9357 /src/mem/request.hh | |
parent | ed427a3fcdf49a0ea0afa212c96240a04d4678d7 (diff) | |
download | gem5-cbfe914f885cc54a3c8763c0ed6aed8e425d6357.tar.xz |
mem: Fix off-by-one error in checkFunctional, and simplify it
There was an off-by-one error in the isRead() case, as `val_end` and
`func_end` pointed to the last byte to write to (not one past the last
byte), and thus `*_end - *_start` was not the length of the data to
memcpy.
This was correct in the case of
val_start >= func_start && val_end <= func_end
where `overlap_size = size`, but if it were (as the other cases
suggest) `overlap_size = val_end - val_start`, then it would also be
off by one.
Also, the isWrite() case catered for this.
I simplified the four ifs into one case which uses min/max (this is
how I spotted the inconsistency).
Change-Id: Ib5c5da084652e752f6baf1eec56b51b4f0f5c95c
Reviewed-on: https://gem5-review.googlesource.com/11750
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Diffstat (limited to 'src/mem/request.hh')
0 files changed, 0 insertions, 0 deletions