sched/addrenv: Miscellaneous clean-up and fixes
- Remove the temporary "saved" variable when temporarily changing MMU mappings to access another process's memory. The fact that it has an address environment is enough to make the choice - Restore nxflat_addrenv_restore-macro. It was accidentally lost when the address environment handling was re-factored.
This commit is contained in:
parent
869aee6a78
commit
b982c1747b
|
@ -203,19 +203,16 @@ size_t up_check_tcbstack(struct tcb_s *tcb)
|
|||
size_t size;
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
bool saved = false;
|
||||
|
||||
if (tcb->addrenv_own != NULL)
|
||||
{
|
||||
addrenv_select(tcb->addrenv_own);
|
||||
saved = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
size = arm_stack_check(tcb->stack_base_ptr, tcb->adj_stack_size);
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
if (saved)
|
||||
if (tcb->addrenv_own != NULL)
|
||||
{
|
||||
addrenv_restore();
|
||||
}
|
||||
|
|
|
@ -159,12 +159,9 @@ size_t up_check_tcbstack(struct tcb_s *tcb)
|
|||
size_t size;
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
bool saved = false;
|
||||
|
||||
if (tcb->addrenv_own != NULL)
|
||||
{
|
||||
addrenv_select(tcb->addrenv_own);
|
||||
saved = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -172,7 +169,7 @@ size_t up_check_tcbstack(struct tcb_s *tcb)
|
|||
tcb->adj_stack_size);
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
if (saved)
|
||||
if (tcb->addrenv_own != NULL)
|
||||
{
|
||||
addrenv_restore();
|
||||
}
|
||||
|
|
|
@ -79,6 +79,25 @@ int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo,
|
|||
# define nxflat_addrenv_select(l) addrenv_select(&(l)->addrenv)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxflat_addrenv_restore
|
||||
*
|
||||
* Description:
|
||||
* Restore the address environment before nxflat_addrenv_select() was
|
||||
* called..
|
||||
*
|
||||
* Input Parameters:
|
||||
* loadinfo - Load state information
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
# define nxflat_addrenv_restore(l) addrenv_restore()
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxflat_addrenv_free
|
||||
*
|
||||
|
|
|
@ -59,9 +59,6 @@
|
|||
size_t group_argvstr(FAR struct tcb_s *tcb, FAR char *args, size_t size)
|
||||
{
|
||||
size_t n = 0;
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
bool saved = false;
|
||||
#endif
|
||||
|
||||
/* Perform sanity checks */
|
||||
|
||||
|
@ -77,7 +74,6 @@ size_t group_argvstr(FAR struct tcb_s *tcb, FAR char *args, size_t size)
|
|||
if (tcb->addrenv_own != NULL)
|
||||
{
|
||||
addrenv_select(tcb->addrenv_own);
|
||||
saved = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -100,7 +96,7 @@ size_t group_argvstr(FAR struct tcb_s *tcb, FAR char *args, size_t size)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_ARCH_ADDRENV
|
||||
if (saved)
|
||||
if (tcb->addrenv_own != NULL)
|
||||
{
|
||||
addrenv_restore();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue