summaryrefslogtreecommitdiff
path: root/src/thread/mips/clone.s
blob: a7c2d907f05e1df5b0c17f1804180dda73bb47db (plain) (blame)
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
.set noreorder
.global __clone
.type   __clone,@function
__clone:
	# Save function pointer and argument pointer
	move $25, $4
	move $8, $7
	# Shuffle (fn,sp,fl,arg,ptid,tls,ctid) to (fl,sp,ptid,tls,ctid)
	move $4, $6
	lw $6, 16($sp)
	lw $7, 20($sp)
	lw $9, 24($sp)
	sw $9, 16($sp)
	li $2, 4120
	syscall
	beq $7, $0, 1f
	nop
	jr $ra
	subu $2, $0, $2
1:	beq $2, $0, 1f
	nop
	jr $ra
	nop
1:	move $4, $8
	jr $25
	nop