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]

Re: M68K C Interrupt Handler


I don't think it's possible to write Int complete in C
Because GNU want let All tool and architecture Portable.
If you want to write Ints.You can use in-line assembly.
That is,you can write most of code in C,but architecture
part in assembly for that Target.
You can reference GCC manual for details!
http://www.gnu.org/manual
http://sources.redhat.com/gnupro


----- Original Message -----
From: "Holland, Alexander MHX" <HollaA@HPD.Abbott.com>
To: <crossgcc@sources.redhat.com>
Sent: Tuesday, January 16, 2001 10:17 AM
Subject: 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
>
>



------
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]