xref: /minix3/lib/libc/arch/powerpc64/sys/fork.S (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc/*	$NetBSD: fork.S,v 1.2 2014/08/23 02:24:22 matt Exp $	*/
22fe8fb19SBen Gras
32fe8fb19SBen Gras/*
42fe8fb19SBen Gras * pid = fork();
52fe8fb19SBen Gras *
62fe8fb19SBen Gras * r4 == 0 in parent process, 1 in child process.
72fe8fb19SBen Gras * r3 == pid of child in parent, pid of parent in child.
82fe8fb19SBen Gras */
92fe8fb19SBen Gras
102fe8fb19SBen Gras#include "SYS.h"
112fe8fb19SBen Gras
122fe8fb19SBen Gras_SYSCALL(__fork,fork)
132fe8fb19SBen Gras	addi	%r4,%r4,-1	# from 1 to 0 in child, 0 to -1 in parent
142fe8fb19SBen Gras	and	%r3,%r3,%r4	# return 0 in child, pid in parent
152fe8fb19SBen Gras	blr
16*0a6a1f1dSLionel SambucEND(__fork)
17