cancel
Showing results for 
Search instead for 
Did you mean: 

Returning values from SWI under gcc?

michael8
Associate II
Posted on April 01, 2009 at 01:59

Returning values from SWI under gcc?

1 REPLY 1
michael8
Associate II
Posted on April 01, 2009 at 01:59

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!