SH interrupt_handler function attribute register saving

Benjamin Heyne benjamin.heyne at uni-dortmund.de
Fri Oct 9 09:46:16 UTC 2009


Hi all,
I am currently implementing some interrupt routines for a SH2A device.

The interrupt function is defined like this:
void __attribute__ ((interrupt_handler)) INT_CMT1_CMI1(void)
{
    //do something
}

Unfortunately the programm crashes after the first interrupt. When looking
into the generated function entry/exit code by gcc, I noticed a mismatch
between the saved and rescued registers from stack:

00002180 2F06              MOV.L     R0, at -R15
00002182 2F16              MOV.L     R1, at -R15
00002184 2F26              MOV.L     R2, at -R15
00002186 2F36              MOV.L     R3, at -R15
....
000021A4 67F6              MOV.L     @R15+,R7
000021A6 66F6              MOV.L     @R15+,R6
000021A8 65F6              MOV.L     @R15+,R5
000021AA 64F6              MOV.L     @R15+,R4
000021AC 002B              RTE
000021AE 0009              NOP


Now, several questions arise:
Is this a bug? Did I do something wrong? Is there any way around (except
writing the routine in assembler by hand...)?

--
Best regards
Benjamin Heyne





More information about the superh-gnu-discuss mailing list