19426Smckusick/* 221542Sdist * Copyright (c) 1983 Regents of the University of California. 3*34391Sbostic * All rights reserved. 4*34391Sbostic * 5*34391Sbostic * Redistribution and use in source and binary forms are permitted 6*34391Sbostic * provided that this notice is preserved and that due credit is given 7*34391Sbostic * to the University of California at Berkeley. The name of the University 8*34391Sbostic * may not be used to endorse or promote products derived from this 9*34391Sbostic * software without specific written prior permission. This software 10*34391Sbostic * is provided ``as is'' without express or implied warranty. 1121542Sdist */ 1221542Sdist 13*34391Sbostic#if defined(SYSLIBC_SCCS) && !defined(lint) 14*34391Sbostic_sccsid:.asciz "@(#)Ovfork.s 5.4 (Berkeley) 05/20/88" 15*34391Sbostic#endif /* SYSLIBC_SCCS and not lint */ 1621542Sdist 1721542Sdist/* 189426Smckusick * @(#)vfork.s 4.1 (Berkeley) 12/21/80 199426Smckusick * C library -- vfork 209426Smckusick */ 219426Smckusick 229426Smckusick/* 239426Smckusick * pid = vfork(); 249426Smckusick * 259426Smckusick * r1 == 0 in parent process, r1 == 1 in child process. 269426Smckusick * r0 == pid of child in parent, r0 == pid of parent in child. 279426Smckusick * 289426Smckusick * trickery here, due to keith sklower, uses ret to clear the stack, 299426Smckusick * and then returns with a jump indirect, since only one person can return 309426Smckusick * with a ret off this stack... we do the ret before we vfork! 319426Smckusick */ 329426Smckusick 339426Smckusick .set vfork,66 349426Smckusick.globl _vfork 359426Smckusick 369426Smckusick_vfork: 379426Smckusick .word 0x0000 389426Smckusick movl 16(fp),r2 399426Smckusick movab here,16(fp) 409426Smckusick ret 419426Smckusickhere: 429426Smckusick chmk $vfork 439426Smckusick bcc vforkok 449426Smckusick jmp verror 459426Smckusickvforkok: 469426Smckusick tstl r1 # child process ? 479426Smckusick bneq child # yes 489426Smckusick bcc parent # if c-bit not set, fork ok 499426Smckusick.globl _errno 509426Smckusickverror: 519426Smckusick movl r0,_errno 529426Smckusick mnegl $1,r0 539426Smckusick jmp (r2) 549426Smckusickchild: 559426Smckusick clrl r0 569426Smckusickparent: 579426Smckusick jmp (r2) 58