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:
parent
cb8e081dba
commit
e8094292e3
@ -48,11 +48,12 @@
|
||||
* address environment
|
||||
* up_addrenv_select - Instantiate 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
|
||||
* 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
|
||||
* 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:
|
||||
* 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:
|
||||
* addrenv - The representation of the task address environment previously
|
||||
* returned by up_addrenv_create().
|
||||
* group - The new task group to receive the address environment.
|
||||
* src - The address environment to be copied.
|
||||
* dest - The location to receive the copied address environment.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_addrenv_assign(FAR const group_addrenv_t *addrenv,
|
||||
FAR struct task_group_s *group)
|
||||
int up_addrenv_clone(FAR const group_addrenv_t *src,
|
||||
FAR group_addrenv_t *dest)
|
||||
{
|
||||
DEBUGASSERT(addrenv && group);
|
||||
bvdbg("addrenv=%p group->addrenv=%p\n", addrenv, &group->addrenv);
|
||||
bvdbg("src=%p dest=%p\n", src, dest);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -192,11 +192,12 @@ return g_physhandle ? OK : -ENOMEM;
|
||||
* address environment
|
||||
* up_addrenv_select - Instantiate 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
|
||||
* 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
|
||||
* 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:
|
||||
* 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:
|
||||
* addrenv - The representation of the task address environment previously
|
||||
* returned by up_addrenv_create().
|
||||
* group - The task group to receive the address environment.
|
||||
* src - The address environment to be copied.
|
||||
* dest - The location to receive the copied address environment.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_addrenv_assign(FAR const group_addrenv_t *addrenv,
|
||||
FAR struct task_group_s *group)
|
||||
int up_addrenv_clone(FAR const group_addrenv_t *src,
|
||||
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);
|
||||
|
||||
/* Save the CBR structure in the group. This is an atomic operation so no
|
||||
* special precautions should be needed.
|
||||
/* Copy the CBR structure. This is an atomic operation so no special
|
||||
* precautions should be needed.
|
||||
*/
|
||||
|
||||
group->addrenv = *addrenv;
|
||||
*dest = *src;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user