|
|
1.1 ! root 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: #ifdef SYSLIBC_SCCS ! 8: _sccsid:.asciz "@(#)Ovfork.c 5.3 (Berkeley) 3/9/86" ! 9: #endif SYSLIBC_SCCS ! 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 ! 35: here: ! 36: chmk $vfork ! 37: bcc vforkok ! 38: jmp verror ! 39: vforkok: ! 40: tstl r1 # child process ? ! 41: bneq child # yes ! 42: bcc parent # if c-bit not set, fork ok ! 43: .globl _errno ! 44: verror: ! 45: movl r0,_errno ! 46: mnegl $1,r0 ! 47: jmp (r2) ! 48: child: ! 49: clrl r0 ! 50: parent: ! 51: jmp (r2)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.