summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/h8300/vfork.S
diff options
context:
space:
mode:
authorYoshinori Sato <ysato@users.sourceforge.jp>2015-05-24 02:06:24 +0900
committerWaldemar Brodkorb <wbx@openadk.org>2015-06-10 10:19:39 -0500
commite364302aeaa7fc4f18c66acdbba5dd2c14f77555 (patch)
tree51042019ec3b837fb953730c688f902b921780b0 /libc/sysdeps/linux/h8300/vfork.S
parente9fd792344b30b370346d0224d54edb6a96d5cff (diff)
h8300: Assembly functions
- remove symbol prefix - new startup - new clone syscall support Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/sysdeps/linux/h8300/vfork.S')
-rw-r--r--libc/sysdeps/linux/h8300/vfork.S54
1 files changed, 41 insertions, 13 deletions
diff --git a/libc/sysdeps/linux/h8300/vfork.S b/libc/sysdeps/linux/h8300/vfork.S
index 9b65f4fe0..1c70dd2f5 100644
--- a/libc/sysdeps/linux/h8300/vfork.S
+++ b/libc/sysdeps/linux/h8300/vfork.S
@@ -1,10 +1,7 @@
+/* Copyright 2002, 2015 Yoshinori Sato <ysato@users.sourceforge.jp> */
#include <sys/syscall.h>
-#ifndef __NR_vfork
-#define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */
-#endif
-
#ifdef __H8300S__
.h8300s
#else
@@ -12,29 +9,60 @@
#endif
.text
.align 2
- .globl ___vfork
- .hidden ___vfork
- .type ___vfork,@function
-___vfork:
+ .globl __vfork
+ .hidden __vfork
+ .type __vfork,@function
+__vfork:
+#ifdef __NR_vfork
mov.l @sp+, er1
sub.l er0,er0
mov.b #__NR_vfork,r0l
trapa #0
+
mov.l #-4096, er2
cmp.l er0,er2
bcs fix_errno
- jmp @er1 /* don't return, just jmp directly */
+ jmp @er1 /* don't return, just jmp directly */
fix_errno:
neg.l er0
-#if !defined(__PIC__)
+# if !defined(__PIC__)
mov.l er0,@_errno
-#else
+# else
mov.l @(_errno@GOTOFF,er5),er2
mov.l er0,@er2
-#endif
+# endif
sub.l er0,er0
dec.l #1,er0
- jmp @er1 /* don't return, just jmp directly */
+ jmp @er1 /* don't return, just jmp directly */
+#else
+ 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 0x80004100 /* CLONE_VFORK | CLONE_VM | SIGCHLD */
+ .long 0
+ .long 0
+ .long 0
+ .long 0
+#endif
weak_alias(__vfork,vfork)
libc_hidden_def(vfork)
+ .end