From patchwork Tue Jun 21 05:07:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 70521 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1832389qgy; Mon, 20 Jun 2016 22:15:24 -0700 (PDT) X-Received: by 10.66.157.8 with SMTP id wi8mr26037455pab.21.1466486124398; Mon, 20 Jun 2016 22:15:24 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id q125si37874723pfq.96.2016.06.20.22.15.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jun 2016 22:15:24 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-70831-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-70831-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-70831-patch=linaro.org@sourceware.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type; q=dns; s=default; b=ndsIm SuQBfw6utz8PHydRoRfNGJecb0cBvulDRmlIId5ZcG6YcHFEWmjVXmlwelTMceaS YXgC9M3PrSezbY7xtoNZ6/DVC05jpVaiHUs3sERAv+4qfEW4zY3sfXETnPvooQOe zs8mtW6Cn0fluMN3UTM1Umn+YdibckRM2kH70o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type; s=default; bh=lpF/ictnLpA ezWbe+theyHwA7nA=; b=f2NsidnCDxKvrx0hWDZh4+wkerU9U4ITIKw8XwVeTpQ P2ygYWOhqh6UkIyisct1qi8JgkcaH/Ngpt/doCwwfy0untm1kTuU4ayGFdoYZPsD I9jbzjIp2XOyVqBpu4NcaTa8awWrnTFIeXOEuGU9A1e90ZdEftc65iFcfpUydWBk = Received: (qmail 26840 invoked by alias); 21 Jun 2016 05:13:35 -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 20208 invoked by uid 89); 21 Jun 2016 05:13:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=5711, 5511, act X-HELO: na01-by2-obe.outbound.protection.outlook.com Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; From: Yury Norov To: , CC: , , , , , , , , , Andrew Pinski , Yury Norov Subject: [PATCH 18/27] [AARCH64] Add kernel_sigaction.h for AARCH64 ILP32 Date: Tue, 21 Jun 2016 08:07:02 +0300 Message-ID: <1466485631-3532-20-git-send-email-ynorov@caviumnetworks.com> In-Reply-To: <1466485631-3532-1-git-send-email-ynorov@caviumnetworks.com> References: <1466485631-3532-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-ClientProxiedBy: HE1PR03CA0035.eurprd03.prod.outlook.com (10.163.170.173) To SN1PR07MB2254.namprd07.prod.outlook.com (10.164.47.148) X-MS-Office365-Filtering-Correlation-Id: b539c472-7444-48ba-8042-08d399927553 X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2254; 2:Sz3q+/WutABrF8WjOLinIeDUi6Rc21Ju6QD6UhkcNxHKN8SlbrR8I1GNfr2IB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qxS24xw7PfC02DvLHFF3aMxR1l9FRaVOY+r73/0G8kF2VFGPUtVE8GEjk0tZdCINl+AUh8ws0Yd7dtdkzLxkpcIKYKHSKvK1pYlX+8FEfJYfULD7foK2bPPKqSJiJzVhDlc2bQdBlG1C4mljOJRB8yIJJ2YAbE2htCgHChto4dvDoWMthxU3Pw5zkTxMsgJcSH3dEvbcpbDQaNkbmsfXtyMhut8iE6qRPDt1pg6fagZxfcd7eXGek4s7NTyfOd4Hmbr8lCl94DpDgcaaQeC/i5GzOJMbIHoobIRDMZF+P/FSzgNc9sG411JA7lB1xWxvmGZ2/bGYkSRbhAmS+PNFfD28HVCo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:SN1PR07MB2254; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2254; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2254; 4:ynrxvVdr3BH6/GwLrQ+DNyzbglpdGAyZ4dKK3NtKoWV79Mn+lpgu3ohExEldLWFjqJP3M7zjVU9F3j7Jzke6T2PARULtyTIRcVMxAvSLWFBDYHVYnRrVIqecSvtoTwEE+vY6qOyyBsJxxcTG+eHn99TbKNW1sqlr0DPWbc18SsVfzx9LbZ49lORuhtY/FaazlH5jDB9HFZylNf7ebyJmmpNBSEnZtE3T0ewML7hgPoUok7D9Ks77xmDJEOr5xP4Rj0A+HFRsHygX5RIYGAVurgNjC77jBIBzAUlnlnbf7/LppcoCKyakpPDFPildJj1nE4SgsAoKWxhJBxcwOKZN8t2EajsPd2tln1VezA5RsrLvEF0jx2M5roeQlCHBU98T X-Forefront-PRVS: 098076C36C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(199003)(189002)(66066001)(4001430100002)(4326007)(5003940100001)(36756003)(2906002)(47776003)(19580395003)(50226002)(7736002)(5001770100001)(42186005)(97736004)(19580405001)(189998001)(106356001)(81166006)(92566002)(81156014)(8676002)(77096005)(33646002)(105586002)(50986999)(76176999)(586003)(2950100001)(48376002)(76506005)(68736007)(101416001)(107886002)(7846002)(3846002)(50466002)(229853001)(6116002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2254; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR07MB2254; 23:sRKMO9MtBZY72wXpNqbCv28kKvG17xFWdilL2sjwa?= =?us-ascii?Q?8XjJ/TRVsORegajdJI0DucIKHnXjB4Nx+Ubzm9D90i1u3+STH/CZSc26x3e7?= =?us-ascii?Q?lrMl79sAc/wwOfSyRlyfjjINHyIdcZPAoDXRmtJMXJDMz4SWWyvX292BocjA?= =?us-ascii?Q?ripRwmTkLYV2DO0dQaNTVcLhqhz07OcFTntvqafvlmSFF0NK5UnGVDdWH5Wv?= =?us-ascii?Q?d5TBqO3TVczu6Fei6cJlIHzX7XMhGafPek+9hW8Z/cFVQ3MfTJHhe6bh8lfW?= =?us-ascii?Q?gPOq/I0YtfC3qNqW/WLbX4H9z6VZ1+DSXCodu8DYzlIdMCTqpaGuuwtC4Y2Z?= =?us-ascii?Q?0SRA9F7rxft5yY11lmvUITX1rkZDn0t48obGYgWDt0upDMFkdsEMXkgYoklp?= =?us-ascii?Q?u5TMC8dhBUBbB+c5vDb8F/7peJ5poLwJZkxjpASASxKPClMsYcENi/Cs+uWO?= =?us-ascii?Q?GL890FC/I//hLsmiFuRmM/B49xEqQZ01bpi1/E9IErIPt9wiTu9+Xgou2nZ1?= =?us-ascii?Q?ODlRWGgJCaR++MqtVYo5aOMhwxlpBu4p6JF9sM9x8JS9eI3ZTM7rchgBop5y?= =?us-ascii?Q?iizhv/UiZQA3WocTCu6mAORF4m183X9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ZVZCKwQu55HBGtsZnVLdLtxnq0Jp2KNCnGCF6tPI9axHKXf2Hbv22r2RlIz6gvaw==; 24:sESNxJn+zoer/xyoKKKnxFHmVklCb7hBwF/jAr4+uQ6/H4sEwF0TmbCmYpY9QUT/g38muFmbRl7GDz9DB/2tDKKpFoS3MiPxScpL1Aos71I=; 7:Lyvxpzm+RoTftHyLvsjymnDLllSZopkSGdmIwjLHDFg93FdWumgvePldL09tARgcacZQmCcu++s8MerHnOWfm+v9kCGKx5mAaI/5F9Nj98CTuK+L2h1Ej9SGVCtiJ1t7Vfw4+cOuux8IWOYHt8q7oljDiRZhtlGpdosQ8iYiN7ZkdP3FavKhAB44+Iy7KWaVwsCVRUX/b359w7vvzYK77Skobj/2Se+6lYuj3rbKgtcOsat2cEWOLv2BVF8+6Vkh SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2016 05:11:09.7389 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2254 From: Andrew Pinski 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. Signed-off-by: Yury Norov --- 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 -- 2.7.4 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 3291924..40a327f 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 } }