|
|
1.1 root 1: /*-
2: * Copyright (c) 1990 The Regents of the University of California.
3: * All rights reserved.
4: *
5: * This code is derived from software contributed to Berkeley by
6: * the Systems Programming Group of the University of Utah Computer
7: * Science Department.
8: *
9: * Redistribution and use in source and binary forms are permitted
10: * provided that: (1) source distributions retain this entire copyright
11: * notice and comment, and (2) distributions including binaries display
12: * the following acknowledgement: ``This product includes software
13: * developed by the University of California, Berkeley and its contributors''
14: * in the documentation or other materials provided with the distribution
15: * and in all advertising materials mentioning features or use of this
16: * software. Neither the name of the University nor the names of its
17: * contributors may be used to endorse or promote products derived
18: * from this software without specific prior written permission.
19: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
20: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
21: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22: */
23:
24: #if defined(LIBC_SCCS) && !defined(lint)
25: .asciz "@(#)Ovfork.s 5.1 (Berkeley) 5/12/90"
26: #endif /* LIBC_SCCS and not lint */
27:
28: /*
29: * @(#)vfork.s 4.1 (Berkeley) 12/21/80
30: * C library -- vfork
31: */
32:
33: /*
34: * pid = vfork();
35: *
36: * d1 == 0 in parent process, d1 == 1 in child process.
37: * d0 == pid of child in parent, d0 == pid of parent in child.
38: *
39: * trickery here, due to keith sklower, uses ret to clear the stack,
40: * and then returns with a jump indirect, since only one person can return
41: * with a ret off this stack... we do the ret before we vfork!
42: */
43:
44: vfork = 66
45: .globl _vfork
46:
47: _vfork:
48: movl sp@+,a0
49: movl #vfork,d0
50: trap #0
51: jcc vforkok
52: jmp verror
53: vforkok:
54: tstl d1 /* child process ? */
55: jne child /* yes */
56: jcc parent /* if c-bit not set, fork ok */
57: .globl _errno
58: verror:
59: movl d0,_errno
60: moveq #-1,d0
61: jmp a0@
62: child:
63: clrl d0
64: parent:
65: jmp a0@
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.