Commit | Line | Data |
---|---|---|
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 | |
21 | here: | |
22 | chmk $vfork | |
23 | bcc vforkok | |
24 | jmp verror | |
25 | vforkok: | |
26 | tstl r1 # child process ? | |
27 | bneq child # yes | |
28 | bcc parent # if c-bit not set, fork ok | |
29 | .globl _errno | |
30 | verror: | |
31 | movl r0,_errno | |
32 | mnegl $1,r0 | |
33 | jmp (r2) | |
34 | child: | |
35 | clrl r0 | |
36 | parent: | |
37 | jmp (r2) |