diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-08-26 14:53:19 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-08-26 14:53:19 -0600 |
commit | 9cfae56f922ee209ab1147a95cdefbbc7abc43c2 (patch) | |
tree | 2372d74249b25a374f3a56749b460dbda5055289 /nuttx/binfmt | |
parent | 9d42a5757f9c020c358b54d5bdf359819a6c4f1d (diff) | |
download | nuttx-9cfae56f922ee209ab1147a95cdefbbc7abc43c2.tar.gz nuttx-9cfae56f922ee209ab1147a95cdefbbc7abc43c2.tar.bz2 nuttx-9cfae56f922ee209ab1147a95cdefbbc7abc43c2.zip |
Add up_addrenv_coherent which will be called before address environment switches
Diffstat (limited to 'nuttx/binfmt')
-rw-r--r-- | nuttx/binfmt/libelf/libelf_bind.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/nuttx/binfmt/libelf/libelf_bind.c b/nuttx/binfmt/libelf/libelf_bind.c index da2dcd4ce..608f65ef7 100644 --- a/nuttx/binfmt/libelf/libelf_bind.c +++ b/nuttx/binfmt/libelf/libelf_bind.c @@ -312,16 +312,19 @@ int elf_bind(FAR struct elf_loadinfo_s *loadinfo, } } -#ifdef CONFIG_ARCH_HAVE_COHERENT_DCACHE +#if defined(CONFIG_ARCH_ADDRENV) /* Ensure that the I and D caches are coherent before starting the newly * loaded module by cleaning the D cache (i.e., flushing the D cache * contents to memory and invalidating the I cache). */ +#if 0 /* REVISIT... has some problems */ + (void)up_addrenv_coherent(&loadinfo->addrenv); +#else up_coherent_dcache(loadinfo->textalloc, loadinfo->textsize); + up_coherent_dcache(loadinfo->dataalloc, loadinfo->datasize); #endif -#ifdef CONFIG_ARCH_ADDRENV /* Restore the original address environment */ status = elf_addrenv_restore(loadinfo); @@ -333,6 +336,16 @@ int elf_bind(FAR struct elf_loadinfo_s *loadinfo, ret = status; } } + +#elif defined(CONFIG_ARCH_HAVE_COHERENT_DCACHE) + /* Ensure that the I and D caches are coherent before starting the newly + * loaded module by cleaning the D cache (i.e., flushing the D cache + * contents to memory and invalidating the I cache). + */ + + up_coherent_dcache(loadinfo->textalloc, loadinfo->textsize); + up_coherent_dcache(loadinfo->dataalloc, loadinfo->datasize); + #endif return ret; |