Faced with code optimization (C, very limited amount of memory). For interrupt handling, functions with the _ naked _ attribute are used, which (according to the documentation) suppresses the generation of the prologue and function epilogue. I never thought about it before. Can you explain why this is? And what is the essence of the prologue-epilogue?

  • 1. Is there an answer to stackoverflow 2. MS Visual C / C ++? Strange choice of instrument in this case ... - alexlz
  • Pro stackowerflow did not quite understand. GCC compiler. All things with attributes, as I understand it, depend on the specific implementation of the compiler? - Alexey Kotov
  • Yes, depend on the compiler. For example, gcc attribute ((naked)) is supported only for ARM processors. - stanislav
  • AVR / AVR32, too, as I managed to understand - Alexey Kotov

1 answer 1

The prolog stores the execution context — the data (flags, processor registers, etc.) that can be changed by the function being called. And the epilogue restores the context using the saved data.

When processing interrupts, high speed is required and the code is often written in assembler (including built-in), and in this case you can save and restore the context yourself (or not save and not restore it at all) without using the compiler's capabilities.

More on the topic: the prologue and epilogue .

  • Thanks for the constructive answer! - Alexey Kotov