On Tue, Jul 10, 2001 at 01:40:42PM +0200, Bernd Abel wrote:
> typedef unsigned long long u8;
> ...
> register u8 reg1 __asm__("d6");
> register u8 reg2 __asm__("d4");
> 
> This maps reg1 to the data registers D6 and D7, and reg2 to D4 and D5.
> reg1 and reg2 are global to the application.
[...doesn't seem to unlock the code resources...]
> Curiously enough, if I replace the definition of reg2 by
> 
> u8 reg2;
> 
> the Chunk-overlocked alerts do not appear anymore.
> 
> Anyone, who can explain me what happens here? Are D4,D5 used by the
> startup code, particularly with respect to extra code resources?

I suspect the problem is that you are using the global register variable
functionality without having adequately read its documentation.  The
paragraph I am referring to is:

        A function which can alter the value of a global register
        variable cannot safely be called from a function compiled
        without this variable, because it could clobber the value the
        caller expects to find there on return.  Therefore, the function
        which is the entry point into the part of the program that uses
        the global register variable must explicitly save and restore
        the value which belongs to its caller.

If you disassemble crt0.o, which was of course "compiled without this
variable", you'll see that the startup code stores launchFlags in %d4
and expects it to remain there.  Looking additionally at dreloc.c,
you'll see that if PilotMain() trashes %d4 the effect will be to bypass
the unlocking of the code resources at application exit.

This is consistent with the symptoms you have described.

    John

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to