summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/alpha/clone.S
blob: 28e61a8bc3a0c3f1d4488e10b263631b00cee70d (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
#include "syscalls.h"
#include <errno.h>

.text
.align 2
.weak clone
clone:
.global __clone
.type __clone,@function
__clone:
	ldiq	$0, EINVAL
	beq	$16, .Lerror
	beq	$17, .Lerror

	subq	$17, 16, $17
	stq	$16, 0($17)
	stq	$19, 8($17)
	mov	$18, $16

	lda	$0, __NR_clone($31)
	callsys
	bne	$19, .Lerror

	beq	$0, .Lstart_thread

	ret	$31, ($26), 0x01

.Lerror:
	jmp	error_unified_syscall

.Lstart_thread:
	clr	$fp

	ldq	$27, 0($sp)
	ldq	$16, 8($sp)

	jsr	$26, ($27), 0x04

	ldgp	$gp, 0($26)
	mov	$0,  $16
	jsr	$26, exit