This is the mail archive of the firstname.lastname@example.org mailing list for the crossgcc project.
|Index Nav:||[Date Index] [Subject Index] [Author Index] [Thread Index]|
|Message Nav:||[Date Prev] [Date Next]||[Thread Prev] [Thread Next]|
> >Here's what I do. I've been wondering if it's a good idea: > >I compile the interrupt routine with the switch that causes it to stop >after translating to assembler. I hand-edit it, changing the rts opcode >to rte. Then I assemble it and link. > >It's worked for small programs I use for hardware checkout, but I >haven't dug through it to make sure the stack is being cleaned up >properly. > >Anyone care to comment? In the standard m68k C function call interface, the called function is only required to preserve the contents of registers D2-D7 and A2-A6 (A7, the stack pointer, should end up back at the same value). D0, D1 A0, A1 are considered volatile across a function call and the compiler tends to use them as work registers. D0 (and sometimes D1) is used to return the function return value. Because of this, your hand edited code will allow the contents of D0, D1, A0, A1 to be corrupted by an interrupt, causing unpredictable (and hard to debug) problems. You could just add a "movem.l %d0-%d1/%a0-%a1,-(%sp)" to the beginning of the function and a "movem.l (%sp)+,%d0-%d1/%a0-%a1" before the rte. Art