Re: RFC: AVR interrupt handling issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18/12/2021 16:31, Henri Cloetens wrote:
> Dear Sir,
> 
> To customize the stack/unstacking, you need to modify the code of
> your backend port.

I can see that - but thats a very invasive thing to change solely for
the use of my project.

I'd prefer to make a more generic change to the backend (I already found
the location), but I dont want to base an entire project off a change
that has no hope of ever being merged into gcc, as would be the case if
I pushed my entire custom IRQ handling into gcc. Theres just no way.

I want to get gcc to either emit modifiable code that I can then
reassemble, or get gcc to understand how to insert custom
"pro-prologues" and "epi-epilogues", as I would have thought such
changes would have more chance of being accepted into the gcc codebase.

> I mean, the emitting of the stack/unstacking for the normal case (no 
> interrupt, but function call), is in the backend part, NOT in the
> 'main' files, that are not intended to be modified. I would recommend
> you look there, and also in other backends, to find out how to do
> this.

I have, as I mentioned in my previous email.


I could modify gcc/config/avr/avr.c here (below), in order to generate
ISR prologues with some register saves omitted (the ones performed in my
own pro-prologue).

This would cause gcc to output trivially modifiable code, which could be
fed to a script that can insert the pro-prologue and epi-epilogue
assembler fragments.


/*  Output function prologue.  */

void
avr_expand_prologue (void)
{
  HARD_REG_SET set;
  HOST_WIDE_INT size;

  size = get_frame_size() + avr_outgoing_args_size();

  cfun->machine->stack_usage = 0;

  /* Prologue: naked.  */
  if (cfun->machine->is_naked)
    {
      return;
    }

/// MODIFY HERE
   if (no-save-isr-prologue)
   {
     // FIXME Remove registers my custom prologue saves from the set
     ...
   }
/// END MODIFICATION

  avr_regs_to_save (&set);

  if (cfun->machine->is_interrupt || cfun->machine->is_signal)



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux