Skip to content

Commit

Permalink
llext: invalidate instruction cache after loading extension
Browse files Browse the repository at this point in the history
In addition to flushing the dcache, to ensure that the new code is
actually read by the CPU when loading an extension, the icache must
be invalidated as well.

Without this, some tests are failing in hardware because the CPU is
executing stale code from its instruction cache.

Fixes zephyrproject-rtos#70906 on arduino_giga_r1/stm32h747xx/m7.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
  • Loading branch information
pillo79 authored and carlescufi committed Apr 5, 2024
1 parent 97eb8bf commit 4867c56
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions subsys/llext/llext.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,7 @@ static int llext_link(struct llext_loader *ldr, struct llext *ext, bool do_local
for (i = 0; i < LLEXT_MEM_COUNT; ++i) {
if (ext->mem[i]) {
sys_cache_data_flush_range(ext->mem[i], ext->mem_size[i]);
sys_cache_instr_invd_range(ext->mem[i], ext->mem_size[i]);
}
}
#endif
Expand Down

0 comments on commit 4867c56

Please sign in to comment.