Skip to content

Commit c996051

Browse files
lyakhkartben
authored andcommitted
llext: only invalidate instruction cache where needed
When preparing LLEXT ELF sections only invalidate instruction cache of executable sections. Also skip the step on platforms, managing cache at the application level. Signed-off-by: Guennadi Liakhovetski <[email protected]>
1 parent b7967f7 commit c996051

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

subsys/llext/llext_link.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,9 @@ int llext_link(struct llext_loader *ldr, struct llext *ext, const struct llext_l
562562
for (i = 0; i < LLEXT_MEM_COUNT; ++i) {
563563
if (ext->mem[i]) {
564564
sys_cache_data_flush_range(ext->mem[i], ext->mem_size[i]);
565-
sys_cache_instr_invd_range(ext->mem[i], ext->mem_size[i]);
565+
if (i == LLEXT_MEM_TEXT && !ldr_parm->pre_located) {
566+
sys_cache_instr_invd_range(ext->mem[i], ext->mem_size[i]);
567+
}
566568
}
567569
}
568570

@@ -575,7 +577,9 @@ int llext_link(struct llext_loader *ldr, struct llext *ext, const struct llext_l
575577
void *base = llext_peek(ldr, shdr->sh_offset);
576578

577579
sys_cache_data_flush_range(base, shdr->sh_size);
578-
sys_cache_instr_invd_range(base, shdr->sh_size);
580+
if (shdr->sh_flags & SHF_EXECINSTR && !ldr_parm->pre_located) {
581+
sys_cache_instr_invd_range(base, shdr->sh_size);
582+
}
579583
}
580584
}
581585
}

0 commit comments

Comments
 (0)