diff options
author | Carlos O'Donell <carlos@parisc-linux.org> | 2005-10-21 22:53:04 -0400 |
---|---|---|
committer | Kyle McMartin <kyle@parisc-linux.org> | 2005-10-21 22:53:04 -0400 |
commit | b2450cc1b7ce07d73545ece32db50197d649e230 (patch) | |
tree | 6cde982570c3989ee417c83115bdce4f74f858b8 /arch | |
parent | 8b631342dd9db9ca272e11814e041e4ee3d1a948 (diff) |
[PARISC] Implement 5 argument clone.
* arch/parisc/kernel/process.c (sys_clone): Use 5 args, and process
CLONE_PARENT_SETTID, CLONE_CHILD_SETTID, CLONE_CHILD_CLEARTID.
(copy_thread): First cut at CLONE_SETTLS.
Signed-off-by: Carlos O'Donell <carlos@parisc-linux.org>
Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/parisc/kernel/process.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c index 46b75938511..7fdca87ef64 100644 --- a/arch/parisc/kernel/process.c +++ b/arch/parisc/kernel/process.c @@ -9,7 +9,7 @@ * Copyright (C) 2000-2003 Paul Bame <bame at parisc-linux.org> * Copyright (C) 2000 Philipp Rumpf <prumpf with tux.org> * Copyright (C) 2000 David Kennedy <dkennedy with linuxcare.com> - * Copyright (C) 2000 Richard Hirst <rhirst with parisc-lixux.org> + * Copyright (C) 2000 Richard Hirst <rhirst with parisc-linux.org> * Copyright (C) 2000 Grant Grundler <grundler with parisc-linux.org> * Copyright (C) 2001 Alan Modra <amodra at parisc-linux.org> * Copyright (C) 2001-2002 Ryan Bradetich <rbrad at parisc-linux.org> @@ -245,7 +245,17 @@ int sys_clone(unsigned long clone_flags, unsigned long usp, struct pt_regs *regs) { - int __user *user_tid = (int __user *)regs->gr[26]; + /* Arugments from userspace are: + r26 = Clone flags. + r25 = Child stack. + r24 = parent_tidptr. + r23 = Is the TLS storage descriptor + r22 = child_tidptr + + However, these last 3 args are only examined + if the proper flags are set. */ + int __user *child_tidptr; + int __user *parent_tidptr; /* usp must be word aligned. This also prevents users from * passing in the value 1 (which is the signal for a special @@ -253,10 +263,20 @@ sys_clone(unsigned long clone_flags, unsigned long usp, usp = ALIGN(usp, 4); /* A zero value for usp means use the current stack */ - if(usp == 0) - usp = regs->gr[30]; + if (usp == 0) + usp = regs->gr[30]; - return do_fork(clone_flags, usp, regs, 0, user_tid, NULL); + if (clone_flags & CLONE_PARENT_SETTID) + parent_tidptr = (int __user *)regs->gr[24]; + else + parent_tidptr = NULL; + + if (clone_flags & (CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID)) + child_tidptr = (int __user *)regs->gr[22]; + else + child_tidptr = NULL; + + return do_fork(clone_flags, usp, regs, 0, parent_tidptr, child_tidptr); } int @@ -332,6 +352,10 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp, } else { cregs->kpc = (unsigned long) &child_return; } + /* Setup thread TLS area from the 4th parameter in clone */ + if (clone_flags & CLONE_SETTLS) + cregs->cr27 = pregs->gr[23]; + } return 0; |