Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 333656
b: refs/heads/master
c: 49ed339
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro committed Oct 1, 2012
1 parent 30e237f commit 568075c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 019f96a345b6e23d4e0bc2c136ec5f7500b95834
refs/heads/master: 49ed3398b75c98c087537a7d5a1a23f86a8c8746
1 change: 1 addition & 0 deletions trunk/arch/frv/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ config FRV
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select GENERIC_CPU_DEVICES
select ARCH_WANT_IPC_PARSE_VERSION
select GENERIC_KERNEL_THREAD

config ZONE_DMA
bool
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/frv/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ static inline void release_thread(struct task_struct *dead_task)
{
}

extern asmlinkage int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
extern asmlinkage void save_user_regs(struct user_context *target);
extern asmlinkage void *restore_user_regs(const struct user_context *target, ...);

Expand Down
41 changes: 19 additions & 22 deletions trunk/arch/frv/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,25 +170,14 @@ asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
* set up the kernel stack and exception frames for a new process
*/
int copy_thread(unsigned long clone_flags,
unsigned long usp, unsigned long topstk,
unsigned long usp, unsigned long arg,
struct task_struct *p, struct pt_regs *regs)
{
struct pt_regs *childregs;

childregs = (struct pt_regs *)
(task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE);

/* set up the userspace frame (the only place that the USP is stored) */
*childregs = *regs;

childregs->sp = usp;
childregs->next_frame = NULL;

if (unlikely(!user_mode(regs)))
p->thread.pc = (unsigned long) ret_from_kernel_thread;
else
p->thread.pc = (unsigned long) ret_from_fork;

p->set_child_tid = p->clear_child_tid = NULL;

p->thread.frame = childregs;
Expand All @@ -198,6 +187,24 @@ int copy_thread(unsigned long clone_flags,
p->thread.lr = 0;
p->thread.frame0 = childregs;

if (unlikely(!regs)) {
memset(childregs, 0, sizeof(struct pt_regs));
childregs->gr9 = usp; /* function */
childregs->gr8 = arg;
chilregs->psr = PSR_S;
p->thread.pc = (unsigned long) ret_from_kernel_thread;
save_user_regs(p->thread.user);
return 0;
}

/* set up the userspace frame (the only place that the USP is stored) */
*childregs = *regs;

childregs->sp = usp;
childregs->next_frame = NULL;

p->thread.pc = (unsigned long) ret_from_fork;

/* the new TLS pointer is passed in as arg #5 to sys_clone() */
if (clone_flags & CLONE_SETTLS)
childregs->gr29 = childregs->gr12;
Expand Down Expand Up @@ -320,13 +327,3 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpregs)
sizeof(current->thread.user->f));
return 1;
}

int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
{
struct pt_regs regs = {
.gr8 = (unsigned long)arg;
.gr9 = (unsigned long)fn;
.psr = PSR_S;
};
return do_fork(flags|CLONE_VM|CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
}

0 comments on commit 568075c

Please sign in to comment.