fix clone() on mips (args were in wrong order)
[musl] / src / thread / mips / clone.s
1 .set noreorder
2 .global __clone
3 .type   __clone,@function
4 __clone:
5         # Save function pointer and argument pointer
6         move $25, $4
7         move $8, $7
8         # Shuffle (fn,sp,fl,arg,ptid,tls,ctid) to (fl,sp,ptid,tls,ctid)
9         move $4, $6
10         lw $6, 16($sp)
11         lw $7, 20($sp)
12         lw $9, 24($sp)
13         sw $9, 16($sp)
14         li $2, 4120
15         syscall
16         beq $7, $0, 1f
17         nop
18         jr $ra
19         subu $2, $0, $2
20 1:      beq $2, $0, 1f
21         nop
22         jr $ra
23         nop
24 1:      move $4, $8
25         jr $25
26         nop