This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/67552] [meta] x86 interrupt attribute
- From: "hjl.tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 11 Sep 2015 15:45:58 +0000
- Subject: [Bug other/67552] [meta] x86 interrupt attribute
- Auto-submitted: auto-generated
- References: <bug-67552-4 at http dot gcc dot gnu dot org/bugzilla/>
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.