2009-03-31 04:59 PM
Returning values from SWI under gcc?
2009-03-31 04:59 PM
Hi,
I'm trying to implement some newlib functions that return a value from an SWI handler in R0. The ISR is labeled as a SWI function using gcc's __attribute__ descriptor, so the compiler knows to generate the context saving @ restoring code. The problem is the GCC code automatically restores the state of all registers when returning from interrupts, overwriting my return value. Does anyone know how to tell gcc's assembler not to restore certain registers on exit from an ISR? I guess I could add code to overwrite the saved registers on the stck, but that seems hacky and unreliable. There's got to be a better way. Thanks!