sched/addrenv: Remove up_addrenv_restore

The function is not relevant any longer, remove it. Also remove
save_addrenv_t, the parameter taken by up_addrenv_restore.

Implement addrenv_select() / addrenv_restore() to handle the temporary
instantiation of address environments, e.g. when a process is being
created.
This commit is contained in:
Ville Juven
2023-01-27 13:45:03 +02:00
committed by Xiang Xiao
parent 09e7987121
commit f4b82b6405
29 changed files with 213 additions and 424 deletions
+42 -11
View File
@@ -365,7 +365,7 @@ int addrenv_switch(FAR struct tcb_s *tcb);
****************************************************************************/
int addrenv_attach(FAR struct tcb_s *tcb,
FAR const struct arch_addrenv_s *addrenv);
FAR const struct addrenv_s *addrenv);
/****************************************************************************
* Name: addrenv_join
@@ -405,10 +405,11 @@ int addrenv_join(FAR struct tcb_s *ptcb, FAR struct tcb_s *tcb);
int addrenv_leave(FAR struct tcb_s *tcb);
/****************************************************************************
* Name: addrenv_take
* Name: addrenv_select
*
* Description:
* Take a reference to an address environment.
* Temporarily select a different address environment for the currently
* running process.
*
* Input Parameters:
* addrenv - The address environment.
@@ -420,21 +421,54 @@ int addrenv_leave(FAR struct tcb_s *tcb);
*
****************************************************************************/
int addrenv_select(FAR struct addrenv_s *addrenv);
/****************************************************************************
* Name: addrenv_restore
*
* Description:
* Switch back to the procces's own address environment.
*
* Input Parameters:
* None
*
* Returned Value:
* This is a NuttX internal function so it follows the convention that
* 0 (OK) is returned on success and a negated errno is returned on
* failure.
*
****************************************************************************/
int addrenv_restore(void);
/****************************************************************************
* Name: addrenv_take
*
* Description:
* Take a reference to an address environment.
*
* Input Parameters:
* addrenv - The address environment.
*
* Returned Value:
* None.
*
****************************************************************************/
void addrenv_take(FAR struct addrenv_s *addrenv);
/****************************************************************************
* Name: addrenv_give
*
* Description:
* Give back a reference to an address environment.
* Give back a reference to an address environment, obtaining the resulting
* reference counter as returned value.
*
* Input Parameters:
* addrenv - The address environment.
*
* Returned Value:
* This is a NuttX internal function so it follows the convention that
* 0 (OK) is returned on success and a negated errno is returned on
* failure.
* Remaining reference count.
*
****************************************************************************/
@@ -452,9 +486,7 @@ int addrenv_give(FAR struct addrenv_s *addrenv);
* no: The address environment can be dropped at once
*
* Returned Value:
* This is a NuttX internal function so it follows the convention that
* 0 (OK) is returned on success and a negated errno is returned on
* failure.
* None.
*
****************************************************************************/
@@ -478,7 +510,6 @@ void addrenv_drop(FAR struct addrenv_s *addrenv, bool deferred);
* address environment
* up_addrenv_heapsize - Returns the size of the initial heap allocation.
* up_addrenv_select - Instantiate an address environment
* up_addrenv_restore - Restore an address environment
* up_addrenv_clone - Copy an address environment from one location to
* another.
*
+1 -30
View File
@@ -789,7 +789,6 @@ bool up_textheap_heapmember(FAR void *p);
* address environment
* up_addrenv_heapsize - Returns the size of the initial heap allocation.
* up_addrenv_select - Instantiate an address environment
* up_addrenv_restore - Restore an address environment
* up_addrenv_clone - Copy an address environment from one location to
* another.
*
@@ -1006,12 +1005,6 @@ ssize_t up_addrenv_heapsize(FAR const arch_addrenv_t *addrenv);
* Input Parameters:
* addrenv - The representation of the task address environment previously
* returned by up_addrenv_create.
* oldenv
* The address environment that was in place before up_addrenv_select().
* This may be used with up_addrenv_restore() to restore the original
* address environment that was in place before up_addrenv_select() was
* called. Note that this may be a task agnostic, platform-specific
* representation that may or may not be different from arch_addrenv_t.
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
@@ -1019,29 +1012,7 @@ ssize_t up_addrenv_heapsize(FAR const arch_addrenv_t *addrenv);
****************************************************************************/
#ifdef CONFIG_ARCH_ADDRENV
int up_addrenv_select(FAR const arch_addrenv_t *addrenv,
FAR save_addrenv_t *oldenv);
#endif
/****************************************************************************
* Name: up_addrenv_restore
*
* Description:
* After an address environment has been temporarily instantiated by
* up_addrenv_select(), this function may be called to restore the
* original address environment.
*
* Input Parameters:
* oldenv - The platform-specific representation of the address environment
* previously returned by up_addrenv_select.
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
#ifdef CONFIG_ARCH_ADDRENV
int up_addrenv_restore(FAR const save_addrenv_t *oldenv);
int up_addrenv_select(FAR const arch_addrenv_t *addrenv);
#endif
/****************************************************************************
+2 -2
View File
@@ -86,7 +86,7 @@ struct binary_s
* used to manage the tasks address space.
*/
arch_addrenv_t addrenv; /* Task group address environment */
addrenv_t addrenv; /* Address environment */
#endif
size_t mapsize; /* Size of the mapped address region (needed for munmap) */
@@ -261,7 +261,7 @@ int unload_module(FAR struct binary_s *bin);
*
****************************************************************************/
int exec_module(FAR const struct binary_s *binp,
int exec_module(FAR struct binary_s *binp,
FAR const char *filename, FAR char * const *argv,
FAR char * const *envp);
+1 -4
View File
@@ -119,13 +119,10 @@ struct elf_loadinfo_s
*
* addrenv - This is the handle created by up_addrenv_create() that can be
* used to manage the tasks address space.
* oldenv - This is a value returned by up_addrenv_select() that must be
* used to restore the current address environment.
*/
#ifdef CONFIG_ARCH_ADDRENV
arch_addrenv_t addrenv; /* Task group address environment */
save_addrenv_t oldenv; /* Saved address environment */
addrenv_t addrenv; /* Address environment */
#endif
uint16_t symtabidx; /* Symbol table section index */
+1 -4
View File
@@ -84,13 +84,10 @@ struct nxflat_loadinfo_s
*
* addrenv - This is the handle created by up_addrenv_create() that can be
* used to manage the tasks address space.
* oldenv - This is a value returned by up_addrenv_select() that must be
* used to restore the current address environment.
*/
#ifdef CONFIG_ARCH_ADDRENV
arch_addrenv_t addrenv; /* Task group address environment */
save_addrenv_t oldenv; /* Saved address environment */
addrenv_t addrenv; /* Address environment */
#endif
/* File descriptors */