diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-04-06 18:26:14 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-04-06 18:26:14 +0000 |
commit | b509ff5069acc2d1c63ea501fbc27e08c7e263d3 (patch) | |
tree | cd14dbbd74636c4a80240445f25055e10ba4bf27 /apps | |
parent | 930785cd8f68e0906d2a8d892d1db1d17dfc77e9 (diff) | |
download | rockbox-b509ff5069acc2d1c63ea501fbc27e08c7e263d3.tar.gz rockbox-b509ff5069acc2d1c63ea501fbc27e08c7e263d3.zip |
Patch #3022 by Mikael Magnusson: Only zero out the actual bss area instead of the whole plugiin buffer, for faster plugin loading. * Applied the same idea to the overlay loader.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9535 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugin.c | 5 | ||||
-rwxr-xr-x | apps/plugins/lib/overlay.c | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index 57bc09530a..b023a6553f 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -490,8 +490,6 @@ int plugin_load(const char* plugin, void* parameter) | |||
490 | gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_CANT_OPEN), plugin); | 490 | gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_CANT_OPEN), plugin); |
491 | return fd; | 491 | return fd; |
492 | } | 492 | } |
493 | /* zero out plugin buffer to ensure a properly zeroed bss area */ | ||
494 | memset(pluginbuf, 0, PLUGIN_BUFFER_SIZE); | ||
495 | 493 | ||
496 | readsize = read(fd, pluginbuf, PLUGIN_BUFFER_SIZE); | 494 | readsize = read(fd, pluginbuf, PLUGIN_BUFFER_SIZE); |
497 | close(fd); | 495 | close(fd); |
@@ -516,6 +514,9 @@ int plugin_load(const char* plugin, void* parameter) | |||
516 | return -1; | 514 | return -1; |
517 | } | 515 | } |
518 | plugin_size = hdr->end_addr - pluginbuf; | 516 | plugin_size = hdr->end_addr - pluginbuf; |
517 | |||
518 | /* zero out bss area only, above guards end of pluginbuf */ | ||
519 | memset(pluginbuf + readsize, 0, plugin_size - readsize); | ||
519 | #endif | 520 | #endif |
520 | 521 | ||
521 | plugin_loaded = true; | 522 | plugin_loaded = true; |
diff --git a/apps/plugins/lib/overlay.c b/apps/plugins/lib/overlay.c index 31c2b00f91..91f08e23f0 100755 --- a/apps/plugins/lib/overlay.c +++ b/apps/plugins/lib/overlay.c | |||
@@ -85,7 +85,6 @@ enum plugin_status run_overlay(struct plugin_api* rb, void* parameter, | |||
85 | rb->splash(2*HZ, true, "%s overlay doesn't fit into memory.", name); | 85 | rb->splash(2*HZ, true, "%s overlay doesn't fit into memory.", name); |
86 | return PLUGIN_ERROR; | 86 | return PLUGIN_ERROR; |
87 | } | 87 | } |
88 | rb->memset(header.load_addr, 0, header.end_addr - header.load_addr); | ||
89 | 88 | ||
90 | fd = rb->open(filename, O_RDONLY); | 89 | fd = rb->open(filename, O_RDONLY); |
91 | if (fd < 0) | 90 | if (fd < 0) |
@@ -101,6 +100,10 @@ enum plugin_status run_overlay(struct plugin_api* rb, void* parameter, | |||
101 | rb->splash(2*HZ, true, "Reading %s overlay failed.", name); | 100 | rb->splash(2*HZ, true, "Reading %s overlay failed.", name); |
102 | return PLUGIN_ERROR; | 101 | return PLUGIN_ERROR; |
103 | } | 102 | } |
103 | /* Zero out bss area */ | ||
104 | rb->memset(header.load_addr + readsize, 0, | ||
105 | header.end_addr - (header.load_addr + readsize)); | ||
106 | |||
104 | return header.entry_point(rb, parameter); | 107 | return header.entry_point(rb, parameter); |
105 | } | 108 | } |
106 | #endif | 109 | #endif |