From patchwork Mon Oct 27 07:59:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 39582 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E51BD2118A for ; Mon, 27 Oct 2014 08:03:39 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id r20sf1587425wiv.6 for ; Mon, 27 Oct 2014 01:03:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:mailing-list :precedence:list-id:list-unsubscribe:list-subscribe:list-archive :list-post:list-help:sender:delivered-to:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results; bh=v4WqbRnW7Nqy+lSvHnDG5lNZO2MMXb9teSlbykUQkF4=; b=GerKyenVMOBwZmv0sptTCquUAw2UBZ7lsNk0Y+HfTB0tvBZYHgclemGMy4ivGlfwnE IAPXKbX6wLU0QJrjMDk7V9hphM6IKlnpSZn0/yPPox3xbvQuxqaLWLeV8prsLBja8/hF w4TMRthO6TpdPQmNPmgAmyH6ubSFIzzH2/LrGTTIZLlJbOumzPK2ajiB5piT/QCNcV2Q u/3tbnwJ0KHcNv5sFWqlzJeRUMVfbUQ5oU6Nhvf5jJBZ93zhtVUFDA6T+rapnxG5UwY/ 5rndD5RerW7TQPPgOPvZOET0UFxoJW4AvbSzDzwnSIlEtKYrn17oeqNwxA4+38Qrw5yY cXag== X-Gm-Message-State: ALoCoQlZu7f6dGbnV1ZDMvUnuFL4woCemD2j4Ksc9vHqkh/SWAVYza4Iid+z/GNEEHU6YuQN5qs7 X-Received: by 10.152.21.170 with SMTP id w10mr59887lae.6.1414397019018; Mon, 27 Oct 2014 01:03:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.133 with SMTP id m5ls662178laf.102.gmail; Mon, 27 Oct 2014 01:03:38 -0700 (PDT) X-Received: by 10.152.43.97 with SMTP id v1mr11320822lal.3.1414397018874; Mon, 27 Oct 2014 01:03:38 -0700 (PDT) Received: from mail-la0-x232.google.com (mail-la0-x232.google.com. [2a00:1450:4010:c03::232]) by mx.google.com with ESMTPS id l2si18701599lbc.48.2014.10.27.01.03.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Oct 2014 01:03:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::232 as permitted sender) client-ip=2a00:1450:4010:c03::232; Received: by mail-la0-f50.google.com with SMTP id s18so5372583lam.37 for ; Mon, 27 Oct 2014 01:03:38 -0700 (PDT) X-Received: by 10.112.97.135 with SMTP id ea7mr21860716lbb.46.1414397018661; Mon, 27 Oct 2014 01:03:38 -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.112.84.229 with SMTP id c5csp247594lbz; Mon, 27 Oct 2014 01:03:38 -0700 (PDT) X-Received: by 10.68.228.102 with SMTP id sh6mr22788101pbc.12.1414397017711; Mon, 27 Oct 2014 01:03:37 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id in8si9775082pbd.244.2014.10.27.01.03.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Oct 2014 01:03:37 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-53815-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 16405 invoked by alias); 27 Oct 2014 08:00:21 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list List-Id: List-Unsubscribe: , List-Subscribe: List-Archive: List-Post: , List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 15559 invoked by uid 89); 27 Oct 2014 08:00:03 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: mail-ig0-f177.google.com X-Received: by 10.107.31.201 with SMTP id f192mr7845407iof.41.1414396800607; Mon, 27 Oct 2014 01:00:00 -0700 (PDT) From: Andrew Pinski To: libc-alpha@sourceware.org Cc: Andrew Pinski Subject: [PATCH 25/29] [AARCH64] Add kernel_sigaction.h for AARCH64 ILP32 Date: Mon, 27 Oct 2014 00:59:49 -0700 Message-Id: <1414396793-9005-26-git-send-email-apinski@cavium.com> In-Reply-To: <1414396793-9005-1-git-send-email-apinski@cavium.com> References: <1414396793-9005-1-git-send-email-apinski@cavium.com> X-Original-Sender: apinski@cavium.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::232 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@sourceware.org X-Google-Group-Id: 836684582541 In ILP32, the sigaction struct is the same as AARCH64 so we need the header file kernel_sigaction.h. To allow for this to work, we use a long long fields and then add extra casts when converting between the user exposed struct and the kernel exposed struct. * sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h: New file. * sysdeps/unix/sysv/linux/aarch64/sigaction.c (__libc_sigaction): Add cast here it is necessary. --- sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h | 12 ++++++++++++ sysdeps/unix/sysv/linux/aarch64/sigaction.c | 10 ++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h diff --git a/sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h b/sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h new file mode 100644 index 0000000..7b3023b --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/kernel_sigaction.h @@ -0,0 +1,12 @@ + +#define HAVE_SA_RESTORER + +/* This is the sigaction structure in aarch64 kernel. + Note the ILP32 struct uses the same struct as LP64 + which is why the fields are 64bit in size. */ +struct kernel_sigaction { + unsigned long long k_sa_handler; + unsigned long long sa_flags; + unsigned long long sa_restorer; + sigset_t sa_mask; +}; diff --git a/sysdeps/unix/sysv/linux/aarch64/sigaction.c b/sysdeps/unix/sysv/linux/aarch64/sigaction.c index ae6c3fd..8adcbba 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sigaction.c +++ b/sysdeps/unix/sysv/linux/aarch64/sigaction.c @@ -39,15 +39,17 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) if (act) { - kact.k_sa_handler = act->sa_handler; + kact.k_sa_handler = (unsigned long long)(uintptr_t)act->sa_handler; memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t)); kact.sa_flags = act->sa_flags; #ifdef HAVE_SA_RESTORER if (kact.sa_flags & SA_RESTORER) - kact.sa_restorer = act->sa_restorer; + kact.sa_restorer = (unsigned long long)(uintptr_t)act->sa_restorer; #endif } + /* This is needed for ILP32 as the structures are two different sizes due to + using the LP64 structure. */ result = INLINE_SYSCALL (rt_sigaction, 4, sig, act ? &kact : NULL, oact ? &koact : NULL, _NSIG / 8); @@ -55,11 +57,11 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) { if (oact && result >= 0) { - oact->sa_handler = koact.k_sa_handler; + oact->sa_handler = (void*)(uintptr_t)koact.k_sa_handler; memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t)); oact->sa_flags = koact.sa_flags; #ifdef HAVE_SA_RESTORER - oact->sa_restorer = koact.sa_restorer; + oact->sa_restorer = (void*)(uintptr_t)koact.sa_restorer; #endif } }