diff options
author | raf <none@none> | 2006-12-13 11:41:29 -0800 |
---|---|---|
committer | raf <none@none> | 2006-12-13 11:41:29 -0800 |
commit | 657b1f3d64bcf8eaa2385dba72a6047f089433b2 (patch) | |
tree | f39954fcde5cecefa713fa403e7e4b55a83f7c0d /usr/src/lib/libc/sparc | |
parent | 7b55fa8ea6046becb3b72f8886a503979c322084 (diff) | |
download | illumos-gate-657b1f3d64bcf8eaa2385dba72a6047f089433b2.tar.gz |
PSARC 2006/659 fork extensions
6497356 fork extensions
--HG--
rename : usr/src/lib/libc/amd64/sys/forkall.s => usr/src/lib/libc/amd64/sys/forkallx.s
rename : usr/src/lib/libc/amd64/sys/fork1.s => usr/src/lib/libc/amd64/sys/forkx.s
rename : usr/src/lib/libc/amd64/sys/vfork.s => usr/src/lib/libc/amd64/sys/vforkx.s
rename : usr/src/lib/libc/i386/sys/forkall.s => usr/src/lib/libc/i386/sys/forkallx.s
rename : usr/src/lib/libc/i386/sys/fork1.s => usr/src/lib/libc/i386/sys/forkx.s
rename : usr/src/lib/libc/i386/sys/vfork.s => usr/src/lib/libc/i386/sys/vforkx.s
rename : usr/src/lib/libc/sparc/sys/forkall.s => usr/src/lib/libc/sparc/sys/forkallx.s
rename : usr/src/lib/libc/sparc/sys/fork1.s => usr/src/lib/libc/sparc/sys/forkx.s
rename : usr/src/lib/libc/sparc/sys/vfork.s => usr/src/lib/libc/sparc/sys/vforkx.s
Diffstat (limited to 'usr/src/lib/libc/sparc')
-rw-r--r-- | usr/src/lib/libc/sparc/Makefile | 8 | ||||
-rw-r--r-- | usr/src/lib/libc/sparc/sys/forkallx.s (renamed from usr/src/lib/libc/sparc/sys/forkall.s) | 28 | ||||
-rw-r--r-- | usr/src/lib/libc/sparc/sys/forkx.s (renamed from usr/src/lib/libc/sparc/sys/fork1.s) | 28 | ||||
-rw-r--r-- | usr/src/lib/libc/sparc/sys/vforkx.s (renamed from usr/src/lib/libc/sparc/sys/vfork.s) | 91 |
4 files changed, 84 insertions, 71 deletions
diff --git a/usr/src/lib/libc/sparc/Makefile b/usr/src/lib/libc/sparc/Makefile index 452b116802..eced13c518 100644 --- a/usr/src/lib/libc/sparc/Makefile +++ b/usr/src/lib/libc/sparc/Makefile @@ -330,8 +330,8 @@ SYSOBJS= \ _lwp_mutex_unlock.o \ _stack_grow.o \ door.o \ - fork1.o \ - forkall.o \ + forkx.o \ + forkallx.o \ gettimeofday.o \ pipe.o \ ptrace.o \ @@ -341,7 +341,7 @@ SYSOBJS= \ uadmin.o \ umount.o \ uname.o \ - vfork.o + vforkx.o # objects under ../port which contain transitional large file interfaces PORTGEN64= \ @@ -1214,7 +1214,7 @@ ASSYMDEP_OBJS= \ asm_subr.o \ tls_get_addr.o \ unwind_frame.o \ - vfork.o + vforkx.o $(ASSYMDEP_OBJS:%=pics/%) := CPPFLAGS += -I. diff --git a/usr/src/lib/libc/sparc/sys/forkall.s b/usr/src/lib/libc/sparc/sys/forkallx.s index 43ef74e8bb..32dbdadd6e 100644 --- a/usr/src/lib/libc/sparc/sys/forkall.s +++ b/usr/src/lib/libc/sparc/sys/forkallx.s @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,12 @@ * * CDDL HEADER END */ + /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ - /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -32,12 +31,13 @@ .file "%M%" -/* - * C library -- forkall - * pid_t forkall(void) - */ +#include "SYS.h" /* + * pid = __forkallx(flags); + * + * syscall trap: forksys(1, flags) + * * From the syscall: * %o1 == 0 in parent process, %o1 == 1 in child process. * %o0 == pid of child in parent, %o0 == pid of parent in child. @@ -46,11 +46,11 @@ * The parent gets the pid of the child. */ -#include "SYS.h" - - ENTRY(__forkall) - SYSTRAP_2RVALS(forkall) + ENTRY(__forkallx) + mov %o0, %o1 + mov 1, %o0 + SYSTRAP_2RVALS(forksys) SYSCERROR movrnz %o1, 0, %o0 RET - SET_SIZE(__forkall) + SET_SIZE(__forkallx) diff --git a/usr/src/lib/libc/sparc/sys/fork1.s b/usr/src/lib/libc/sparc/sys/forkx.s index 1d011cbb37..b86bcbbfcc 100644 --- a/usr/src/lib/libc/sparc/sys/fork1.s +++ b/usr/src/lib/libc/sparc/sys/forkx.s @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,12 @@ * * CDDL HEADER END */ + /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ - /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -32,12 +31,13 @@ .file "%M%" -/* - * C library -- fork1 - * pid_t fork1(void) - */ +#include "SYS.h" /* + * pid = __forkx(flags); + * + * syscall trap: forksys(0, flags) + * * From the syscall: * %o1 == 0 in parent process, %o1 == 1 in child process. * %o0 == pid of child in parent, %o0 == pid of parent in child. @@ -46,11 +46,11 @@ * The parent gets the pid of the child. */ -#include "SYS.h" - - ENTRY(__fork1); - SYSTRAP_2RVALS(fork1); + ENTRY(__forkx) + mov %o0, %o1 + clr %o0 + SYSTRAP_2RVALS(forksys) SYSCERROR movrnz %o1, 0, %o0 RET - SET_SIZE(__fork1) + SET_SIZE(__forkx) diff --git a/usr/src/lib/libc/sparc/sys/vfork.s b/usr/src/lib/libc/sparc/sys/vforkx.s index 45153a1374..d5e41b571a 100644 --- a/usr/src/lib/libc/sparc/sys/vfork.s +++ b/usr/src/lib/libc/sparc/sys/vforkx.s @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,66 +18,79 @@ * * CDDL HEADER END */ + /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ - /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -.ident "%Z%%M% %I% %E% SMI" +#pragma ident "%Z%%M% %I% %E% SMI" -/* - * C library -- vfork - * pid_t vfork(void); - */ + .file "%M%" + +#include <sys/asm_linkage.h> + + ANSI_PRAGMA_WEAK(vforkx,function) + ANSI_PRAGMA_WEAK(vfork,function) + +#include "SYS.h" +#include <assym.h> /* + * pid = vforkx(flags); + * syscall trap: forksys(2, flags) + * + * pid = vfork(); + * syscall trap: forksys(2, 0) + * * From the syscall: * %o1 == 0 in parent process, %o1 == 1 in child process. * %o0 == pid of child in parent, %o0 == pid of parent in child. * - * The child process gets a zero return value from vfork; the parent - * gets the pid of the child. + * The child gets a zero return value. + * The parent gets the pid of the child. + */ + +/* + * Note that since the SPARC architecture maintains stack maintence + * information (return pc, sp, fp) in the register windows, both parent + * and child can execute in a common address space without conflict. * * We block all blockable signals while performing the vfork() system call * trap. This enables us to set curthread->ul_vfork safely, so that we * don't end up in a signal handler with curthread->ul_vfork set wrong. - * - * Note that since the SPARC architecture maintains stack maintence - * information (return pc, sp, fp) in the register windows, both parent - * and child can execute in a common address space without conflict. */ - .file "%M%" - -#include <sys/asm_linkage.h> - - ANSI_PRAGMA_WEAK(vfork,function) - -#include "SYS.h" -#include <../assym.h> - - ENTRY(vfork) - mov SIG_SETMASK, %o0 ! block signals + ENTRY_NP(vforkx) + ba 0f + mov %o0, %o3 /* flags */ + ENTRY_NP(vfork) + clr %o3 /* flags = 0 */ +0: + mov SIG_SETMASK, %o0 /* block all signals */ set MASKSET0, %o1 set MASKSET1, %o2 SYSTRAP_2RVALS(lwp_sigmask) - SYSTRAP_2RVALS(vfork) + mov %o3, %o1 /* flags */ + mov 2, %o0 + SYSTRAP_2RVALS(forksys) /* vforkx(flags) */ bcc,a,pt %icc, 1f tst %o1 - mov %o0, %o3 ! save the vfork() error number - mov SIG_SETMASK, %o0 ! reinstate signals + mov %o0, %o3 /* save the vfork() error number */ + + mov SIG_SETMASK, %o0 /* reinstate signals */ ld [%g7 + UL_SIGMASK], %o1 ld [%g7 + UL_SIGMASK + 4], %o2 SYSTRAP_2RVALS(lwp_sigmask) - mov %o3, %o0 ! restore the vfork() error number - ba,a __cerror + ba __cerror + mov %o3, %o0 /* restore the vfork() error number */ + 1: /* * To determine if we are (still) a child of vfork(), the child @@ -89,12 +101,12 @@ */ bnz,pt %icc, 2f ld [%g7 + UL_VFORK], %g1 - brnz,a,pt %g1, 3f ! don't let it go negative - sub %g1, 1, %g1 ! curthread->ul_vfork--; + brnz,a,pt %g1, 3f /* don't let it go negative */ + sub %g1, 1, %g1 /* curthread->ul_vfork--; */ ba,a 3f 2: - clr %o0 ! child, return (0) - add %g1, 1, %g1 ! curthread->ul_vfork++; + clr %o0 /* zero the return value in the child */ + add %g1, 1, %g1 /* curthread->ul_vfork++; */ 3: st %g1, [%g7 + UL_VFORK] /* @@ -103,13 +115,14 @@ */ stn %g0, [%g7 + UL_SCHEDCTL] stn %g0, [%g7 + UL_SCHEDCTL_CALLED] - mov %o0, %o3 ! save the vfork() return value + mov %o0, %o3 /* save the vfork() return value */ - mov SIG_SETMASK, %o0 ! reinstate signals + mov SIG_SETMASK, %o0 /* reinstate signals */ ld [%g7 + UL_SIGMASK], %o1 ld [%g7 + UL_SIGMASK + 4], %o2 SYSTRAP_2RVALS(lwp_sigmask) retl - mov %o3, %o0 ! restore the vfork() return value + mov %o3, %o0 /* restore the vfork() return value */ SET_SIZE(vfork) + SET_SIZE(vforkx) |