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: 3417 Received: (qmail 16405 invoked by alias); 27 Oct 2014 08:00:21 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk 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 Authentication-Results: sourceware.org; auth=none 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-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=v4WqbRnW7Nqy+lSvHnDG5lNZO2MMXb9teSlbykUQkF4=; b=VMrJnYJN3S3+djyvkIFK1aFt93yZMS32m75ihQnvuk6Ll6qYaIF2NMaGNyj08DmPIG Ma+TyT7f6vSuNeEl/w7JlXCk0kOHpWqydQNly1C2eqRIVYPl2ltyZg5jjPKavDEjDwyj YEMzMwJdrDSGjCBNcRveTDmsD9uLrU1r5YWMmrE7Nrvu7E2U1/pF2hfKL9cZ3HCFlGIY iDD2M81zmxKccJLuefD7UmWOPwZMQy5fWQqGHRIdaUtFvIiCZh9df1DqKve/cTS65cA8 mmTJZMt/0yemEVlm7gB70wE9UBUXYGc3JfBgpFas7kNoaD9kHyttxTfbb3DUBpsgpdTO ed1Q== X-Gm-Message-State: ALoCoQkhYitl5W8G4+tVL1MwMeYA2EHKKpOWNwrDSZckrmejFSV8Cil98K6LEFiAvlu0yGSxcSJe 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> 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 } }