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 wanna how do  you know the compiler will save other register
>autimatically? 

The calling convention that most(if not all) compilers follow(for
m68k) is to save/restore any register that they modify *except*
a0/a1/d0/d1.  I'm ignoring the FPU registers since this is for m68k
only.  This convention has been around for about as long as the m68k
has.

So if the interrupt handler saves a0/a1/d0/d1 and then calls a C
function, that C function and any of the C functions that it calls
will save/restore all the registers, and upon return to the interrupt
handler, restoring a0/a1/d0/d1 and executing the rte will return back
to the point where the interrupt occured as if nothing happened. In
fact the code that got interrupted can not determine that an interrupt
occured(unless of course the interrupt handler makes a note of the
interrupt) unless it probes the stack.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]