Since the interrupt handler can be called in an arbitrary point during
an execution
of non-interrupt code, it has to preserve all registers that it'll
use. Otherwise, a non-interrupt code using such non-saved register
would inexplicably see the value of such register
change, mid-execution---because the interrupt just happened and
clobbered the value.
R8-9 are used for local variables, so they must be preserved. Even 10-15 must be
preserved---they are apparently used for short-lived data storage,
but still the compiler
must assume that they reliably store data while it's being used in a
given code chunk.

The difference between local (4-9) and volatile (10-15) registers is
that the compiler assumes that the former are preserved across the
function calls; on the other hand the compiler-generated code using
volatile storage completes its calculations before function calls,
allowing the callee functions to clobber those registers with
impunity.

Did I understand your questions? does my explanation make sense?

On 1/22/07, Kris Heidenstrom <[email protected]> wrote:

The compiler-generated interrupt handler wrapper code preserves R8 and R9 as well 
as  > R10~15. I don't think it should.
----------------------------------------
Preserved Registers R4~9
....
call. Local variables are assigned to these registers
by the compiler.


Reply via email to