From patchwork Mon May 18 02:46:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yalin wang X-Patchwork-Id: 6425961 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 45294C0432 for ; Mon, 18 May 2015 02:49:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7601F20624 for ; Mon, 18 May 2015 02:49:47 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 89A86205DF for ; Mon, 18 May 2015 02:49:46 +0000 (UTC) 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 1YuB4w-00052m-08; Mon, 18 May 2015 02:46:54 +0000 Received: from mail-pd0-x234.google.com ([2607:f8b0:400e:c02::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YuB4s-00051x-Ht for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2015 02:46:51 +0000 Received: by pdbqa5 with SMTP id qa5so128603624pdb.0 for ; Sun, 17 May 2015 19:46:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=B1oWasqGurjG1ba8179z9a54z5zb2L5+LJxfT5RIrps=; b=iZuO9EhywbOFyif2Yd1fPL7fUoKFYaHgjgFyNM+vd3bxQMaVHvFTrcMdQrxQLwuQR8 y3L7z5f/mq4qhuoszjMdqOcozIFaX908/+qdfvg6w6RQGjZ5WVtkqg+G2W1PjzyagoPY Nxf1xqaV1nYn0m4IROV82J8uVZN1cNw7mhPUj709VLdKeeqMQW6bSSUggr6eGJH6yWdl 1YdbwMlbk39Gnt00jQ5kJ8M644LKNIp/Kq6qRYEbPmWYj5mXlYpBq10sAcI45n8WCmGN d3rHOb1x3n2bw0qoooFZ7pjw/jURM2kLK/ELm83VjbtSe0HFoO6aO/RRLa1NvYrYc57X cvmg== X-Received: by 10.68.69.79 with SMTP id c15mr3332023pbu.25.1431917189221; Sun, 17 May 2015 19:46:29 -0700 (PDT) Received: from [172.16.20.103] ([192.200.196.227]) by mx.google.com with ESMTPSA id ja1sm4459586pbc.51.2015.05.17.19.46.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 May 2015 19:46:28 -0700 (PDT) Message-ID: <5559527F.9090300@gmail.com> Date: Mon, 18 May 2015 10:46:23 +0800 From: yalin wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: will.deacon@arm.com, linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk, linux-kernel@vger.kernel.org, Andrew Morton , viro@zeniv.linux.org.uk, Neil.Gao@sonymobile.com Subject: [RFC] arm:consider THUMB and BE endian kernel build X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150517_194650_626079_0613A1D4 X-CRM114-Status: UNSURE ( 9.80 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.6 (/) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP this patch fix the function in kernel_thread(), when kernel is build as THUMB2 or BE8 endian, we should also set the correct bit in CPSR, so that kernel can return to the correct state to execute. --- arch/arm/kernel/process.c | 6 ++++++ 1 file changed, 6 insertions(+) thread->cpu_context.sp = (unsigned long)childregs; diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index f192a2a..9a7ab32 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -220,6 +220,12 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start, thread->cpu_context.r4 = stk_sz; thread->cpu_context.r5 = stack_start; childregs->ARM_cpsr = SVC_MODE; +#ifdef CONFIG_THUMB2_KERNEL + childregs->ARM_cpsr |= PSR_T_BIT; +#endif +#ifdef CONFIG_CPU_ENDIAN_BE8 + childregs->ARM_cpsr |= PSR_E_BIT; +#endif } thread->cpu_context.pc = (unsigned long)ret_from_fork;