lkml.org 
[lkml]   [2015]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[RFC V2] 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.

Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
---
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



\
 
 \ /
  Last update: 2015-05-18 09:41    [W:1.994 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site