From patchwork Thu Aug 17 07:23:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 9905153 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8DB326038C for ; Thu, 17 Aug 2017 07:33:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80118286A0 for ; Thu, 17 Aug 2017 07:33:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7504528ABB; Thu, 17 Aug 2017 07:33:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E3F73286A0 for ; Thu, 17 Aug 2017 07:33:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=+eXBMxN16yWKAfSc4N0N6wr2YRgtiwTZoWGq1qYJGG4=; b=ApR/6SBGWgO1T7n35DtncH0u4d T7qJilWd2KmfUikRZ+NxiO0fKGI6qq/vX6//9a3jF0K64zQ4woXTUfB4J00s+bG2kO3HLo8A3yQrG lgGt+idZ+aPfrnHBuwVGnenXObj3lu/aIrc23quDZtvIx5v/kHvdcodo87fPOZhrEmANn6OyP1H21 K5XMkO7uS7jO3cYaY5GFdLg+tbeLdFj2k6v8glQ1Ly2iD4OHAW04BguOpO1HPeAeLpeginiteihl7 za9YofiGSOBBfvP+mIhJua+5WvQz6OHNV6ZrnV2D0cA6+wsXHb8EIcmgdeqBgq2qAepZcSBAxk0UV XMF51kCQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1diFJT-00038g-BZ; Thu, 17 Aug 2017 07:33:55 +0000 Received: from merlin.infradead.org ([205.233.59.134]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1diFAT-0005Mq-Ek for linux-arm-kernel@bombadil.infradead.org; Thu, 17 Aug 2017 07:24:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=kOQiTrRArGBoA9hdjxWBdsVHeU/WqDqgzEjcEWl/aws=; b=KhHrhb3ZUGOmFM7UkSHRIKFoU 3kZ5sLooPaRH54jwLhpHUkpO+2A015Wij0nsCQwlzu+SqhuOL3sH0/tnZCt+ALGlkARH4Rgj7DiWP +rKr1hqEjwS3Om8agEHF9psNFwx7FaIS/pV/Ck5UKABvMy5meYeWRAXhyc+6XKlWucQ5I7Cch58kp tw6wWcUBHbJNrdgzPEZobzuTwZY+Laspofq1fk/k95sBMoMCsm7Q/cDm0XSkSeJmsnTl3BZPzAX6/ iL21u10b01iF6zvV69emacLVzx2enzlQKcRlJfKTcPPohWstIcY4sWZGLVLLJ4QJ5NSpZJ9+9lAvV ULfUtLCNQ==; Received: from pb-smtp2.pobox.com ([64.147.108.71] helo=sasl.smtp.pobox.com) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1diFAQ-0003FG-QD for linux-arm-kernel@lists.infradead.org; Thu, 17 Aug 2017 07:24:36 +0000 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 207CB97893; Thu, 17 Aug 2017 03:24:10 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references; s=sasl; bh=vdS4 iaqxdE5PlZHDgcKCY8WmEy0=; b=K0Y1/2es3xLSxP4UtVozwTWDC8Eg8jtPTgEk p8xxiVXa+YQrPOC3yLHLNoGfpAHizu+hezx0Y3733wuyLsvojaC51I9G0EPw6pbZ l6IxhcG2ddiYwHHcYh32Tr4cjeMK1/AKTrxzi4CYBAqsYNj/3qZREZu2fOjuJgsD 10ct2bI= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 18A9597892; Thu, 17 Aug 2017 03:24:10 -0400 (EDT) Received: from yoda.home (unknown [70.80.200.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id 882D49788F; Thu, 17 Aug 2017 03:24:09 -0400 (EDT) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTP id A83FC2DA0522; Thu, 17 Aug 2017 03:24:08 -0400 (EDT) From: Nicolas Pitre To: Russell King - ARM Linux , linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 1/8] ARM: implement get_tls syscall Date: Thu, 17 Aug 2017 03:23:40 -0400 Message-Id: <20170817072347.19990-2-nicolas.pitre@linaro.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20170817072347.19990-1-nicolas.pitre@linaro.org> References: <20170817072347.19990-1-nicolas.pitre@linaro.org> X-Pobox-Relay-ID: 0F844534-831D-11E7-ABC7-9D2B0D78B957-78420484!pb-smtp2.pobox.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Mickael Guene ." , Alexandre Torgue MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When there is no dedicated register to hold the tp value and no MMU to provide a fixed address kuser helper entry point, all that is left as fallback is a syscall. Signed-off-by: Nicolas Pitre Tested-by: Vincent Abriou --- arch/arm/include/uapi/asm/unistd.h | 1 + arch/arm/kernel/traps.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/arch/arm/include/uapi/asm/unistd.h b/arch/arm/include/uapi/asm/unistd.h index 28bd456494..575b25fc29 100644 --- a/arch/arm/include/uapi/asm/unistd.h +++ b/arch/arm/include/uapi/asm/unistd.h @@ -35,5 +35,6 @@ #define __ARM_NR_usr26 (__ARM_NR_BASE+3) #define __ARM_NR_usr32 (__ARM_NR_BASE+4) #define __ARM_NR_set_tls (__ARM_NR_BASE+5) +#define __ARM_NR_get_tls (__ARM_NR_BASE+6) #endif /* _UAPI__ASM_ARM_UNISTD_H */ diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 948c648fea..43c0560f7b 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -647,6 +647,9 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs) set_tls(regs->ARM_r0); return 0; + case NR(get_tls): + return current_thread_info()->tp_value[0]; + default: /* Calls 9f00xx..9f07ff are defined to return -ENOSYS if not implemented, rather than raising SIGILL. This