From patchwork Tue Oct 25 15:46:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 121723 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 4FD52B6F82 for ; Wed, 26 Oct 2011 02:47:08 +1100 (EST) Received: (qmail 32764 invoked by alias); 25 Oct 2011 15:47:05 -0000 Received: (qmail 32749 invoked by uid 22791); 25 Oct 2011 15:47:03 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL, BAYES_00, FROM_12LTRDOM X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 25 Oct 2011 15:46:47 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1RIjDC-0002nQ-Ft from Bernd_Schmidt@mentor.com for gcc-patches@gcc.gnu.org; Tue, 25 Oct 2011 08:46:46 -0700 Received: from [127.0.0.1] ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 25 Oct 2011 16:46:44 +0100 Message-ID: <4EA6D9E0.7070305@codesourcery.com> Date: Tue, 25 Oct 2011 17:46:40 +0200 From: Bernd Schmidt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.20) Gecko/20110920 Lightning/1.0b3pre Thunderbird/3.1.12 MIME-Version: 1.0 To: GCC Patches Subject: Two C6X eh fixes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org I've committed these two patches, which correct some problems where the libgcc implementation didn't quite match the ABI. Bernd Index: libgcc/ChangeLog =================================================================== --- libgcc/ChangeLog (revision 180434) +++ libgcc/ChangeLog (working copy) @@ -3,6 +3,9 @@ * config/c6x/pr-support.c (__gnu_unwind_24bit): Correct logic for the case where B3 isn't the return register. + * config/c6x/pr-support.c (pop_compact_frame, pop_frame): Correct + logic for doubleword pops. + 2011-10-25 Andreas Tobler * config/rs6000/t-freebsd: Add wildcard. Index: libgcc/config/c6x/pr-support.c =================================================================== --- libgcc/config/c6x/pr-support.c (revision 180434) +++ libgcc/config/c6x/pr-support.c (working copy) @@ -153,10 +153,7 @@ pop_compact_frame (_Unwind_Context * con { int size; _uw test; - int i; - int regno; - int regno2; - int nregs; + int i, regno, nregs; size = 0; nregs = __builtin_popcount (mask); @@ -167,13 +164,11 @@ pop_compact_frame (_Unwind_Context * con continue; regno = unwind_frame_regs[12 - i]; - /* The last slot is a sigle word, so cannot store a register pair. */ - if (nregs > 2) - regno2 = unwind_frame_regs[13 - i]; - else - regno2 = 0xff; - if ((mask & (test << 1)) != 0 && regno2 == regno + 1 && (regno & 1) == 0) + if (i < 12 && nregs > 2 + && (mask & (test << 1)) != 0 + && unwind_frame_regs[11 - i] == regno + 1 + && (regno & 1) == 0) { i++; nregs--; @@ -196,12 +191,11 @@ pop_compact_frame (_Unwind_Context * con continue; regno = unwind_frame_regs[12 - i]; - if (nregs > 2) - regno2 = unwind_frame_regs[13 - i]; - else - regno2 = 0xff; - if ((mask & (test << 1)) != 0 && regno2 == regno + 1 && (regno & 1) == 0) + if (i < 12 && nregs > 2 + && (mask & (test << 1)) != 0 + && unwind_frame_regs[11 - i] == regno + 1 + && (regno & 1) == 0) { /* Register pair. */ unwind_restore_pair (context, regno, ptr); @@ -243,7 +237,7 @@ pop_frame (_Unwind_Context * context, _u if ((mask & (1 << i)) == 0) continue; regno = unwind_frame_regs[12 - i]; - if (i < 12 && unwind_frame_regs[13 - i] == (regno + 1) + if (i < 12 && unwind_frame_regs[11 - i] == (regno + 1) && (mask & (1 << (i + 1))) != 0 && (((_uw)ptr) & 4) == 0 && (regno & 1) == 0) Index: libgcc/ChangeLog =================================================================== --- libgcc/ChangeLog (revision 180431) +++ libgcc/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2011-10-25 Bernd Schmidt + + * config/c6x/pr-support.c (__gnu_unwind_24bit): Correct logic for the + case where B3 isn't the return register. + 2011-10-25 Andreas Tobler * config/rs6000/t-freebsd: Add wildcard. Index: libgcc/config/c6x/pr-support.c =================================================================== --- libgcc/config/c6x/pr-support.c (revision 180262) +++ libgcc/config/c6x/pr-support.c (working copy) @@ -273,6 +273,14 @@ __gnu_unwind_24bit (_Unwind_Context * co _uw mask; _uw *ptr; _uw tmp; + int ret_reg = unwind_frame_regs[data & 0xf]; + + if (ret_reg != R_B3) + { + _Unwind_VRS_Get (context, _UVRSC_CORE, unwind_frame_regs[data & 0xf], + _UVRSD_UINT32, &tmp); + _Unwind_VRS_Set (context, _UVRSC_CORE, R_B3, _UVRSD_UINT32, &tmp); + } mask = (data >> 4) & 0x1fff; @@ -291,8 +299,7 @@ __gnu_unwind_24bit (_Unwind_Context * co else pop_frame (context, mask, ptr, offset != 0x7f); - _Unwind_VRS_Get (context, _UVRSC_CORE, unwind_frame_regs[data & 0xf], - _UVRSD_UINT32, &tmp); + _Unwind_VRS_Get (context, _UVRSC_CORE, R_B3, _UVRSD_UINT32, &tmp); _Unwind_VRS_Set (context, _UVRSC_CORE, R_PC, _UVRSD_UINT32, &tmp); return _URC_OK;