Skip to content

Commit ae66b6e

Browse files
committed
[ot] hw/opentitan: ot_ibex_wrapper: fix destination address management.
The lower bits of the destination register were not ignored, which led to an invalid destination address. Signed-off-by: Emmanuel Blot <[email protected]> (cherry picked from commit eb96992)
1 parent c583c08 commit ae66b6e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

hw/opentitan/ot_ibex_wrapper_dj.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,8 +921,9 @@ static void ot_ibex_wrapper_dj_update_remap(OtIbexWrapperDjState *s, bool doi,
921921
}
922922
/* enable */
923923
uint32_t map_size = (-src_match_i & (src_match_i + 1u)) << 1u;
924-
uint32_t src_base = src_match_i & ~(map_size - 1u);
925-
uint32_t dst_base = remap_addr_i;
924+
uint32_t map_mask = ~(map_size - 1u);
925+
uint32_t src_base = src_match_i & map_mask;
926+
uint32_t dst_base = remap_addr_i & map_mask;
926927

927928
ot_ibex_wrapper_dj_remapper_destroy(s, slot);
928929
ot_ibex_wrapper_dj_remapper_create(s, slot, (hwaddr)dst_base,

hw/opentitan/ot_ibex_wrapper_eg.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,9 @@ static void ot_ibex_wrapper_eg_update_remap(OtIbexWrapperEgState *s, bool doi,
380380
}
381381
/* enable */
382382
uint32_t map_size = (-src_match_i & (src_match_i + 1u)) << 1u;
383-
uint32_t src_base = src_match_i & ~(map_size - 1u);
384-
uint32_t dst_base = remap_addr_i;
383+
uint32_t map_mask = ~(map_size - 1u);
384+
uint32_t src_base = src_match_i & map_mask;
385+
uint32_t dst_base = remap_addr_i & map_mask;
385386

386387
ot_ibex_wrapper_eg_remapper_destroy(s, slot);
387388
ot_ibex_wrapper_eg_remapper_create(s, slot, (hwaddr)dst_base,

0 commit comments

Comments
 (0)