From patchwork Mon Mar 7 11:51:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 592915 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1C20C1402A0 for ; Mon, 7 Mar 2016 22:53:02 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1actie-0001Oa-RB; Mon, 07 Mar 2016 11:53:00 +0000 Received: from smtprelay.synopsys.com ([198.182.60.111]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1actid-0001JP-0n for linux-snps-arc@lists.infradead.org; Mon, 07 Mar 2016 11:52:59 +0000 Received: from us02secmta1.synopsys.com (us02secmta1.synopsys.com [10.12.235.96]) by smtprelay.synopsys.com (Postfix) with ESMTP id 61CF710C12D6; Mon, 7 Mar 2016 03:52:38 -0800 (PST) Received: from us02secmta1.internal.synopsys.com (us02secmta1.internal.synopsys.com [127.0.0.1]) by us02secmta1.internal.synopsys.com (Service) with ESMTP id 548324E22B; Mon, 7 Mar 2016 03:52:38 -0800 (PST) Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by us02secmta1.internal.synopsys.com (Service) with ESMTP id 32EEC4E202; Mon, 7 Mar 2016 03:52:38 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 1EF29DB5; Mon, 7 Mar 2016 03:52:38 -0800 (PST) Received: from us01wehtc1.internal.synopsys.com (us01wehtc1-vip.internal.synopsys.com [10.12.239.236]) by mailhost.synopsys.com (Postfix) with ESMTP id 077BDDB2; Mon, 7 Mar 2016 03:52:38 -0800 (PST) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by us01wehtc1.internal.synopsys.com (10.12.239.235) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 7 Mar 2016 03:52:21 -0800 Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.103) by IN01WEHTCB.internal.synopsys.com (10.144.199.105) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 7 Mar 2016 17:22:19 +0530 Received: from vineet-E7440.internal.synopsys.com (10.12.197.157) by IN01WEHTCA.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 7 Mar 2016 17:22:18 +0530 From: Vineet Gupta To: Subject: [PATCH] rt_sigaction.h: ARC: Provide default sa_restorer Date: Mon, 7 Mar 2016 17:21:53 +0530 Message-ID: <1457351513-8310-1-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 2.5.0 MIME-Version: 1.0 X-Originating-IP: [10.12.197.157] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160307_035259_081741_79B73C16 X-CRM114-Status: UNSURE ( 7.34 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.60.111 listed in list.dnswl.org] -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [198.182.60.111 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vineet Gupta , linux-snps-arc@lists.infradead.org Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org LTP tests the raw (non libc) sigaction ABI to kernel such as validation of various params. sigaction on ARC relies on default userspace sa restorer to invoke a sigreturn syscall when returning from a signal handler. Thus libc provides a default sa restorer. LTP tests the raw sigaction syscall ABI (w/o libc) hence needs the restorer userspace infrastructure, which this patch provides for ARC. Signed-off-by: Vineet Gupta --- include/lapi/rt_sigaction.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/lapi/rt_sigaction.h b/include/lapi/rt_sigaction.h index 3a5a763ce094..c7fb04fc25be 100644 --- a/include/lapi/rt_sigaction.h +++ b/include/lapi/rt_sigaction.h @@ -145,6 +145,30 @@ static void __attribute__((used)) __sigreturn_stub(void) # endif #endif /* __sparc__ */ +#ifdef __arc__ + +#undef SA_RESTORER +#define SA_RESTORER 0x04000000 + +/* + * based on uClibc/libc/sysdeps/linux/arc/sigaction.c + */ +static void +__attribute__ ((optimize("Os"))) __attribute__((used)) restore_rt(void) +{ + __asm__ ( + "mov r8, %0 \n\t" +#ifdef __ARCHS__ + "trap_s 0 \n\t" +#else + "trap0 \n\t" +#endif + : /* no outputs */ + : "i" (__NR_rt_sigreturn) + : "r8"); +} +#endif + /* This is a wrapper for __NR_rt_sigaction syscall. * act/oact values of INVAL_SA_PTR is used to pass * an invalid pointer to syscall(__NR_rt_sigaction) @@ -176,8 +200,10 @@ static int ltp_rt_sigaction(int signum, const struct sigaction *act, else if (oact) koact_p = &koact; +#if defined __x86_64__ || defined __arc__ #ifdef __x86_64__ sig_initial(signum); +#endif kact.sa_flags |= SA_RESTORER; kact.sa_restorer = restore_rt; #endif