llext: flush dcache in the llext memory range
On architectures that have separate data and instruction caches, such as the Cortex-M7, it is required to flush the reloc changes to the actual RAM storage before trying to execute any code from the newly loaded llext. Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This commit is contained in:
parent
e96b713caf
commit
1732177530
1 changed files with 10 additions and 0 deletions
|
|
@ -11,6 +11,7 @@
|
|||
#include <zephyr/llext/loader.h>
|
||||
#include <zephyr/llext/llext.h>
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/cache.h>
|
||||
|
||||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(llext, CONFIG_LLEXT_LOG_LEVEL);
|
||||
|
|
@ -776,6 +777,15 @@ static int llext_link(struct llext_loader *ldr, struct llext *ext, bool do_local
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CACHE_MANAGEMENT
|
||||
/* Make sure changes to ext sections are flushed to RAM */
|
||||
for (i = 0; i < LLEXT_MEM_COUNT; ++i) {
|
||||
if (ext->mem[i]) {
|
||||
arch_dcache_flush_range(ext->mem[i], ext->mem_size[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue