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] |
> 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). For m68k-coff projects, I have only one assembly file which contains: - vector table - first level exception handlers - bss section initialization Vector table looks like: /*------------------------------------------------------------- -------------------------------------------------------------*/ .include "m68332.d" .section .text .long SystemStackTop .long ResetHandler other entries .globl Level1AutoVectorHandler other entries First level exception handlers looks like: /*------------------------------------------------------------- -------------------------------------------------------------*/ Level1AutoVectorHandler: movem.l %d0-%d1/%a0-%a1,-(%a7) jsr Spc3_IrqHandler movem.l (%a7)+,%d0-%d1/%a0-%a1 rte You don't need to save other registers here. Spc3_IrqHandler is a C function whose prototype is void Spc3_IrqHandler( ). BSS section initialization: /*------------------------------------------------------------- -------------------------------------------------------------*/ .even .globl ResetHandler ResetHandler: movea.l #SystemStackTop,%ssp move.l #__bss_start,%a0 move.l #_end,%a1 2: cmp.l %a0,%a1 beq.s 1f clr.b (%a0)+ bra.s 2b 1: jsr main illegal ------ 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] |