Skip to content

Commit da9c7c4

Browse files
committed
LLEXT: fix detached section cache synchronisation
Detached sections are used in situ without being copied to or referenced from ext->mem[] LLEXT region arrays. Their caches must be synchronised accordingly. Signed-off-by: Guennadi Liakhovetski <[email protected]>
1 parent 55318b8 commit da9c7c4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

subsys/llext/llext_link.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,20 @@ int llext_link(struct llext_loader *ldr, struct llext *ext, const struct llext_l
465465
sys_cache_instr_invd_range(ext->mem[i], ext->mem_size[i]);
466466
}
467467
}
468+
469+
/* Detached section caches should be synchronized in place */
470+
if (ldr_parm->section_detached) {
471+
for (i = 0; i < ldr->sect_cnt; ++i) {
472+
elf_shdr_t *shdr = ldr->sect_hdrs + i;
473+
474+
if (ldr_parm->section_detached(shdr)) {
475+
void *base = llext_peek(ldr, shdr->sh_offset);
476+
477+
sys_cache_data_flush_range(base, shdr->sh_size);
478+
sys_cache_instr_invd_range(base, shdr->sh_size);
479+
}
480+
}
481+
}
468482
#endif
469483

470484
return 0;

0 commit comments

Comments
 (0)