diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2011-06-20 16:53:44 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2011-06-20 16:53:44 +0000 |
commit | 7e9a3acda9f7119d29296e8c18a213d512344ea8 (patch) | |
tree | 7f85077ac77c7a6fb5bea28ce9709851b822a97e /risugen | |
parent | 69c67857d0aa5e09f29ebc14ab02279ca131ac0c (diff) |
risugen: Avoid memory accesses escaping the data block
Avoid memory accesses escaping the data block by not generating
base addresses too close to either end.
Diffstat (limited to 'risugen')
-rwxr-xr-x | risugen | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -362,7 +362,7 @@ sub is_pow_of_2($) sub write_memblock_setup() { # Write code which sets up the memory block for loads and stores. - # We just need to set r0 to point to a block of at least 8K length + # We just need to set r0 to point to a block of at least 2K length # of random data, aligned to the maximum desired alignment (32). write_switch_to_arm(); @@ -439,7 +439,10 @@ sub write_get_offset() { # Emit code to get a random offset within the memory block, of the # right alignment, into r0 - my $offset = rand(2048) & ~($alignment_restriction - 1); + # We require the offset to not be within 256 bytes of either + # end, to (more than) allow for the worst case data transfer, which is + # 16 * 64 bit regs + my $offset = (rand(2048 - 512) + 256) & ~($alignment_restriction - 1); write_mov_ri(0, $offset); write_risuop($OP_GETMEMBLOCK); } |