xref: /original-bsd/lib/libc/vax/sys/Ovfork.s (revision 5b10f61c)
1/*
2 * Copyright (c) 1983 Regents of the University of California.
3 * All rights reserved.  The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 */
6
7#ifndef lint
8_sccsid:.asciz	"@(#)Ovfork.s	5.2 (Berkeley) 06/05/85"
9#endif not lint
10
11/*
12 * @(#)vfork.s	4.1 (Berkeley) 12/21/80
13 * C library -- vfork
14 */
15
16/*
17 * pid = vfork();
18 *
19 * r1 == 0 in parent process, r1 == 1 in child process.
20 * r0 == pid of child in parent, r0 == pid of parent in child.
21 *
22 * trickery here, due to keith sklower, uses ret to clear the stack,
23 * and then returns with a jump indirect, since only one person can return
24 * with a ret off this stack... we do the ret before we vfork!
25 */
26
27	.set	vfork,66
28.globl	_vfork
29
30_vfork:
31	.word	0x0000
32	movl	16(fp),r2
33	movab	here,16(fp)
34	ret
35here:
36	chmk	$vfork
37	bcc	vforkok
38	jmp	verror
39vforkok:
40	tstl	r1		# child process ?
41	bneq	child	# yes
42	bcc 	parent		# if c-bit not set, fork ok
43.globl	_errno
44verror:
45	movl	r0,_errno
46	mnegl	$1,r0
47	jmp	(r2)
48child:
49	clrl	r0
50parent:
51	jmp	(r2)
52