AVR prologue & epilogue
Svein E. Seldal
Svein.Seldal@solidas.com
Thu Jun 12 18:44:00 GMT 2003
Hi,
I'm working with some code targetted for the AVR platform. In an
interrupt service routine, I need to switch stack just _prior_ to the
push'es of this routine and then switch back the stack just after the
pop's of the function. (This switch code is written assembly.)
1) Are there any ways I can insert some code before the push'es and
after the pop's of a function (yet still before the ret[i] in the latter
case)?
According to my reading of gcc/config/avr/avr.c it does not seem like
this is possible, as the epilogue and the prologue seems very hardcoded.
So my second approach would be to declare the interrupt func as naked,
but then my problem is that I need to manage myself which registers are
clobbered and which are not.
2) Is there a way for me to instruct gcc to manually insert push's and
pop's before and after a function i called. Does something like this exist:
__builtin_push_used_regiserter();
do_some_func();
__builtin_pop_used_registers();
Regards,
Svein
More information about the Gcc
mailing list