From patchwork Wed May 22 10:30:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 245582 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 3221D2C00A1 for ; Wed, 22 May 2013 20:39:52 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=gHkQge0t9UO0sU5T UuNFPOEPedMynAAE91wEG4lrOso65cvKANOk18GcexAwZNix/+pbSYJ09NBegnY6 UNpDNpNfaob7VoWKUxl/APDM5T40Rcvgq/7Tynx0D5BaBHrMBni0qbt5zqa1XNT2 rlGpjOwMNNM/VMSAs373ogSEyHk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=zRl7rdU29/TBgPFSvaqNHH Jd+bs=; b=VrLJpCUWYBHI8BXCIBD7966xm+V5V3+BvinaMTeThC2bdTvxZXDsOG XFqrqQFHqiGwqTwo6rLjIq/52bEF1moSVke9cmsb39TEC04S4VT5/QU7gkmH1q0r Y6ZDqfM1KDWIwt5GLhn8SC3b0xTvnQldqFS+bjltCKKeSrbPeLe8c= Received: (qmail 4527 invoked by alias); 22 May 2013 10:39:45 -0000 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 Received: (qmail 4495 invoked by uid 89); 22 May 2013 10:39:43 -0000 X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.1 Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 22 May 2013 10:39:42 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 939252646DF7 for ; Wed, 22 May 2013 12:38:21 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MqvdS6hP-InN for ; Wed, 22 May 2013 12:38:21 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 6D5642646DE1 for ; Wed, 22 May 2013 12:38:21 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [SPARC] Small tweaks to config/sparc/sol2-unwind.h Date: Wed, 22 May 2013 12:30:36 +0200 Message-ID: <8204423.eJV4FWs8jP@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.19-desktop; KDE/4.7.2; x86_64; ; ) MIME-Version: 1.0 X-Virus-Found: No This silences a maybe-uninitialized warning, removes an obsolete comment and changes the CFA offset of individual registers to comprise the global CFA offset, thus making it possible to remove the special-casing of signal frames from sparc64_frob_update_context. Tested on SPARC/Solaris, applied on the mainline. 2013-05-22 Eric Botcazou * config/sparc/sol2-unwind.h (sparc64_frob_update_context): Do it for signal frames as well. (MD_FALLBACK_FRAME_STATE_FOR): Do minor cleanups throughout and add the STACK_BIAS to the CFA offset. Index: libgcc/config/sparc/sol2-unwind.h =================================================================== --- libgcc/config/sparc/sol2-unwind.h (revision 199091) +++ libgcc/config/sparc/sol2-unwind.h (working copy) @@ -155,12 +155,10 @@ sparc64_frob_update_context (struct _Unw { /* The column of %sp contains the old CFA, not the old value of %sp. The CFA offset already comprises the stack bias so, when %sp is the - CFA register, we must avoid counting the stack bias twice. Do not - do that for signal frames as the offset is artificial for them. */ + CFA register, we must avoid counting the stack bias twice. */ if (fs->regs.cfa_reg == __builtin_dwarf_sp_column () && fs->regs.cfa_how == CFA_REG_OFFSET - && fs->regs.cfa_offset != 0 - && !fs->signal_frame) + && fs->regs.cfa_offset != 0) { long i; @@ -296,9 +294,8 @@ MD_FALLBACK_FRAME_STATE_FOR (struct _Unw _Unwind_FrameState *fs) { void *pc = context->ra; - struct frame *fp = (struct frame *) context->cfa; - int nframes; void *this_cfa = context->cfa; + int nframes = 0; long new_cfa; void *ra_location, *shifted_ra_location; mcontext_t *mctx; @@ -318,21 +315,22 @@ MD_FALLBACK_FRAME_STATE_FOR (struct _Unw return _URC_NO_REASON; } + /* Do some pattern matching at the return address. */ if (IS_SIGHANDLER (pc, this_cfa, &nframes)) { + struct frame *fp = (struct frame *) this_cfa; struct handler_args { struct frame frwin; ucontext_t ucontext; } *handler_args; ucontext_t *ucp; - /* context->cfa points into the frame after the saved frame pointer and + /* this_cfa points into the frame after the saved frame pointer and saved pc (struct frame). The ucontext_t structure is in the kernel frame after a struct frame. Since the frame sizes vary even within OS releases, we need to walk the stack to get there. */ - for (i = 0; i < nframes; i++) fp = (struct frame *) ((char *)fp->fr_savfp + STACK_BIAS); @@ -340,19 +338,15 @@ MD_FALLBACK_FRAME_STATE_FOR (struct _Unw ucp = &handler_args->ucontext; mctx = &ucp->uc_mcontext; } - - /* Exit if the pattern at the return address does not match the - previous three patterns. */ else return _URC_END_OF_STACK; - new_cfa = mctx->gregs[REG_SP]; /* The frame address is %sp + STACK_BIAS in 64-bit mode. */ - new_cfa += STACK_BIAS; + new_cfa = mctx->gregs[REG_SP] + STACK_BIAS; fs->regs.cfa_how = CFA_REG_OFFSET; fs->regs.cfa_reg = __builtin_dwarf_sp_column (); - fs->regs.cfa_offset = new_cfa - (long) this_cfa; + fs->regs.cfa_offset = new_cfa - (long) this_cfa + STACK_BIAS; /* Restore global and out registers (in this order) from the ucontext_t structure, uc_mcontext.gregs field. */ @@ -372,7 +366,7 @@ MD_FALLBACK_FRAME_STATE_FOR (struct _Unw for (i = 0; i < 16; i++) { fs->regs.reg[i + 16].how = REG_SAVED_OFFSET; - fs->regs.reg[i + 16].loc.offset = i*sizeof(long); + fs->regs.reg[i + 16].loc.offset = i * sizeof(long); } /* Check whether we need to restore FPU registers. */