Files
gem5/src/mem
Bobby R. Bruce d42eeb6b68 cpu: Explicitly define cache_line_size -> 64-bit unsigned int (#329)
While it's plausible to define the cache_line_size as a 32-bit unsigned
int, the use of cache_line_size is way out of its original scope.

cache_line_size has been used to produce an address mask, which masking
out the offset bits from an address. For example, [1], [2], [3], and
[4]. However, since the cache_line_size is an "unsigned int", the type
of the value is not guaranteed to be 64-bit long. Subsequently, the bit
twiddling hacks in [1], [2], [3], and [4] produce 32-bit mask, i.e.,
0x00000000FFFFFFC0.

This behavior at least caused a problem in LLSC in RISC-V [5], where the
load reservation (LR) relies on the mask to produce the cache block
address. Two distinct 64-bit addresses can be mapped to the same cache
block using the above mask.

This patch explicitly defines cache_line_size as a 64-bit unsigned int
so the cache block mask can be produced correctly for 64-bit addresses.

[1]
3bdcfd6f7a/src/cpu/simple/atomic.hh (L147)
[2]
3bdcfd6f7a/src/cpu/simple/timing.hh (L224)
[3]
3bdcfd6f7a/src/cpu/o3/lsq_unit.cc (L241)
[4]
3bdcfd6f7a/src/cpu/minor/lsq.cc (L1425)
[5]
3bdcfd6f7a/src/arch/riscv/isa.cc (L787)
2023-10-16 07:50:35 -07:00
..
2023-10-10 14:01:58 -07:00
2021-07-01 19:08:24 +00:00
2021-07-01 19:08:24 +00:00
2021-07-01 19:08:24 +00:00
2021-07-01 19:08:24 +00:00
2021-07-01 19:08:24 +00:00
2021-07-01 19:08:24 +00:00
2021-07-01 19:08:24 +00:00
2023-08-19 22:50:53 +00:00
2021-07-07 21:37:15 +00:00
2021-07-01 19:08:24 +00:00
2022-10-31 01:05:16 +00:00
2021-07-01 19:08:24 +00:00