diff options
| author | Thomas Martitz <kugel@rockbox.org> | 2010-09-09 16:17:21 +0000 |
|---|---|---|
| committer | Thomas Martitz <kugel@rockbox.org> | 2010-09-09 16:17:21 +0000 |
| commit | 0d4585b28ffcac1b62ed37cee2c34de0515df468 (patch) | |
| tree | 70ace8b78a4d0a44da50d692e893fadd93f85878 /apps/codecs | |
| parent | cec7c99613b3c11deb8a05deecd7ee9d16b5ea8a (diff) | |
| download | rockbox-0d4585b28ffcac1b62ed37cee2c34de0515df468.zip rockbox-0d4585b28ffcac1b62ed37cee2c34de0515df468.tar.gz rockbox-0d4585b28ffcac1b62ed37cee2c34de0515df468.tar.bz2 rockbox-0d4585b28ffcac1b62ed37cee2c34de0515df468.tar.xz | |
Extend lc_open() to also being able to load overlay plugins.
For this it needs to look at the plugin header. Since lc_open() doesn't know
it's a plugin, the header needs to be changed slightly to include the new lc_header (which needs to be the first element in plugin_header so it can be casted savely).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28054 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs')
| -rw-r--r-- | apps/codecs/codec_crt0.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/apps/codecs/codec_crt0.c b/apps/codecs/codec_crt0.c index fdb7909..c845f79 100644 --- a/apps/codecs/codec_crt0.c +++ b/apps/codecs/codec_crt0.c @@ -20,15 +20,10 @@ ****************************************************************************/ #include "config.h" -#include "codeclib.h" +#include "codecs.h" struct codec_api *ci DATA_ATTR; -extern unsigned char iramcopy[]; -extern unsigned char iramstart[]; -extern unsigned char iramend[]; -extern unsigned char iedata[]; -extern unsigned char iend[]; extern unsigned char plugin_bss_start[]; extern unsigned char plugin_end_addr[]; @@ -42,14 +37,23 @@ enum codec_status codec_start(void) { #if (CONFIG_PLATFORM & PLATFORM_NATIVE) #ifdef USE_IRAM - ci->memcpy(iramstart, iramcopy, iramend - iramstart); - ci->memset(iedata, 0, iend - iedata); -#endif + extern char iramcopy[], iramstart[], iramend[], iedata[], iend[]; + size_t iram_size = iramend - iramstart; + size_t ibss_size = iend - iedata; + if (iram_size > 0 || ibss_size > 0) + { + ci->memcpy(iramstart, iramcopy, iram_size); + ci->memset(iedata, 0, ibss_size); + /* make the icache (if it exists) up to date with the new code */ + ci->cpucache_invalidate(); + /* barrier to prevent reordering iram copy and BSS clearing, + * because the BSS segment alias the IRAM copy. + */ + asm volatile ("" ::: "memory"); + } +#endif /* PLUGIN_USE_IRAM */ ci->memset(plugin_bss_start, 0, plugin_end_addr - plugin_bss_start); #endif - /* writeback cleared iedata and bss areas, invalidate icache for - * copied code */ - ci->cpucache_invalidate(); return codec_main(); } |