summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-04-06 18:26:14 +0000
committerJens Arnold <amiconn@rockbox.org>2006-04-06 18:26:14 +0000
commitb509ff5069acc2d1c63ea501fbc27e08c7e263d3 (patch)
treecd14dbbd74636c4a80240445f25055e10ba4bf27
parent930785cd8f68e0906d2a8d892d1db1d17dfc77e9 (diff)
downloadrockbox-b509ff5069acc2d1c63ea501fbc27e08c7e263d3.zip
rockbox-b509ff5069acc2d1c63ea501fbc27e08c7e263d3.tar.gz
rockbox-b509ff5069acc2d1c63ea501fbc27e08c7e263d3.tar.bz2
rockbox-b509ff5069acc2d1c63ea501fbc27e08c7e263d3.tar.xz
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
-rw-r--r--apps/plugin.c5
-rwxr-xr-xapps/plugins/lib/overlay.c5
2 files changed, 7 insertions, 3 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index 57bc095..b023a65 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -490,8 +490,6 @@ int plugin_load(const char* plugin, void* parameter)
gui_syncsplash(HZ*2, true, str(LANG_PLUGIN_CANT_OPEN), plugin);
return fd;
}
- /* zero out plugin buffer to ensure a properly zeroed bss area */
- memset(pluginbuf, 0, PLUGIN_BUFFER_SIZE);
readsize = read(fd, pluginbuf, PLUGIN_BUFFER_SIZE);
close(fd);
@@ -516,6 +514,9 @@ int plugin_load(const char* plugin, void* parameter)
return -1;
}
plugin_size = hdr->end_addr - pluginbuf;
+
+ /* zero out bss area only, above guards end of pluginbuf */
+ memset(pluginbuf + readsize, 0, plugin_size - readsize);
#endif
plugin_loaded = true;
diff --git a/apps/plugins/lib/overlay.c b/apps/plugins/lib/overlay.c
index 31c2b00..91f08e2 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,
rb->splash(2*HZ, true, "%s overlay doesn't fit into memory.", name);
return PLUGIN_ERROR;
}
- rb->memset(header.load_addr, 0, header.end_addr - header.load_addr);
fd = rb->open(filename, O_RDONLY);
if (fd < 0)
@@ -101,6 +100,10 @@ enum plugin_status run_overlay(struct plugin_api* rb, void* parameter,
rb->splash(2*HZ, true, "Reading %s overlay failed.", name);
return PLUGIN_ERROR;
}
+ /* Zero out bss area */
+ rb->memset(header.load_addr + readsize, 0,
+ header.end_addr - (header.load_addr + readsize));
+
return header.entry_point(rb, parameter);
}
#endif