diff options
author | Brian Gerst <brgerst@gmail.com> | 2009-12-09 19:01:56 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-12-09 19:29:42 -0500 |
commit | f839bbc5c81b1c92ff8e81c360e9564f7b961b2e (patch) | |
tree | 038fef1b902db9ec43b1ab6b82861ebf2d56eef5 /arch/x86 | |
parent | f1382f157fb1175bba008abad0907310a1e459ce (diff) |
x86: Merge sys_clone
Change 32-bit sys_clone to new PTREGSCALL stub, and merge with 64-bit.
Signed-off-by: Brian Gerst <brgerst@gmail.com>
LKML-Reference: <1260403316-5679-7-git-send-email-brgerst@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/syscalls.h | 8 | ||||
-rw-r--r-- | arch/x86/kernel/entry_32.S | 14 | ||||
-rw-r--r-- | arch/x86/kernel/process.c | 9 | ||||
-rw-r--r-- | arch/x86/kernel/process_32.c | 15 | ||||
-rw-r--r-- | arch/x86/kernel/process_64.c | 9 |
5 files changed, 24 insertions, 31 deletions
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h index df2c51106565..b0ce78061708 100644 --- a/arch/x86/include/asm/syscalls.h +++ b/arch/x86/include/asm/syscalls.h | |||
@@ -25,6 +25,8 @@ int sys_fork(struct pt_regs *); | |||
25 | int sys_vfork(struct pt_regs *); | 25 | int sys_vfork(struct pt_regs *); |
26 | long sys_execve(char __user *, char __user * __user *, | 26 | long sys_execve(char __user *, char __user * __user *, |
27 | char __user * __user *, struct pt_regs *); | 27 | char __user * __user *, struct pt_regs *); |
28 | long sys_clone(unsigned long, unsigned long, void __user *, | ||
29 | void __user *, struct pt_regs *); | ||
28 | 30 | ||
29 | /* kernel/ldt.c */ | 31 | /* kernel/ldt.c */ |
30 | asmlinkage int sys_modify_ldt(int, void __user *, unsigned long); | 32 | asmlinkage int sys_modify_ldt(int, void __user *, unsigned long); |
@@ -42,9 +44,6 @@ asmlinkage int sys_get_thread_area(struct user_desc __user *); | |||
42 | /* X86_32 only */ | 44 | /* X86_32 only */ |
43 | #ifdef CONFIG_X86_32 | 45 | #ifdef CONFIG_X86_32 |
44 | 46 | ||
45 | /* kernel/process_32.c */ | ||
46 | int sys_clone(struct pt_regs *); | ||
47 | |||
48 | /* kernel/signal.c */ | 47 | /* kernel/signal.c */ |
49 | asmlinkage int sys_sigsuspend(int, int, old_sigset_t); | 48 | asmlinkage int sys_sigsuspend(int, int, old_sigset_t); |
50 | asmlinkage int sys_sigaction(int, const struct old_sigaction __user *, | 49 | asmlinkage int sys_sigaction(int, const struct old_sigaction __user *, |
@@ -73,9 +72,6 @@ int sys_vm86(unsigned long, unsigned long, struct pt_regs *); | |||
73 | 72 | ||
74 | /* X86_64 only */ | 73 | /* X86_64 only */ |
75 | /* kernel/process_64.c */ | 74 | /* kernel/process_64.c */ |
76 | asmlinkage long sys_clone(unsigned long, unsigned long, | ||
77 | void __user *, void __user *, | ||
78 | struct pt_regs *); | ||
79 | long sys_arch_prctl(int, unsigned long); | 75 | long sys_arch_prctl(int, unsigned long); |
80 | 76 | ||
81 | /* kernel/sys_x86_64.c */ | 77 | /* kernel/sys_x86_64.c */ |
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index 6c2f25d9b9d5..6492555d123d 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
@@ -760,7 +760,6 @@ ptregs_##name: \ | |||
760 | 760 | ||
761 | PTREGSCALL1(iopl) | 761 | PTREGSCALL1(iopl) |
762 | PTREGSCALL0(fork) | 762 | PTREGSCALL0(fork) |
763 | PTREGSCALL0(clone) | ||
764 | PTREGSCALL0(vfork) | 763 | PTREGSCALL0(vfork) |
765 | PTREGSCALL3(execve) | 764 | PTREGSCALL3(execve) |
766 | PTREGSCALL2(sigaltstack) | 765 | PTREGSCALL2(sigaltstack) |
@@ -769,6 +768,19 @@ PTREGSCALL0(rt_sigreturn) | |||
769 | PTREGSCALL2(vm86) | 768 | PTREGSCALL2(vm86) |
770 | PTREGSCALL1(vm86old) | 769 | PTREGSCALL1(vm86old) |
771 | 770 | ||
771 | /* Clone is an oddball. The 4th arg is in %edi */ | ||
772 | ALIGN; | ||
773 | ptregs_clone: | ||
774 | leal 4(%esp),%eax | ||
775 | pushl %eax | ||
776 | pushl PT_EDI(%eax) | ||
777 | movl PT_EDX(%eax),%ecx | ||
778 | movl PT_ECX(%eax),%edx | ||
779 | movl PT_EBX(%eax),%eax | ||
780 | call sys_clone | ||
781 | addl $8,%esp | ||
782 | ret | ||
783 | |||
772 | .macro FIXUP_ESPFIX_STACK | 784 | .macro FIXUP_ESPFIX_STACK |
773 | /* | 785 | /* |
774 | * Switch back for ESPFIX stack to the normal zerobased stack | 786 | * Switch back for ESPFIX stack to the normal zerobased stack |
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index bb17bd9334fb..f3c1a6b3a65e 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -234,6 +234,15 @@ int sys_vfork(struct pt_regs *regs) | |||
234 | NULL, NULL); | 234 | NULL, NULL); |
235 | } | 235 | } |
236 | 236 | ||
237 | long | ||
238 | sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
239 | void __user *parent_tid, void __user *child_tid, struct pt_regs *regs) | ||
240 | { | ||
241 | if (!newsp) | ||
242 | newsp = regs->sp; | ||
243 | return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid); | ||
244 | } | ||
245 | |||
237 | 246 | ||
238 | /* | 247 | /* |
239 | * sys_execve() executes a new program. | 248 | * sys_execve() executes a new program. |
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 486e38e2900b..506d5a7ba17c 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -436,21 +436,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
436 | return prev_p; | 436 | return prev_p; |
437 | } | 437 | } |
438 | 438 | ||
439 | int sys_clone(struct pt_regs *regs) | ||
440 | { | ||
441 | unsigned long clone_flags; | ||
442 | unsigned long newsp; | ||
443 | int __user *parent_tidptr, *child_tidptr; | ||
444 | |||
445 | clone_flags = regs->bx; | ||
446 | newsp = regs->cx; | ||
447 | parent_tidptr = (int __user *)regs->dx; | ||
448 | child_tidptr = (int __user *)regs->di; | ||
449 | if (!newsp) | ||
450 | newsp = regs->sp; | ||
451 | return do_fork(clone_flags, newsp, regs, 0, parent_tidptr, child_tidptr); | ||
452 | } | ||
453 | |||
454 | #define top_esp (THREAD_SIZE - sizeof(unsigned long)) | 439 | #define top_esp (THREAD_SIZE - sizeof(unsigned long)) |
455 | #define top_ebp (THREAD_SIZE - 2*sizeof(unsigned long)) | 440 | #define top_ebp (THREAD_SIZE - 2*sizeof(unsigned long)) |
456 | 441 | ||
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 671960d82587..83019f94b83d 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -534,15 +534,6 @@ void set_personality_64bit(void) | |||
534 | current->personality &= ~READ_IMPLIES_EXEC; | 534 | current->personality &= ~READ_IMPLIES_EXEC; |
535 | } | 535 | } |
536 | 536 | ||
537 | asmlinkage long | ||
538 | sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
539 | void __user *parent_tid, void __user *child_tid, struct pt_regs *regs) | ||
540 | { | ||
541 | if (!newsp) | ||
542 | newsp = regs->sp; | ||
543 | return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid); | ||
544 | } | ||
545 | |||
546 | unsigned long get_wchan(struct task_struct *p) | 537 | unsigned long get_wchan(struct task_struct *p) |
547 | { | 538 | { |
548 | unsigned long stack; | 539 | unsigned long stack; |