summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/arc/vfork.S
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2014-07-25 17:39:05 +0530
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2014-08-18 11:52:34 +0200
commit873fa5beccbb4e95d1bbb9afb6a0eec02811f09b (patch)
tree17ceb2c595fe9a491f3e7fa91d7c379babf2c356 /libc/sysdeps/linux/arc/vfork.S
parent6915b3a6b96e8e34601941c0eb7519cde1c0f999 (diff)
NPTL: ARC support
Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc/sysdeps/linux/arc/vfork.S')
-rw-r--r--libc/sysdeps/linux/arc/vfork.S13
1 files changed, 13 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/arc/vfork.S b/libc/sysdeps/linux/arc/vfork.S
index 11959b66b..573a29f26 100644
--- a/libc/sysdeps/linux/arc/vfork.S
+++ b/libc/sysdeps/linux/arc/vfork.S
@@ -16,12 +16,25 @@
#define CLONE_FLAGS_FOR_VFORK (CLONE_VM|CLONE_VFORK|SIGCHLD)
ENTRY(__vfork)
+#ifdef SAVE_PID
+ THREAD_SELF r1 ; Get to struct pthread (just before TCB)
+ ld r2, [r1, PTHREAD_PID]
+ neg.f r3, r2
+ bset.z r3, r3, 31
+ st r3, [r1, PTHREAD_PID]
+#endif
mov r0, CLONE_FLAGS_FOR_VFORK
mov_s r1, sp
mov r8, __NR_clone
ARC_TRAP_INSN
cmp r0, 0
+#ifdef RESTORE_PID
+ bz 1f ; child continues
+ THREAD_SELF r1 ; Get to struct pthread (just before TCB)
+ st r2, [r1, PTHREAD_PID]
+1:
+#endif
jge [blink] ; pid >=0 return, else detour via tailcall to errno
b __syscall_error