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] |
Hi: I wanna how do you know the compiler will save other register autimatically? Thanks! ----- Original Message ----- From: "Peter Barada" <pbarada@mail.wm.sps.mot.com> To: <HollaA@HPD.Abbott.com> Cc: <crossgcc@sources.redhat.com> Sent: Wednesday, January 17, 2001 12:14 AM Subject: Re: M68K C Interrupt Handler > > >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). > > 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. > > Of course you'll have to determine the syntax that your assembler > understands for movem. I've seen it using as above, and also as: > > movm.l #0xyyyy,-(%sp) > > where 'yyyy' is the bit mask in the movem instruction. See what your > C compiler cranks out at the start/end of functions for an idea.... > > -- > Peter Barada Peter.Barada@motorola.com > Wizard 781-852-2768 (direct) > WaveMark Solutions(wholly owned by Motorola) 781-270-0193 (fax) > > ------ > 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] |