mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
mm/mm_map: Give the mm_map as parameter to the mm_map functions
This way the mappings can be modified for any vm area, not only the process that is running. Why? This allows mapping pages to kernel dynamically, this functionality will be presented later.
This commit is contained in:
+5
-6
@@ -171,9 +171,8 @@ void mm_map_destroy(FAR struct mm_map_s *mm)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int mm_map_add(FAR struct mm_map_entry_s *entry)
|
||||
int mm_map_add(FAR struct mm_map_s *mm, FAR struct mm_map_entry_s *entry)
|
||||
{
|
||||
FAR struct mm_map_s *mm = get_current_mm();
|
||||
FAR struct mm_map_entry_s *new_entry;
|
||||
int ret;
|
||||
|
||||
@@ -214,10 +213,9 @@ int mm_map_add(FAR struct mm_map_entry_s *entry)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct mm_map_entry_s *mm_map_next(
|
||||
FAR struct mm_map_entry_s *mm_map_next(FAR struct mm_map_s *mm,
|
||||
FAR const struct mm_map_entry_s *entry)
|
||||
{
|
||||
FAR struct mm_map_s *mm = get_current_mm();
|
||||
FAR struct mm_map_entry_s *next_entry = NULL;
|
||||
|
||||
if (nxrmutex_lock(&mm->mm_map_mutex) == OK)
|
||||
@@ -246,9 +244,10 @@ FAR struct mm_map_entry_s *mm_map_next(
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct mm_map_entry_s *mm_map_find(FAR const void *vaddr, size_t length)
|
||||
FAR struct mm_map_entry_s *mm_map_find(FAR struct mm_map_s *mm,
|
||||
FAR const void *vaddr,
|
||||
size_t length)
|
||||
{
|
||||
FAR struct mm_map_s *mm = get_current_mm();
|
||||
FAR struct mm_map_entry_s *found_entry = NULL;
|
||||
|
||||
if (nxrmutex_lock(&mm->mm_map_mutex) == OK)
|
||||
|
||||
+1
-1
@@ -271,7 +271,7 @@ FAR void *shmat(int shmid, FAR const void *shmaddr, int shmflg)
|
||||
entry.munmap = munmap_shm;
|
||||
entry.priv.i = shmid;
|
||||
|
||||
ret = mm_map_add(&entry);
|
||||
ret = mm_map_add(get_current_mm(), &entry);
|
||||
if (ret < 0)
|
||||
{
|
||||
shmerr("ERROR: mm_map_add() failed\n");
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ int shmdt(FAR const void *shmaddr)
|
||||
* shmaddr. The mapping is matched with just shmaddr == map->vaddr.
|
||||
*/
|
||||
|
||||
entry = mm_map_find(shmaddr, 1);
|
||||
entry = mm_map_find(get_current_mm(), shmaddr, 1);
|
||||
if (entry && entry->vaddr == shmaddr)
|
||||
{
|
||||
DEBUGASSERT(entry->munmap);
|
||||
|
||||
Reference in New Issue
Block a user