1/* 2 * This file is subject to the terms and conditions of the LGPL V2.1 3 * License. See the file "COPYING" in the main directory of this archive 4 * for more details. 5 * 6 * Copyright (C) 2018 Kalray Inc. 7 */ 8 9#include <sys/syscall.h> 10#include <sysdep.h> 11 12/* We do not want COMPAT to be enabled in our kernel, hence vfork 13 * is not available. Use clone to do the same job with appropriate flags */ 14#define _SIGNAL_H 15#include <bits/signum.h> /* For SIGCHLD */ 16 17#define CLONE_VM 0x00000100 18#define CLONE_VFORK 0x00004000 19#define CLONE_FLAGS_FOR_VFORK (CLONE_VM|CLONE_VFORK|SIGCHLD) 20 21ENTRY(__vfork) 22 make $r0 = CLONE_FLAGS_FOR_VFORK 23 /* Not sure if needed to zero-out other parameters but better 24 * be safe than sorry */ 25 make $r1 = 0 26 make $r2 = 0 27 ;; 28 make $r3 = 0 29 make $r4 = 0 30 ;; 31 scall SYS_ify(clone) 32 ;; 33 /* If PID < 0 then it's an error, else, simply return */ 34 cb.dltz $r0 ? err 35 ;; 36 ret 37 ;; 38L(err): 39 goto __syscall_error 40 ;; 41 /* Never return */ 42 errop 43 ;; 44END(__vfork) 45 46weak_alias(__vfork,vfork) 47libc_hidden_def(vfork) 48