Add up_addrenv_coherent which will be called before address environment switches

This commit is contained in:
Gregory Nutt
2014-08-26 14:53:19 -06:00
parent d6a4eb6266
commit 032ff50313
2 changed files with 73 additions and 0 deletions
+50
View File
@@ -661,6 +661,56 @@ int up_addrenv_restore(FAR const save_addrenv_t *oldenv)
return OK;
}
/****************************************************************************
* Name: up_addrenv_coherent
*
* Description:
* Flush D-Cache and invalidate I-Cache in preparation for a change in
* address environments. This should immediately precede a call to
* up_addrenv_select();
*
* Input Parameters:
* addrenv - Describes the address environment to be made coherent.
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int up_addrenv_coherent(FAR const group_addrenv_t *addrenv)
{
uintptr_t vaddr;
int i;
bvdbg("addrenv=%p\n", addrenv);
DEBUGASSERT(addrenv);
/* Invalidate I-Cache */
cp15_invalidate_icache();
/* Clean D-Cache in each region. */
#warning REVISIT... causes crashes
#if 0
arch_clean_dcache(CONFIG_ARCH_TEXT_VBASE,
CONFIG_ARCH_TEXT_VBASE +
CONFIG_ARCH_TEXT_NPAGES * MM_PGSIZE - 1);
arch_clean_dcache(CONFIG_ARCH_DATA_VBASE,
CONFIG_ARCH_DATA_VBASE +
CONFIG_ARCH_DATA_NPAGES * MM_PGSIZE - 1);
#if 0 /* Not yet implemented */
arch_clean_dcache(CONFIG_ARCH_HEAP_VBASE,
CONFIG_ARCH_HEAP_VBASE +
CONFIG_ARCH_HEAP_NPAGES * MM_PGSIZE - 1);
#endif
#endif
return OK;
}
/****************************************************************************
* Name: up_addrenv_clone
*
+23
View File
@@ -457,6 +457,29 @@ int up_addrenv_restore(FAR const save_addrenv_t *oldenv)
return OK;
}
/****************************************************************************
* Name: up_addrenv_coherent
*
* Description:
* Flush D-Cache and invalidate I-Cache in preparation for a change in
* address environments. This should immediately precede a call to
* up_addrenv_select();
*
* Input Parameters:
* addrenv - Describes the address environment to be made coherent.
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int up_addrenv_coherent(FAR const group_addrenv_t *addrenv)
{
/* There are no caches */
return OK;
}
/****************************************************************************
* Name: up_addrenv_clone
*