Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 39020
b: refs/heads/master
c: 51ec28e
h: refs/heads/master
v: v3
  • Loading branch information
Andi Kleen authored and Andi Kleen committed Oct 5, 2006
1 parent 0eb4fd0 commit d6ca8c9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 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: f015c6c4d733f68cbc1c5d231bb158abaa5c9606
refs/heads/master: 51ec28e1b2cb267a09a0b8eac1ccf8d61b7268bf
6 changes: 5 additions & 1 deletion trunk/arch/i386/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ extern void kernel_thread_helper(void);
int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
{
struct pt_regs regs;
int err;

memset(&regs, 0, sizeof(regs));

Expand All @@ -342,7 +343,10 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
regs.eflags = X86_EFLAGS_IF | X86_EFLAGS_SF | X86_EFLAGS_PF | 0x2;

/* Ok, create the new process.. */
return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
err = do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
if (err == 0) /* terminate kernel stack */
task_pt_regs(current)->eip = 0;
return err;
}
EXPORT_SYMBOL(kernel_thread);

Expand Down
5 changes: 5 additions & 0 deletions trunk/arch/x86_64/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,11 @@ ENTRY(kernel_thread)
call do_fork
movq %rax,RAX(%rsp)
xorl %edi,%edi
test %rax,%rax
jnz 1f
/* terminate stack in child */
movq %rdi,RIP(%rsp)
1:

/*
* It isn't worth to check for reschedule here,
Expand Down

0 comments on commit d6ca8c9

Please sign in to comment.