From bf83d82d2d2a52bfb2046a761db7837608f09faf Mon Sep 17 00:00:00 2001 From: Marek Materzok Date: Sun, 5 Nov 2023 22:11:14 +0100 Subject: [PATCH] Fix build, for real this time (#502) --- test/regression/memory.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/test/regression/memory.py b/test/regression/memory.py index 9b26209f4..f1640f71a 100644 --- a/test/regression/memory.py +++ b/test/regression/memory.py @@ -160,17 +160,23 @@ def load_segment(segment: Segment, *, disable_write_protection: bool = False) -> if flags_raw & P_FLAGS.PF_X: flags |= SegmentFlags.EXECUTABLE + config = CoreConfiguration() if flags_raw & P_FLAGS.PF_X: - # align only instruction section to full icache lines - align_bits = CoreConfiguration().icache_block_size_bits + # align instruction section to full icache lines + align_bits = config.icache_block_size_bits + # workaround for fetching/stalling issue + extend_end = 2**config.icache_block_size_bits + else: + align_bits = 0 + extend_end = 0 - align_data_front = seg_start - align_down_to_power_of_two(seg_start, align_bits) - align_data_back = align_to_power_of_two(seg_end, align_bits) - seg_end + align_data_front = seg_start - align_down_to_power_of_two(seg_start, align_bits) + align_data_back = align_to_power_of_two(seg_end, align_bits) - seg_end + extend_end - data = b"\x00" * align_data_front + data + b"\x00" * align_data_back + data = b"\x00" * align_data_front + data + b"\x00" * align_data_back - seg_start = align_down_to_power_of_two(seg_start, align_bits) - seg_end = align_to_power_of_two(seg_end, align_bits) + seg_start = align_down_to_power_of_two(seg_start, align_bits) + seg_end = align_to_power_of_two(seg_end, align_bits) + extend_end return RandomAccessMemory(range(seg_start, seg_end), flags, data)