BSD 3 development
[unix-history] / usr / src / libc / sys / vfork.s
CommitLineData
b06f49cc
BJ
1# C library -- vfork
2
3# pid = vfork();
4#
5# r1 == 0 in parent process, r1 == 1 in child process.
6# r0 == pid of child in parent, r0 == pid of parent in child.
7#
8# trickery here, due to keith sklower, uses ret to clear the stack,
9# and then returns with a jump indirect, since only one person can return
10# with a ret off this stack... we do the ret before we vfork!
11#
12
13 .set vfork,66
14.globl _vfork
15
16_vfork:
17 .word 0x0000
18 movl 16(fp),r2
19 movab here,16(fp)
20 ret
21here:
22 chmk $vfork
23 bcc vforkok
24 jmp verror
25vforkok:
26 tstl r1 # child process ?
27 bneq child # yes
28 bcc parent # if c-bit not set, fork ok
29.globl _errno
30verror:
31 movl r0,_errno
32 mnegl $1,r0
33 jmp (r2)
34child:
35 clrl r0
36parent:
37 jmp (r2)