From 83933573aff71a5d178ab71912f177d2d844e63e Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sun, 6 Mar 2016 17:41:56 +0000 Subject: add mips64 port patch by Mahesh Bodapati and Jaydeep Patil of Imagination Technologies. --- src/thread/mips64/clone.s | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/thread/mips64/clone.s (limited to 'src/thread/mips64/clone.s') diff --git a/src/thread/mips64/clone.s b/src/thread/mips64/clone.s new file mode 100644 index 00000000..229d2677 --- /dev/null +++ b/src/thread/mips64/clone.s @@ -0,0 +1,30 @@ +.set noreorder +.global __clone +.type __clone,@function +__clone: + # Save function pointer and argument pointer on new thread stack + and $5, $5, -16 # aligning stack to double word + dsubu $5, $5, 16 + sd $4, 0($5) # save function pointer + sd $7, 8($5) # save argument pointer + + # Shuffle (fn,sp,fl,arg,ptid,tls,ctid) to (fl,sp,ptid,tls,ctid) + # sys_clone(u64 flags, u64 ustack_base, u64 parent_tidptr, u64 child_tidptr, u64 tls) + move $4, $6 + move $6, $8 + move $7, $9 + move $8, $10 + li $2, 5055 + syscall + beq $7, $0, 1f + nop + jr $ra + dsubu $2, $0, $2 +1: beq $2, $0, 1f + nop + jr $ra + nop +1: ld $25, 0($sp) # function pointer + ld $4, 8($sp) # argument pointer + jr $25 # call the user's function + nop -- cgit v1.2.1