|
|
1.1 root 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 _fork
15:
16: _fork:
17: .word 0x0000
18: movl 16(fp),r2
19: movab here,16(fp)
20: ret
21: here:
22: chmk $vfork
23: tstl r1 # child process ?
24: bneq child # yes
25: bcc parent # if c-bit not set, fork ok
26: .globl _errno
27: movl r0,_errno
28: mnegl $1,r0
29: jmp (r2)
30: child:
31: clrl r0
32: parent:
33: jmp (r2)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.