[Icc-430] Re: Interrupt handler wrapper preserves R8,9 - repost
Richard
richard-lists at imagecraft.com
Sun Feb 4 19:06:04 PST 2007
Hi Kris and Kirk, I found the root of the problem, and of course it is....
the documentation is wrong!!! R8/R9 are not preserved registers. They are
"work" or volatile registers. The change came when the compiler started to
use R12/R13 also to pass arguments, and I also moved R8/R9 into the other
pool. I think the change was documented in the readme file, but I forgot to
fix the documentation. I will do that.
Sorry about that.
At 12:10 PM 1/25/2007, Kris Heidenstrom wrote:
>The wrapper doesn't need to preserve the preserved registers,
>because the called function will preserve any of them that it uses.
>In fact the wrapper doesn't preserve R4~7 for this reason, but
>it _does_ preserve R8,9, which are "preserved registers" just like
>R4~7.
>
>In my case the called function doesn't use R8,9 at all, but if it did,
>it would preserve them (according to the help), because they are
>"preserved registers", so the wrapper doesn't need to preserve
>them, it just needs to preserve the "volatile registers", R10~15,
>as also stated in the help: "If you write a handler in assembly and
>if it calls normal C functions, then the assembly handler must
>save and restore the volatile registers, since normal C functions
>do not preserve them".
>
>My guess is that when the compiler sees that the interrupt handler
>is calling a function, it flags a list of registers as "needing to be
>preserved by the wrapper", and this list wrongly includes R8,9
>as well as (rightly) R10~15.
>
>Kris
>--
>Kris Heidenstrom Embedded systems designer / programmer
>kris at abbey.co.nz Abbey Systems Ltd - Telemetry Specialists
>Wellington NEW ZEALAND Voice +64-4-385-6611 Fax +64-4-385-6848
>
>_______________________________________________
>Icc-430 mailing list
>Icc-430 at imagecraft.com
>http://dragonsgate.net/mailman/listinfo/icc-430
// richard (This email is for mailing lists. To reach me directly, please
use richard at imagecraft.com)
More information about the Icc-430
mailing list