diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-08-27 00:29:50 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-08-27 00:29:50 +0000 |
commit | 194174a371b16dfc24960d1e33371c0a7ef1c2c2 (patch) | |
tree | b924bf74a96bb7dedcaebb45319569c003d81e8b /apps/plugins | |
parent | 97d2a6ec5ca8ace8daed29c8c69aab9595147b3a (diff) | |
download | rockbox-194174a371b16dfc24960d1e33371c0a7ef1c2c2.tar.gz rockbox-194174a371b16dfc24960d1e33371c0a7ef1c2c2.zip |
2nd try: Introduce a small api for loading code (codecs,plugins) from disk/memory.
It's a used by codec/plugin loading and vastly reduces code duplication. It's also a step forward in getting rid of libuisimulator in the application ports.
Apparently sh needs linker symbols prefixed with _ even if they're referenced without from C code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27902 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/plugin.lds | 1 | ||||
-rw-r--r-- | apps/plugins/plugin_crt0.c | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds index f150b9d168..653b8bae87 100644 --- a/apps/plugins/plugin.lds +++ b/apps/plugins/plugin.lds | |||
@@ -278,6 +278,7 @@ SECTIONS | |||
278 | .bss (NOLOAD) : | 278 | .bss (NOLOAD) : |
279 | { | 279 | { |
280 | plugin_bss_start = .; | 280 | plugin_bss_start = .; |
281 | _plugin_bss_start = .; | ||
281 | *(.bss*) | 282 | *(.bss*) |
282 | #if defined(IRAMSIZE) && IRAMSIZE == 0 | 283 | #if defined(IRAMSIZE) && IRAMSIZE == 0 |
283 | *(.ibss) | 284 | *(.ibss) |
diff --git a/apps/plugins/plugin_crt0.c b/apps/plugins/plugin_crt0.c index 536eccaffa..e34124c5a2 100644 --- a/apps/plugins/plugin_crt0.c +++ b/apps/plugins/plugin_crt0.c | |||
@@ -32,6 +32,8 @@ PLUGIN_HEADER | |||
32 | #define EXIT_MAGIC 0x0CDEBABE | 32 | #define EXIT_MAGIC 0x0CDEBABE |
33 | 33 | ||
34 | extern enum plugin_status plugin_start(const void*); | 34 | extern enum plugin_status plugin_start(const void*); |
35 | extern unsigned char plugin_bss_start[]; | ||
36 | extern unsigned char plugin_end_addr[]; | ||
35 | 37 | ||
36 | static jmp_buf __exit_env; | 38 | static jmp_buf __exit_env; |
37 | /* only 1 atexit handler for now, chain in the exit handler if you need more */ | 39 | /* only 1 atexit handler for now, chain in the exit handler if you need more */ |
@@ -61,6 +63,10 @@ enum plugin_status plugin__start(const void *param) | |||
61 | int exit_ret; | 63 | int exit_ret; |
62 | enum plugin_status ret; | 64 | enum plugin_status ret; |
63 | 65 | ||
66 | /* zero out the bss section */ | ||
67 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | ||
68 | rb->memset(plugin_bss_start, 0, plugin_end_addr - plugin_bss_start); | ||
69 | #endif | ||
64 | /* we come back here if exit() was called or the plugin returned normally */ | 70 | /* we come back here if exit() was called or the plugin returned normally */ |
65 | exit_ret = setjmp(__exit_env); | 71 | exit_ret = setjmp(__exit_env); |
66 | if (exit_ret == 0) | 72 | if (exit_ret == 0) |