Skip to content

Commit

Permalink
mpu: fixing the rnr bug in SHM mapping
Browse files Browse the repository at this point in the history
same fix as dev mapping
  • Loading branch information
pthierry-ledger committed Nov 19, 2024
1 parent fac6454 commit 59cbc03
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions kernel/src/managers/memory/memory_mpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,17 @@ kstatus_t mgr_mm_map_shm(taskh_t tsk, shmh_t shm)
if (unlikely((status = mgr_task_get_layout_from_handle(tsk, &layout_tab)) != K_STATUS_OKAY)) {
goto err;
}
/**
* NOTE: here, we ask for the first empty field in task layout.
* This field id must be incremented of 2 (<<1) as the first region of th layout_tab
* correspond to region 2 (see kernel and task memory mapping) as the kernel has locked
* regions 0 and 1 for itself.
*/
if (unlikely((status = mpu_get_free_id(layout_tab, TASK_MAX_RESSOURCES_NUM, &mpu_cfg.id)) != K_STATUS_OKAY)) {
status = K_ERROR_BUSY;
goto err;
}
mpu_cfg.id += 2; /* as layout starts at task TXT, defined as reg2, it must be incremented */
mpu_cfg.addr = (uint32_t)shm_meta->baseaddr;
mpu_cfg.size = mpu_convert_size_to_region(shm_meta->size);

Expand Down

0 comments on commit 59cbc03

Please sign in to comment.