This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Is it safe to save just part of registers in interrupt/exception handler?


PRC wrote:

> The MIPS ABI document says:
> For non-leaf function,$31 must be saved.  If any of
> $16..$23 or$29..$31 is changed within the called function, it must be saved
> in the stack frame before use and restored from the stack frame before re-
> turn from the function. 
> 
> My interrupt/exception handler contains two parts: one written in assembly
> and the other written in C. The ASM handler does some simple work like
> saving status, epc and gerneral registers and then jumps/calls to the C handler
> to do more complex work. Since MIPS ABI guarantees $16~$23 and $29~$31 are saved
> in C functions if they are used, is it safe to save only those registers except $16~$23 and $29~$31 in ASM handler?

In theory, yes: the ABI makes that guarantee.  As long as
all called code conforms to the ABI you'll be fine.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]