linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: yalin.wang2010@gmail.com (yalin wang)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC] arm:consider THUMB and BE endian kernel build
Date: Mon, 18 May 2015 10:46:23 +0800	[thread overview]
Message-ID: <5559527F.9090300@gmail.com> (raw)

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

             reply	other threads:[~2015-05-18  2:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-18  2:46 yalin wang [this message]
     [not found] ` <5559966A.5010006@gmail.com>
2015-05-18  9:40   ` [RFC V2] arm:consider THUMB and BE endian kernel build Russell King - ARM Linux
2015-05-18  9:52     ` yalin wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5559527F.9090300@gmail.com \
    --to=yalin.wang2010@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).