Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide
translations



Rockbox mail archive

Subject: Re: See FS#10756: Section for initializing functions

Re: See FS#10756: Section for initializing functions

From: Jeff Goode <jeffg7_at_gmail.com>
Date: Tue, 03 Nov 2009 09:44:57 -0500

Thomas Martitz wrote:
> I've some code here that creates a dedicated section for init
> functions (i.e. those that are only called once and very early),
> inspired by the Linux Kernel.
>
> There's little point in keeping that code in otherwise usable RAM.
> That's why my patch would copy move that code into a section that's
> overwritten later.
>
> For example, as my current patch works for e200v1: The code is in the
> same address area as bss. Before bss is zeroed, the init code is
> copied to the codec buffer. After calling main(), the init code is
> called from the codec buffer. The bss, following sections are moved
> over the init code, which effectively frees the code size init
> functions take. I use a very similar approach as iram code does.
>
> Where the init code lands (plugin or codec buffer) and if the
> mechanism is actually used is upto a single #ifdef in config.h and the
> target's app.lds
>
> On my e200, it yields ~6.7k. I would like to know if this kind of
> self-modifying code is considerable for SVN, or if it's too dirty
> and/or dangerous. -6.7k isn't *that* much.
>
> Best regards.
>
That's an interesting idea. It might actually save a little more RAM
than that, since some init functions have defenses in place to make sure
they're only called once. If they're one-shot, you can remove the
defenses too.

Jeff
Received on 2009-11-03

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy