This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

M68K C Interrupt Handler


Hi,

Does anyone know how to write  m68k interrupt handlers  in C?  My (possibly
incorrect/incomplete) understanding of the  issues are that: 
(1) Normal  function calls generated by the compiler will not work as
interrupt functions, 
(2) I need to save all registers, 
(3) I can now execute my handler specific C code including any HW specific
start-of-interrupt and end-of-interrupt processing,  
(4) I need to restore registers, 
(5) I need to do a return from interrupt (rte).  

In the GCC manual I saw special "function attributes" to generate an
interrupt function for certain processors, but none for 68k. I tried using
them anyway, but they did not work.

Next, I tried to avoid the standard function call stuff created by the
compiler,  I tried entering the label "IrqHandler" from the  code below  in
my C interrupt vector table instead of the address of the function
DummyIrqHandler(). Every syntax that I tried for this would not compile or
link. 

void DummyIrqHandler(void) 					
{
IrqHandler:							
    asm("movem.l  %a0-%a6/%d0-%d7,-(%sp)") ;		// Save registers.

    // ... Rest of C code here and end of interrupt processing.

    asm("movem.l (%sp)+,%a0-%a6/%d0-%d7");		// Restore
registers.
    asm("rte");						// Return from
exception.					
}	

Any help is much appreciated,
Alex

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]