This is the mail archive of the crossgcc@cygnus.com 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]

RE: m68k & Interrupts



On 13-Sep-98 Guido Pohl wrote:
>  What is the best way to handle the interrupt service routines? I really
>  do not mean assembler for the interrupt routines itself ;-)!
>  
>  One possible solution. that I can think of, is to use somekind of a
>  wrapper function written in assembler, which one and only function is to
>  call the actual c-function.

This is the method I have used. You also need to push all the 68k registers onto
the stack before calling the C function. The code I have also pushes the current
stack pointer to make the saved registers and the 68k exception data available
as an argument to the C function. This is useful for BusError etc. but it is
an additional overhead which you may not want.

I can send you the code if it helps.


>  Another way would be to write a header and trailer for the c-function
>  that clean up the stack. The header would fake the stack, i.e. it would
>  put the status register on the stack. The trailer would then have an rte
>  after it cleaned up the stack frame of the c-function.

I don't know of a way of doing this with gcc, but if anyone does it would save
one level of call/return.


-- 
Mark Powell, Senior Software Engineer, Primagraphics Limited
New Cambridge House, Litlington, nr.Royston, Herts, SG8 0SS, UK
Tel. +44 1763 852222, Fax. 853324, medp@primag.co.uk, http://www.primag.co.uk