xref: /original-bsd/lib/libc/hp300/sys/Ovfork.s (revision c3e32dec)
1/*-
2 * Copyright (c) 1990, 1993
3 *	The Regents of the University of California.  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 * %sccs.include.redist.c%
10 */
11
12#if defined(LIBC_SCCS) && !defined(lint)
13	.asciz "@(#)Ovfork.s	8.1 (Berkeley) 06/07/93"
14#endif /* LIBC_SCCS and not lint */
15
16/*
17 * pid = vfork();
18 *
19 * d1 == 0 in parent process, d1 == 1 in child process.
20 * d0 == pid of child in parent, d0 == 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#include "SYS.h"
28
29	vfork = 66
30ENTRY(vfork)
31	movl	sp@+,a0
32	movl	#vfork,d0
33	trap	#0
34	jcc	vforkok
35	jmp	verror
36vforkok:
37	tstl	d1		/* child process ? */
38	jne	child		/* yes */
39	jcc 	parent		/* if c-bit not set, fork ok */
40	.globl	_errno
41verror:
42	movl	d0,_errno
43	moveq	#-1,d0
44	jmp	a0@
45child:
46	clrl	d0
47parent:
48	jmp	a0@
49