From: yalin wang <yalin.wang2010@gmail.com>
To: will.deacon@arm.com, linux-arm-kernel@lists.infradead.org,
linux@arm.linux.org.uk, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
viro@zeniv.linux.org.uk, Neil.Gao@sonymobile.com
Subject: [RFC V2] arm:consider THUMB and BE endian kernel build
Date: Mon, 18 May 2015 15:36:10 +0800 [thread overview]
Message-ID: <5559966A.5010006@gmail.com> (raw)
In-Reply-To: <5559527F.9090300@gmail.com>
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
next prev parent reply other threads:[~2015-05-18 7:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-18 2:46 [RFC] arm:consider THUMB and BE endian kernel build yalin wang
2015-05-18 2:46 ` yalin wang
2015-05-18 7:36 ` yalin wang [this message]
2015-05-18 9:40 ` [RFC V2] " Russell King - ARM Linux
2015-05-18 9:40 ` Russell King - ARM Linux
2015-05-18 9:52 ` yalin wang
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=5559966A.5010006@gmail.com \
--to=yalin.wang2010@gmail.com \
--cc=Neil.Gao@sonymobile.com \
--cc=akpm@linux-foundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=viro@zeniv.linux.org.uk \
--cc=will.deacon@arm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.