diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/thread/mips/__unmapself.s | 9 | ||||
-rw-r--r-- | src/thread/mips/clone.s | 27 | ||||
-rw-r--r-- | src/thread/mips/syscall_cp.s | 31 |
3 files changed, 67 insertions, 0 deletions
diff --git a/src/thread/mips/__unmapself.s b/src/thread/mips/__unmapself.s new file mode 100644 index 00000000..9aa03712 --- /dev/null +++ b/src/thread/mips/__unmapself.s @@ -0,0 +1,9 @@ +.set noreorder +.global __unmapself +.type __unmapself,@function +__unmapself: + li $2, 4091 + syscall + li $4, 0 + li $2, 4001 + syscall diff --git a/src/thread/mips/clone.s b/src/thread/mips/clone.s new file mode 100644 index 00000000..09a1a83f --- /dev/null +++ b/src/thread/mips/clone.s @@ -0,0 +1,27 @@ +.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 (sp,fl,ptid,tls,ctid) + move $4, $5 + move $5, $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 diff --git a/src/thread/mips/syscall_cp.s b/src/thread/mips/syscall_cp.s new file mode 100644 index 00000000..9a796bd6 --- /dev/null +++ b/src/thread/mips/syscall_cp.s @@ -0,0 +1,31 @@ +.set noreorder + +.global __syscall_cp_asm +.type __syscall_cp_asm,@function +__syscall_cp_asm: +.global __cp_begin +__cp_begin: + lw $4, 0($4) + bne $4, $0, 2f + move $10, $5 + move $4, $6 + move $5, $7 + lw $6, 16($sp) + lw $7, 20($sp) + lw $8, 24($sp) + lw $9, 28($sp) + subu $sp, $sp, 32 + sw $8, 16($sp) + sw $9, 20($sp) + move $2, $10 + syscall +.global __cp_end +__cp_end: + beq $7, $0, 1f + addu $sp, $sp, 32 + subu $2, $0, $2 +1: jr $ra + nop +2: lw $25, %call16(__cancel)($gp) + jr $25 + nop |