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


Hi,

This is the first time I have tried to apply a patch to anything. From a
Cygwin 1.1.4 bash shell I changed to my gcc source directory, gcc-2.95.2.
From this directory, I tried applying Ken's m68k-interrupt patch as follows:


 tr -d 'r' < m68k-interrupt.patch | patch -p0

which resulted in

patching file `gcc/config/m68k/m68k.c'
Hunk #1 FAILED at 1.
Hunk #2 succeeded at 43 with fuzz 1.
Hunk #3 FAILED at 170.
Hunk #4 FAILED at 318.
Hunk #5 FAILED at 341.
Hunk #6 FAILED at 378.
Hunk #7 FAILED at 516.
Hunk #8 FAILED at 524.
Hunk #9 FAILED at 552.
Hunk #10 FAILED at 578.
Hunk #11 FAILED at 599.
Hunk #12 FAILED at 754.
Hunk #13 FAILED at 864.
Hunk #14 succeeded at 3450 with fuzz 2.
12 out of 14 hunks FAILED -- saving rejects to gcc/config/m68k/m68k.c.rej
patching file `gcc/config/m68k/m68k.h'
Hunk #1 FAILED at 119.
Hunk #2 FAILED at 147.
Hunk #4 FAILED at 2141.
3 out of 4 hunks FAILED -- saving rejects to gcc/config/m68k/m68k.h.rej
patching file `gcc/config/m68k/m68k.md'
Hunk #1 FAILED at 6964.
1 out of 1 hunk FAILED -- saving rejects to gcc/config/m68k/m68k.md.rej

Any and all explanations, theories, etc. for why the patch did not apply are
welcome and much appreciated.

Thanks,
Alex


-----Original Message-----
From: Ken DESMET [mailto:ken@sdt.be]
Sent: Tuesday, January 16, 2001 12:06 AM
To: crossgcc@sourceware.cygnus.com
Subject: Re: M68K C Interrupt Handler


Hi,

It is perfectly possible to write a complete interrupt/exception handlers in
C without the need of inline assembler instructions when your target the
M68K family. I use it all the time. Some time ago Michael Schwingen and Kai
Ruottu (thanks guy's) have written a patch that allows interrupts to be
handled purely in C. I have modified the patch slightly myself because I
wanted to add floating point co-processor support (I use MC68030 with
MC68882, and 68VZ328) while inside the interrupt routine. I use the patch on
successfully on GCC-2.95.2.

An interrupt routine then looks like this:

void __attribute__ ((interrupt)) InterruptHandler(void)
 {
  interrupts++;
 }

It will generate an "rte" at the end of the routine in stead of an "rts" and
any local registers that would be used will be pushed onto the stack.

I hope this will help you.

Kind regards,

Ken


-----Original Message-----
From: crossgcc-owner@sources.redhat.com
[mailto:crossgcc-owner@sources.redhat.com]On Behalf Of clifftsai
Sent: dinsdag 16 januari 2001 5:08
To: Holland, Alexander MHX; crossgcc@sources.redhat.com
Subject: 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


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