This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug other/67552] [meta] x86 interrupt attribute


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67552

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
Red zone isn't supported in interrupt handler:

'interrupt'
     Use this attribute to indicate that the specified void function
     without arguments is an interrupt handler.  The compiler generates
     function entry and exit sequences suitable for use in an interrupt
     handler when this attribute is present.  The 'IRET' instruction,
     instead of the 'RET' instruction, is used to return from interrupt
     handlers.  All registers, except for the EFLAGS register which is
     restored by the 'IRET' instruction, are preserved by the compiler.
     The red zone isn't supported in an interrupt handler; that is an
     interrupt handler can't access stack beyond the current stack
     pointer.

It is wrong to do

-  if (crtl->args.pops_args && crtl->args.size)
+  if (ix86_is_interrupt_p ())
+    {
+      if (ix86_using_red_zone ())
+          emit_insn (gen_adddi3 (
+                   gen_rtx_REG (DImode, SP_REG),
+                   gen_rtx_REG (DImode, SP_REG),
+                   GEN_INT (128)));

GCC should assume that red zone isn't used in interrupt handler.


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