summaryrefslogtreecommitdiffstats
path: root/usr/klibc/arch/arm64/vfork.S
blob: c30b2a06996e0d13eb8646b4316c29232c21d81d (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
/*
 * arch/arm64/vfork.S
 *
 * vfork - a system call which must not use the stack.
 */

#include <asm/unistd.h>

	.type	vfork,#function
	.globl	vfork
	.balign	8

vfork:
	/* Prepare for the system call */
        /* 1. Push the function pointer and argument location
              on to the child process stack */
        /* 2. Gather the Flags */
        /* New sp is already in x1.  */
        mov     x0, #0x4111     /* CLONE_VM | CLONE_VFORK | SIGCHLD */
        mov     x1, sp
        mov     w8,__NR_clone
        svc     0
        cmp     x0, #0x0
        b.ge    2f
        neg     x0, x0
        ldr     x8, 1f
        str     x0, [x8]
        mov     x0, #-1
2:
        ret
1:
        .dword   errno
        .size   vfork,.-vfork