1/* 2 * Copyright (c) 1983 Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8#if defined(SYSLIBC_SCCS) && !defined(lint) 9 .asciz "@(#)Ovfork.s 5.4 (Berkeley) 06/01/90" 10#endif /* SYSLIBC_SCCS and not lint */ 11 12/* 13 * C library -- vfork 14 * pid = vfork(); 15 * 16 * r1 == 0 in parent process, r1 == 1 in child process. 17 * r0 == pid of child in parent, r0 == pid of parent in child. 18 * 19 * trickery here, due to keith sklower, uses ret to clear the stack, 20 * and then returns with a jump indirect, since only one person can return 21 * with a ret off this stack... we do the ret before we vfork! 22 * 23 */ 24 25 .set vfork,66 26.globl _vfork 27 28_vfork: 29 .word 0x0000 30 movl -8(fp),r2 31 movab here,-8(fp) 32 ret 33here: 34 kcall $vfork 35 bcc vforkok 36 jmp verror 37vforkok: 38 tstl r1 # child process ? 39 bneq child # yes 40 jbr parent 41.globl _errno 42verror: 43 movl r0,_errno 44 mnegl $1,r0 45 jmp (r2) 46child: 47 clrl r0 48parent: 49 jmp (r2) 50