1570af302Sopenharmony_ci.set noreorder 2570af302Sopenharmony_ci.global __clone 3570af302Sopenharmony_ci.hidden __clone 4570af302Sopenharmony_ci.type __clone,@function 5570af302Sopenharmony_ci__clone: 6570af302Sopenharmony_ci # Save function pointer and argument pointer on new thread stack 7570af302Sopenharmony_ci and $5, $5, -16 # aligning stack to double word 8570af302Sopenharmony_ci subu $5, $5, 16 9570af302Sopenharmony_ci sw $4, 0($5) # save function pointer 10570af302Sopenharmony_ci sw $7, 4($5) # save argument pointer 11570af302Sopenharmony_ci 12570af302Sopenharmony_ci # Shuffle (fn,sp,fl,arg,ptid,tls,ctid) to (fl,sp,ptid,tls,ctid) 13570af302Sopenharmony_ci # sys_clone(u64 flags, u64 ustack_base, u64 parent_tidptr, u64 child_tidptr, u64 tls) 14570af302Sopenharmony_ci move $4, $6 15570af302Sopenharmony_ci move $6, $8 16570af302Sopenharmony_ci move $7, $9 17570af302Sopenharmony_ci move $8, $10 18570af302Sopenharmony_ci li $2, 6055 19570af302Sopenharmony_ci syscall 20570af302Sopenharmony_ci beq $7, $0, 1f 21570af302Sopenharmony_ci nop 22570af302Sopenharmony_ci jr $ra 23570af302Sopenharmony_ci subu $2, $0, $2 24570af302Sopenharmony_ci1: beq $2, $0, 1f 25570af302Sopenharmony_ci nop 26570af302Sopenharmony_ci jr $ra 27570af302Sopenharmony_ci nop 28570af302Sopenharmony_ci1: lw $25, 0($sp) # function pointer 29570af302Sopenharmony_ci lw $4, 4($sp) # argument pointer 30570af302Sopenharmony_ci jalr $25 # call the user's function 31570af302Sopenharmony_ci nop 32570af302Sopenharmony_ci move $4, $2 33570af302Sopenharmony_ci li $2, 6058 34570af302Sopenharmony_ci syscall 35