From patchwork Fri Sep 20 06:12:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkataramanan Kumar X-Patchwork-Id: 20471 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0FE0228EA5 for ; Fri, 20 Sep 2013 06:12:04 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id f12sf9592583vbg.3 for ; Thu, 19 Sep 2013 23:12:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :date:message-id:subject:from:to:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=XY7jQ6iDu3gNvdCqlHkb8A5Bqm4BJ2DqYtpLkWUrs5E=; b=dzNJS6HUkqNRHTNWdAdUE/1YFeX+HttRA1HQaGc3WO44Lee1eSo7sQUW6TVwMyREbd e2oay0YKJdH3taju3kN1v8euprDRKqdf8fyyEfjr9C2u7XnAhEi1c/fFwrZr8mtPe5h9 EWiwSk+Gra8JTguHiXLVkXfxYqp7EyDK6KWHR2THiQfh3Fx1kvmo0jEvWRDtlW/6hUnV iPwrHSBchwzl0R38IlX4LKFVmXGS5Rt8z8D8CIwsTPlXqYOlXsggbfxBVVz76Vs9nOBI QId2186F/a4DOIHi0zeill5a2ri46vTSkW4vKqolDn//ZOq2rK0O/wtKBP+7OP6PTsoB 4Lvg== X-Gm-Message-State: ALoCoQluxlch3fZCK//57KbNUBClB/Xj09lH+mvZYVOk2mGcwlEZHAp+MVv9JyJaygubs1sctcIh X-Received: by 10.224.96.136 with SMTP id h8mr1563507qan.8.1379657523915; Thu, 19 Sep 2013 23:12:03 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.17.98 with SMTP id n2ls147533qed.12.gmail; Thu, 19 Sep 2013 23:12:03 -0700 (PDT) X-Received: by 10.221.64.17 with SMTP id xg17mr4779746vcb.5.1379657523765; Thu, 19 Sep 2013 23:12:03 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id tq4si2732225vdc.129.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Sep 2013 23:12:03 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id oy12so7501931veb.40 for ; Thu, 19 Sep 2013 23:12:03 -0700 (PDT) X-Received: by 10.58.201.73 with SMTP id jy9mr4826304vec.20.1379657523680; Thu, 19 Sep 2013 23:12:03 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp606vcz; Thu, 19 Sep 2013 23:12:02 -0700 (PDT) X-Received: by 10.224.132.65 with SMTP id a1mr3291819qat.73.1379657521982; Thu, 19 Sep 2013 23:12:01 -0700 (PDT) Received: from mail-qc0-f182.google.com (mail-qc0-f182.google.com [209.85.216.182]) by mx.google.com with ESMTPS id y9si5174918qar.176.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Sep 2013 23:12:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.216.182 is neither permitted nor denied by best guess record for domain of venkataramanan.kumar@linaro.org) client-ip=209.85.216.182; Received: by mail-qc0-f182.google.com with SMTP id n4so6003083qcx.41 for ; Thu, 19 Sep 2013 23:12:01 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.224.80.134 with SMTP id t6mr3368139qak.48.1379657521454; Thu, 19 Sep 2013 23:12:01 -0700 (PDT) Received: by 10.140.86.47 with HTTP; Thu, 19 Sep 2013 23:12:01 -0700 (PDT) In-Reply-To: References: Date: Fri, 20 Sep 2013 11:42:01 +0530 Message-ID: Subject: Fwd: [RFC] [PATCH] [v2] AArch64 - Add parameter to __mount routine and register signal handler for profiling. From: Venkataramanan Kumar To: Marcus Shawcroft , Marcus Shawcroft , Patch Tracking X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: venkataramanan.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , FYI ---------- Forwarded message ---------- From: Venkataramanan Kumar Date: 20 September 2013 11:41 Subject: [RFC] [PATCH] [v2] AArch64 - Add parameter to __mount routine and register signal handler for profiling. To: libc-ports@sourceware.org Hi Maintainers, This is version 2 patch that supports profiling in AArch64. Ref: https://sourceware.org/ml/libc-ports/2013-09/msg00090.html This patch in addition to the previous patch, includes changes needed to register signal handler "profil_counter " for profiling in AArch64. For execution time profiling for gprof, we need to register the "profile_counter" signal handler in the same way as other port does in "sigcontextinfo.h". I have started cross tests in ARMV8 foundation model. 2013-09-20 Venkataramanan Kumar * sysdeps/aarch64/machine-gmon.h (__mcount): Accept parameter and pass it to mcount_internal. * sysdeps/unix/sysv/linux/sigcontextinfo.h: New file regards, Venkat diff --git a/ports/sysdeps/aarch64/machine-gmon.h b/ports/sysdeps/aarch64/machine-gmon.h index 4425965..5cc2941 100644 --- a/ports/sysdeps/aarch64/machine-gmon.h +++ b/ports/sysdeps/aarch64/machine-gmon.h @@ -16,10 +16,9 @@ License along with the GNU C Library; if not, see . */ -/* GCC version 2 gives us a perfect magical function to get - just the information we need: - void *__builtin_return_address (unsigned int N) - returns the return address of the frame N frames up. */ +/* Accept 'frompc' address as argument from the function that calls + __mcount for profiling. Use __builtin_return_address (0) + for the 'selfpc' address. */ #include @@ -28,8 +27,8 @@ static void mcount_internal (u_long frompc, u_long selfpc); #define _MCOUNT_DECL(frompc, selfpc) \ static inline void mcount_internal (u_long frompc, u_long selfpc) -#define MCOUNT \ -void __mcount (void) \ -{ \ - mcount_internal ((u_long) RETURN_ADDRESS (1), (u_long) RETURN_ADDRESS (0)); \ +#define MCOUNT \ +void __mcount (void *frompc) \ +{ \ + mcount_internal ((u_long) frompc, (u_long) RETURN_ADDRESS (0)); \ } diff --git a/ports/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h b/ports/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h new file mode 100644 index 0000000..f660d1e --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h @@ -0,0 +1,36 @@ +/* AArch64 definitions for profiling support. + Copyright (C) 1996-2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include "kernel-features.h" + +#define SIGCONTEXT siginfo_t *_si, struct ucontext * +#define GET_PC(ctx) ((void *) (ctx)->uc_mcontext.pc) + +/* There is no reliable way to get the sigcontext unless we use a + three-argument signal handler. */ +#define __sigaction(sig, act, oact) ({ \ + (act)->sa_flags |= SA_SIGINFO; \ + (__sigaction) (sig, act, oact); \ +}) + +#define sigaction(sig, act, oact) ({ \ + (act)->sa_flags |= SA_SIGINFO; \ + (sigaction) (sig, act, oact); \ +}) +