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


> From: "clifftsai" <clifftsai@minecard.com.tw>
>     I want to know: how do you know the compiler will save other registers
> automatically?

Read the code.  The code for a procedure entry saves all the registers
that the procedure uses, and the procedure exit restores them before
returning.  Registers a0/a1/d0/d1 are used as temporary storage and
are not assumed to retain their values when a procedure is called.
Other conventions would be possible, but those are the conventions of
gcc-68k.

> ----- Original Message -----
> From: "Peter Barada" <pbarada@mail.wm.sps.mot.com>
> >
> > It's trivial to write an interrupt handler in assembler that calls out
> > to your C interrupt function for the 68k:
> >
> > ASM_IRQ_handler:
> > moveml %a0/%a1/%d0/%d1,-(%sp)
> > jsr C_IRQ_handler
> > moveml (%sp)+,%a0/%a1/%d0/%d1
> > rte
> >
> > You only need to save a0/a1/d0/d1 since all the other registers are
> > saved/restored by the compiler, and the SR register is already on the
> > stack from the interrupt itself.  Since you mention a straight m68k,
> > there's no FPU to worry about.

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