From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 101081 invoked by alias); 4 Oct 2015 20:01:03 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 101066 invoked by uid 89); 4 Oct 2015 20:01:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-vk0-f51.google.com Received: from mail-vk0-f51.google.com (HELO mail-vk0-f51.google.com) (209.85.213.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sun, 04 Oct 2015 20:01:01 +0000 Received: by vkgd64 with SMTP id d64so85708700vkg.0 for ; Sun, 04 Oct 2015 13:00:59 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.31.146.133 with SMTP id u127mr18283632vkd.42.1443988859005; Sun, 04 Oct 2015 13:00:59 -0700 (PDT) Received: by 10.103.40.68 with HTTP; Sun, 4 Oct 2015 13:00:58 -0700 (PDT) In-Reply-To: References: <2AB9494F-91EC-4CF6-945B-0CB03A583513@comcast.net> <1D91C2C8-833D-4F6D-9C57-C22D61662A83@comcast.net> Date: Sun, 04 Oct 2015 20:01:00 -0000 Message-ID: Subject: Re: [PATCH] x86 interrupt attribute From: Uros Bizjak To: "H.J. Lu" Cc: Yulia Koval , Mike Stump , GCC Patches Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015-10/txt/msg00347.txt.bz2 On Sun, Oct 4, 2015 at 8:15 PM, H.J. Lu wrote: >> Looking a bit deeper into the code, it looks that we want to realign >> the stack in the interrupt handler. Let's assume that interrupt >> handler is calling some other function that saves SSE vector regs to >> the stack. According to the x86 ABI, incoming stack of the called >> function is assumed to be aligned to 16 bytes. But, interrupt handler >> violates this assumption, since the stack could be aligned to only 4 >> bytes for 32bit and 8 bytes for 64bit targets. Entering the called >> function with stack, aligned to less than 16 bytes will certainly >> violate ABI. >> >> So, it looks to me that we need to realign the stack in the interrupt >> handler unconditionally to 16bytes. In this case, we also won't need >> the following changes: >> > > Current stack alignment implementation requires at least > one, maybe two, scratch registers: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67841 > > Extend it to the interrupt handler, which doesn't have any scratch > registers may require significant changes in backend as well as > register allocator. But without realignment, the handler is unusable for anything but simple functions. The handler will crash when called function will try to save vector reg to stack. Uros.