mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
Rename up_addrenv_assign() to up_addrenv_clone() and generalize its arguments so that can be used for other purposes
This commit is contained in:
@@ -48,11 +48,12 @@
|
|||||||
* address environment
|
* address environment
|
||||||
* up_addrenv_select - Instantiate an address environment
|
* up_addrenv_select - Instantiate an address environment
|
||||||
* up_addrenv_restore - Restore an address environment
|
* up_addrenv_restore - Restore an address environment
|
||||||
* up_addrenv_assign - Assign an address environment to a group
|
* up_addrenv_clone - Copy an address environment from one location to
|
||||||
|
* another.
|
||||||
*
|
*
|
||||||
* Higher-level interfaces used by the tasking logic. These interfaces are
|
* Higher-level interfaces used by the tasking logic. These interfaces are
|
||||||
* used by the functions in sched/ and all operate on the thread which whose
|
* used by the functions in sched/ and all operate on the thread which whose
|
||||||
* group been assigned an address environment by up_addrenv_assign().
|
* group been assigned an address environment by up_addrenv_clone().
|
||||||
*
|
*
|
||||||
* up_addrenv_attach - Clone the address environment assigned to one TCB
|
* up_addrenv_attach - Clone the address environment assigned to one TCB
|
||||||
* to another. This operation is done when a pthread
|
* to another. This operation is done when a pthread
|
||||||
@@ -661,30 +662,31 @@ int up_addrenv_restore(FAR const save_addrenv_t *oldenv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_addrenv_assign
|
* Name: up_addrenv_clone
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Assign an address environment to a new task group.
|
* Duplicate an address environment. This does not copy the underlying
|
||||||
|
* memory, only the representation that can be used to instantiate that
|
||||||
|
* memory as an address environment.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* addrenv - The representation of the task address environment previously
|
* src - The address environment to be copied.
|
||||||
* returned by up_addrenv_create().
|
* dest - The location to receive the copied address environment.
|
||||||
* group - The new task group to receive the address environment.
|
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) on success; a negated errno value on failure.
|
* Zero (OK) on success; a negated errno value on failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int up_addrenv_assign(FAR const group_addrenv_t *addrenv,
|
int up_addrenv_clone(FAR const group_addrenv_t *src,
|
||||||
FAR struct task_group_s *group)
|
FAR group_addrenv_t *dest)
|
||||||
{
|
{
|
||||||
DEBUGASSERT(addrenv && group);
|
bvdbg("src=%p dest=%p\n", src, dest);
|
||||||
bvdbg("addrenv=%p group->addrenv=%p\n", addrenv, &group->addrenv);
|
DEBUGASSERT(src && dest);
|
||||||
|
|
||||||
/* Just copy the address environment into the group */
|
/* Just copy the address environment from the source to the destination */
|
||||||
|
|
||||||
memcpy(&group->addrenv, addrenv, sizeof(group_addrenv_t));
|
memcpy(dest, src, sizeof(group_addrenv_t));
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -192,11 +192,12 @@ return g_physhandle ? OK : -ENOMEM;
|
|||||||
* address environment
|
* address environment
|
||||||
* up_addrenv_select - Instantiate an address environment
|
* up_addrenv_select - Instantiate an address environment
|
||||||
* up_addrenv_restore - Restore an address environment
|
* up_addrenv_restore - Restore an address environment
|
||||||
* up_addrenv_assign - Assign an address environment to a group
|
* up_addrenv_clone - Copy an address environment from one location to
|
||||||
|
* another.
|
||||||
*
|
*
|
||||||
* Higher-level interfaces used by the tasking logic. These interfaces are
|
* Higher-level interfaces used by the tasking logic. These interfaces are
|
||||||
* used by the functions in sched/ and all operate on the thread which whose
|
* used by the functions in sched/ and all operate on the thread which whose
|
||||||
* group been assigned an address environment by up_addrenv_assign().
|
* group been assigned an address environment by up_addrenv_clone().
|
||||||
*
|
*
|
||||||
* up_addrenv_attach - Clone the address environment assigned to one TCB
|
* up_addrenv_attach - Clone the address environment assigned to one TCB
|
||||||
* to another. This operation is done when a pthread
|
* to another. This operation is done when a pthread
|
||||||
@@ -457,33 +458,32 @@ int up_addrenv_restore(FAR const save_addrenv_t *oldenv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_addrenv_assign
|
* Name: up_addrenv_clone
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Assign an address environment to a task group.
|
* Duplicate an address environment. This does not copy the underlying
|
||||||
|
* memory, only the representation that can be used to instantiate that
|
||||||
|
* memory as an address environment.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* addrenv - The representation of the task address environment previously
|
* src - The address environment to be copied.
|
||||||
* returned by up_addrenv_create().
|
* dest - The location to receive the copied address environment.
|
||||||
* group - The task group to receive the address environment.
|
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) on success; a negated errno value on failure.
|
* Zero (OK) on success; a negated errno value on failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int up_addrenv_assign(FAR const group_addrenv_t *addrenv,
|
int up_addrenv_clone(FAR const group_addrenv_t *src,
|
||||||
FAR struct task_group_s *group)
|
FAR group_addrenv_t *dest);
|
||||||
{
|
{
|
||||||
/* Make sure that there is no address environment in place on this TCB */
|
DEBUGASSERT(src && dest);
|
||||||
|
|
||||||
DEBUGASSERT(addrenv && group->addrenv == NULL);
|
/* Copy the CBR structure. This is an atomic operation so no special
|
||||||
|
* precautions should be needed.
|
||||||
/* Save the CBR structure in the group. This is an atomic operation so no
|
|
||||||
* special precautions should be needed.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
group->addrenv = *addrenv;
|
*dest = *src;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user