* [PATCH 04/32] arm: copy_thread(): rename 'stk_sz' argument to 'kthread_arg'
[not found] <1426269888-25600-1-git-send-email-alexinbeijing@gmail.com>
@ 2015-03-13 18:04 ` Alex Dowad
2015-03-13 18:04 ` [PATCH 05/32] arm64: " Alex Dowad
1 sibling, 0 replies; 2+ messages in thread
From: Alex Dowad @ 2015-03-13 18:04 UTC (permalink / raw)
To: linux-arm-kernel
'stk_sz' is a misnomer: it is never used for a stack size. Rather, it is an
argument which is passed to the main function executed by a kernel thread, when
forking a new kthread. The most appropriate name is 'kthread_arg'.
Signed-off-by: Alex Dowad <alexinbeijing@gmail.com>
---
arch/arm/kernel/process.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index fdfa3a7..4183ebd 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -342,9 +342,12 @@ void release_thread(struct task_struct *dead_task)
asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
+/*
+ * Copy architecture-specific thread state
+ */
int
copy_thread(unsigned long clone_flags, unsigned long stack_start,
- unsigned long stk_sz, struct task_struct *p)
+ unsigned long kthread_arg, struct task_struct *p)
{
struct thread_info *thread = task_thread_info(p);
struct pt_regs *childregs = task_pt_regs(p);
@@ -352,13 +355,15 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start,
memset(&thread->cpu_context, 0, sizeof(struct cpu_context_save));
if (likely(!(p->flags & PF_KTHREAD))) {
+ /* user thread */
*childregs = *current_pt_regs();
childregs->ARM_r0 = 0;
if (stack_start)
childregs->ARM_sp = stack_start;
} else {
+ /* kernel thread */
memset(childregs, 0, sizeof(struct pt_regs));
- thread->cpu_context.r4 = stk_sz;
+ thread->cpu_context.r4 = kthread_arg;
thread->cpu_context.r5 = stack_start;
childregs->ARM_cpsr = SVC_MODE;
}
--
2.0.0.GIT
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 05/32] arm64: copy_thread(): rename 'stk_sz' argument to 'kthread_arg'
[not found] <1426269888-25600-1-git-send-email-alexinbeijing@gmail.com>
2015-03-13 18:04 ` [PATCH 04/32] arm: copy_thread(): rename 'stk_sz' argument to 'kthread_arg' Alex Dowad
@ 2015-03-13 18:04 ` Alex Dowad
1 sibling, 0 replies; 2+ messages in thread
From: Alex Dowad @ 2015-03-13 18:04 UTC (permalink / raw)
To: linux-arm-kernel
'stk_sz' is a misnomer: it is never used for a stack size. Rather, it is an
argument which is passed to the main function executed by a kernel thread, when
forking a new kthread. The most appropriate name is 'kthread_arg'.
Signed-off-by: Alex Dowad <alexinbeijing@gmail.com>
---
arch/arm64/kernel/process.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index fde9923..734e2b6 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -242,8 +242,11 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
asmlinkage void ret_from_fork(void) asm("ret_from_fork");
+/*
+ * Copy architecture-specific thread state
+ */
int copy_thread(unsigned long clone_flags, unsigned long stack_start,
- unsigned long stk_sz, struct task_struct *p)
+ unsigned long kthread_arg, struct task_struct *p)
{
struct pt_regs *childregs = task_pt_regs(p);
unsigned long tls = p->thread.tp_value;
@@ -251,6 +254,7 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start,
memset(&p->thread.cpu_context, 0, sizeof(struct cpu_context));
if (likely(!(p->flags & PF_KTHREAD))) {
+ /* user thread */
*childregs = *current_pt_regs();
childregs->regs[0] = 0;
if (is_compat_thread(task_thread_info(p))) {
@@ -276,10 +280,11 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start,
if (clone_flags & CLONE_SETTLS)
tls = childregs->regs[3];
} else {
+ /* kernel thread */
memset(childregs, 0, sizeof(struct pt_regs));
childregs->pstate = PSR_MODE_EL1h;
p->thread.cpu_context.x19 = stack_start;
- p->thread.cpu_context.x20 = stk_sz;
+ p->thread.cpu_context.x20 = kthread_arg;
}
p->thread.cpu_context.pc = (unsigned long)ret_from_fork;
p->thread.cpu_context.sp = (unsigned long)childregs;
--
2.0.0.GIT
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-13 18:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1426269888-25600-1-git-send-email-alexinbeijing@gmail.com>
2015-03-13 18:04 ` [PATCH 04/32] arm: copy_thread(): rename 'stk_sz' argument to 'kthread_arg' Alex Dowad
2015-03-13 18:04 ` [PATCH 05/32] arm64: " Alex Dowad
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).