public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/67552] [meta] x86 interrupt attribute
Date: Fri, 11 Sep 2015 15:46:00 -0000	[thread overview]
Message-ID: <bug-67552-4-RuA0r749fY@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-67552-4@http.gcc.gnu.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.


  parent reply	other threads:[~2015-09-11 15:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11 15:40 [Bug other/67552] New: " hjl.tools at gmail dot com
2015-09-11 15:41 ` [Bug other/67552] " hjl.tools at gmail dot com
2015-09-11 15:46 ` hjl.tools at gmail dot com [this message]
2015-09-11 17:43 ` hjl.tools at gmail dot com
2015-09-11 17:44 ` hjl.tools at gmail dot com
2015-09-14  9:26 ` julia.koval at intel dot com
2015-09-14 11:25 ` hjl.tools at gmail dot com
2015-09-19 22:35 ` hjl.tools at gmail dot com
2015-09-19 22:35 ` hjl.tools at gmail dot com
2015-09-29 13:39 ` hjl.tools at gmail dot com
2015-10-05 17:30 ` hjl.tools at gmail dot com
2015-10-12 12:48 ` hjl.tools at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-67552-4-RuA0r749fY@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).