linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC] arm:consider THUMB and BE endian kernel build
@ 2015-05-18  2:46 yalin wang
       [not found] ` <5559966A.5010006@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: yalin wang @ 2015-05-18  2:46 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-18  9:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-18  2:46 [RFC] arm:consider THUMB and BE endian kernel build yalin wang
     [not found] ` <5559966A.5010006@gmail.com>
2015-05-18  9:40   ` [RFC V2] " Russell King - ARM Linux
2015-05-18  9:52     ` yalin wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).