This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


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

Re: m68k attribute interrupt


Kai Ruottu wrote:
> 
> Paul Andrews wrote:
> >
> > Unfortunetly I have discovered a problem with your patch. If an interrupt
> > routine does nothing but call a function with a constant parameter, the
> > scratch registers (d0/d1/a0/a1) are not saved, however the stack pointer is
> > (which seems a bit redundant anyhow).
>
>  So I must have added something extra to the original patches... I will look at what
> it is and send the fixes. Ok, the saving of the stack pointer must be investigated,
> I'm not an expert with the m68k calling convention, but it may be necessary to save
> the sp...

 Here are my patches, derived from the Michael's patches. I changed the save rules to
follow those now used in the H8/300 port, to handle also the '__attribute__ ((noreturn))'
and non-leaf functions in ISRs. The stack-pointer may be handled with the available macro 
'STACK_POINTER_REGNO (regno)' (I remember the name being this) if needed:

  #define MUST_SAVE_REGISTER(regno)                                     \
   (! TREE_THIS_VOLATILE (current_function_decl)                        \
     && ! STACK_POINTER_REGNO (regno)                                   \
     /* Save any call saved register that was used.  */                 \
     && (regs_ever_live[regno] && !call_used_regs[regno])               \
     /* Save any register used in an interrupt handler.  */             \
     || (regs_ever_live[regno] && interrupt_handler)                    \
     /* Save call clobbered registers in non-leaf interrupt handlers. */        \
     || (call_used_regs[regno] && interrupt_handler && !current_function_is_leaf))
 
Cheers, Kai

M68K_C_I.pch

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