summaryrefslogtreecommitdiff
path: root/nuttx/binfmt
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-08-24 14:12:45 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-08-24 14:12:45 -0600
commit54f46fc6998873b204ac161371cb1ae90ea7151d (patch)
tree565efdd20ae50c978dfda2ee4e98d100e09741d0 /nuttx/binfmt
parent14f5d59d7bac51278acdcd4db24af4a8624464db (diff)
downloadnuttx-54f46fc6998873b204ac161371cb1ae90ea7151d.tar.gz
nuttx-54f46fc6998873b204ac161371cb1ae90ea7151d.tar.bz2
nuttx-54f46fc6998873b204ac161371cb1ae90ea7151d.zip
After cached related fix, the ELF example is now functional
Diffstat (limited to 'nuttx/binfmt')
-rw-r--r--nuttx/binfmt/elf.c2
-rw-r--r--nuttx/binfmt/libelf/libelf_bind.c11
2 files changed, 8 insertions, 5 deletions
diff --git a/nuttx/binfmt/elf.c b/nuttx/binfmt/elf.c
index eb0adc702..cff3463a7 100644
--- a/nuttx/binfmt/elf.c
+++ b/nuttx/binfmt/elf.c
@@ -257,7 +257,7 @@ static int elf_loadbinary(struct binary_s *binp)
#endif
elf_dumpbuffer("Entry code", (FAR const uint8_t*)binp->entrypt,
- MIN(loadinfo.elfsize - loadinfo.ehdr.e_entry, 512));
+ MIN(loadinfo.textsize - loadinfo.ehdr.e_entry, 512));
elf_uninit(&loadinfo);
return OK;
diff --git a/nuttx/binfmt/libelf/libelf_bind.c b/nuttx/binfmt/libelf/libelf_bind.c
index 4d3d27f04..6ce660ef5 100644
--- a/nuttx/binfmt/libelf/libelf_bind.c
+++ b/nuttx/binfmt/libelf/libelf_bind.c
@@ -1,7 +1,7 @@
/****************************************************************************
* binfmt/libelf/libelf_bind.c
*
- * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -323,10 +323,13 @@ int elf_bind(FAR struct elf_loadinfo_s *loadinfo,
}
}
- /* Flush the instruction cache before starting the newly loaded module */
+#ifdef 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.
+ */
-#ifdef CONFIG_ELF_ICACHE
- arch_flushicache((FAR void*)loadinfo->textalloc, loadinfo->textsize);
+ arch_coherent_dcache(loadinfo->textalloc, loadinfo->textsize);
#endif
return ret;