lib_manager: Set target memory flags after data loading from storage

Memory region must first be mapped as writable to allow data to be placed
there. Then the target access flags are set, e.g. read-only and executable.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
This commit is contained in:
Adrian Warecki 2024-02-26 13:08:01 +01:00 committed by Kai Vehmanen
parent 6bdbf7186e
commit dff7332326
1 changed files with 2 additions and 6 deletions

View File

@ -129,7 +129,7 @@ static int lib_manager_load_data_from_storage(void __sparse_cache *vma, void *s_
{ {
/* Region must be first mapped as writable in order to initialize its contents. */ /* Region must be first mapped as writable in order to initialize its contents. */
int ret = sys_mm_drv_map_region((__sparse_force void *)vma, POINTER_TO_UINT(NULL), size, int ret = sys_mm_drv_map_region((__sparse_force void *)vma, POINTER_TO_UINT(NULL), size,
flags | SYS_MM_MEM_PERM_RW); SYS_MM_MEM_PERM_RW);
if (ret < 0) if (ret < 0)
return ret; return ret;
@ -139,11 +139,7 @@ static int lib_manager_load_data_from_storage(void __sparse_cache *vma, void *s_
dcache_writeback_region(vma, size); dcache_writeback_region(vma, size);
/* TODO: Change attributes for memory to FLAGS. Implementation of required function in tlb return sys_mm_drv_update_region_flags((__sparse_force void *)vma, size, flags);
* driver is in progress.
* sys_mm_drv_update_region_flags(vma, size, flags);
*/
return 0;
} }
static int lib_manager_load_module(const uint32_t module_id, static int lib_manager_load_module(const uint32_t module_id,