summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/h8300/vfork.S
blob: 1e041c6f79936eaddc1ed9ac6b2e54f1a78e391f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
  Copyright 2002, 2015 Yoshinori Sato <ysato@users.sourceforge.jp>
*/

#include <sys/syscall.h>

#ifdef __H8300S__
	.h8300s
#else
	.h8300h
#endif
	.text
	.align 2
	.globl	__vfork
	.hidden	__vfork
	.type	__vfork,@function
__vfork:
	mov.l	@sp+,er2		/* er2 = return address */
	mov.l	#vfork_args,er1
	sub.l	er0,er0
	mov.b	#__NR_clone,r0l
	trapa	#0
	mov.l	#-4096,er1
	cmp.l	er0,er1
	bcc	done
	neg.l	er0
# if !defined(__PIC__)
	mov.l	er0,@errno
# else
	mov.l	@(errno@GOTOFF,er5),er1
	mov.l	er0,@er1
# endif
	sub.l	er0,er0
	dec.l	#1,er0
done:
	jmp	@er2

vfork_args:
	.long	0x00004111	/* CLONE_VFORK | CLONE_VM | SIGCHLD */
	.long	0
	.long	0
	.long	0
	.long	0

weak_alias(__vfork,vfork)
libc_hidden_def(vfork)
	.end