diff options
| author | Frank Gevaerts <frank@gevaerts.be> | 2012-05-19 18:48:43 +0200 |
|---|---|---|
| committer | Frank Gevaerts <frank@gevaerts.be> | 2012-05-19 18:53:17 +0200 |
| commit | f3fd2d41ccbd36226ed12e3977421f86cbcfad97 (patch) | |
| tree | 70c806c8055d85aba2bf4917c0042cf059f20a63 /tools | |
| parent | 9db0cf0f93b51262b47b216143fb0dbf97dc74b1 (diff) | |
| download | rockbox-f3fd2d41ccbd36226ed12e3977421f86cbcfad97.zip rockbox-f3fd2d41ccbd36226ed12e3977421f86cbcfad97.tar.gz rockbox-f3fd2d41ccbd36226ed12e3977421f86cbcfad97.tar.bz2 rockbox-f3fd2d41ccbd36226ed12e3977421f86cbcfad97.tar.xz | |
Make overlay plugins work again.
Overlay plugins got broken because ovl_offset.pl assumes the audio buffer
ends where the plugin buffer starts. Buflib however keeps its handle table
there, so there are a few hundred bytes fewer available, so loading the
overlay fails. We work around this by linking the overlay at a slightly
lower address (1024 bytes lower). If the handle table ever grows more than
that, overlays will start failing again and we either need a different
solution or increase the margin a bit.
Change-Id: Id98cb52da2c8c4a4bc773362a46f646774112f85
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/ovl_offset.pl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/ovl_offset.pl b/tools/ovl_offset.pl index 89c3468..1041999 100755 --- a/tools/ovl_offset.pl +++ b/tools/ovl_offset.pl @@ -4,6 +4,10 @@ # on a reference map file (.refmap) sub map_scan { + # The buflib handle table is a few hundred bytes, just before + # the plugin buffer. We assume it's never more than 1024 bytes. + # If this assumption is wrong, overlay loading will fail. + my $max_handle_table_size = 1024; my ($map) = @_; my $ramstart = -1, $ramsize = -1, $startaddr = -1, $endaddr = -1; open (MAP, "<$map"); @@ -25,7 +29,7 @@ sub map_scan { printf "Could not analyze map file.\n"; exit 1; } - return $ramstart + $ramsize - $endaddr; + return $ramstart + $ramsize - $endaddr - $max_handle_table_size; } printf map_scan($ARGV[0]) & ~0xf; |