1: /*
   2:  * Copyright (c) 1987 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: <@(#)vfork.s	2.6 (2.11BSD) 1995/05/13\0>
   9:         .even
  10: #endif SYSLIBC_SCCS
  11: 
  12: /*
  13:  * XXX - this routine can't use SYSCALL!!!
  14:  *
  15:  * pid = vfork();
  16:  *
  17:  * pid == 0 in child process; pid == -1 means error return in child.
  18:  * Since the parent and child share the stack, the return address for the
  19:  * parent would be overwritten by the child.  Therefore, save the return
  20:  * address in r1 and "return" by a jump indirect.
  21:  */
  22: #include "SYS.h"
  23: 
  24: .globl  __ovno
  25: 
  26: .bss
  27: savov:  .=.+2
  28: .text
  29: 
  30: ENTRY(vfork)
  31:         mov     (sp)+,r1        / save return address
  32:         mov     __ovno,savov    / save __ovno for parent
  33:         SYS(vfork)              / (takes no parameters)
      /
      /   trap 66 -> [kernel] -> syscall() -> via sysent[] -> handler: vfork
      /
  34:         br      1f              / child returns here
  35:         bcs     2f              / parent returns here
  36:         mov     savov,__ovno    / restore ovno in case child switched
  37:         jmp     (r1)            / "return" to saved location
  38: 1:
  39:         clr     r0
  40:         jmp     (r1)
  41: 2:
  42:         mov     r0,_errno
  43:         mov     $-1,r0
  44:         jmp     (r1)            / "return" to saved location

Defined functions

_sccsid defined in line 8; never used
_vfork defined in line 30; used 42 times

Defined variables

savov defined in line 27; used 2 times
Last modified: 1995-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3026
Valid CSS Valid XHTML 1.0 Strict