Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752137AbbERCqg (ORCPT ); Sun, 17 May 2015 22:46:36 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:33526 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752073AbbERCq3 (ORCPT ); Sun, 17 May 2015 22:46:29 -0400 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 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1160 Lines: 33 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(+) 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; thread->cpu_context.sp = (unsigned long)childregs; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/