M68K C Interrupt Handler

Peter Barada pbarada@mail.wm.sps.mot.com
Thu Jan 18 14:55:00 GMT 2001


>Note that I did not use a "wrapper method" and therefore avoided the
>overhead of the jsr. I simulated the effect of the interrupt attribute by
>globally labeling the section of code directly in front of the function
>prologue and then entering this label in my vector table. I also used inline
>assembly to save/restore registers and return from interrupt.

You have to be very careful about jumping/vectoring to labels inside
of a function.  If there is a register that is used that can not be
stuffed into d0/d1/a0/a1, then the function prologue (which can be
before the label you vectored to) has to save the register, and the
rte that you added at the end is before the epilogue which restores
the other registers.

Of course if your handler is simple this isn't a problem, but you'll
have to look at the assembler output of the compiler to see exactly
how its generated code interleaves with your asm statements.

-- 
Peter Barada                                   Peter.Barada@motorola.com
Wizard                                         781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola)   781-270-0193 (fax)

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com



More information about the crossgcc mailing list