1: / pid = vfork();
2: /
3: / Since the parent and child share the stack, the return
4: / address for the parent would be overwritten by the child.
5: / Therefore, save the return address in r1 and "return"
6: / by a jump indirect.
7:
8: .globl _vfork
9: .globl _par_uid
10: .comm _errno, 2
11:
12: _vfork:
13: mov (sp)+,r1 / save return address
14: sys vfork
15: br 1f / child returns here; if no vfork
16: / syscall, parent returns here also.
17:
18: bec 2f / parent returns here
19: 0: mov r0,_errno / vfork failed; can't use cerror
20: mov $-1,r0
21: jmp (r1) / "return" to saved location
22:
23: 1: / child:
24: bes 0b / check error here also
25: / (in case no vfork syscall)
26: mov r0,_par_uid
27: clr r0
28: 2:
29: jmp (r1) / "return" to saved location
Defined functions
_vfork
declared in line
8; defined in line
12; used 8 times
Defined variables