[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <5559527F.9090300@gmail.com>
Date: Mon, 18 May 2015 10:46:23 +0800
From: yalin wang <yalin.wang2010@...il.com>
To: will.deacon@....com, linux-arm-kernel@...ts.infradead.org,
linux@....linux.org.uk, linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
viro@...iv.linux.org.uk, Neil.Gao@...ymobile.com
Subject: [RFC] arm:consider THUMB and BE endian kernel build
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists