add loongarch64 port

Author: Xiaojuan Zhai <[email protected]>
Author: Meidan Li <[email protected]>
Author: Guoqi Chen <[email protected]>
Author: Xiaolin Zhao <[email protected]>
Author: Fan peng <[email protected]>
Author: Jiantao Shan <[email protected]>
Author: Xuhui Qiang <[email protected]>
Author: Jingyun Hua <[email protected]>
Author: Liu xue <[email protected]>
Author: Hongliang Wang <[email protected]>
This commit is contained in:
Hongliang Wang authored and Rich Felker committed 2024-02-16 09:33:10 -05:00
1 parent 4a16ddf53e
commit 522bd54eda
29 files changed
+1116 -1

No files matched your search

@@ -0,0 +1,7 @@
.global __set_thread_area
.hidden __set_thread_area
.type __set_thread_area,@function
__set_thread_area:
move $tp, $a0
move $a0, $zero
jr $ra
+7
View File
@@ -0,0 +1,7 @@
.global __unmapself
.type __unmapself, @function
__unmapself:
li.d $a7, 215 # call munmap
syscall 0
li.d $a7, 93 # call exit
syscall 0
+28
View File
@@ -0,0 +1,28 @@
#__clone(func, stack, flags, arg, ptid, tls, ctid)
# a0, a1, a2, a3, a4, a5, a6
# sys_clone(flags, stack, ptid, ctid, tls)
# a0, a1, a2, a3, a4
.global __clone
.hidden __clone
.type __clone,@function
__clone:
# Save function pointer and argument pointer on new thread stack
addi.d $a1, $a1, -16
st.d $a0, $a1, 0 # save function pointer
st.d $a3, $a1, 8 # save argument pointer
or $a0, $a2, $zero
or $a2, $a4, $zero
or $a3, $a6, $zero
or $a4, $a5, $zero
ori $a7, $zero, 220
syscall 0 # call clone
beqz $a0, 1f # whether child process
jirl $zero, $ra, 0 # parent process return
1:
ld.d $t8, $sp, 0 # function pointer
ld.d $a0, $sp, 8 # argument pointer
jirl $ra, $t8, 0 # call the user's function
ori $a7, $zero, 93
syscall 0 # child process exit
+29
View File
@@ -0,0 +1,29 @@
.global __cp_begin
.hidden __cp_begin
.global __cp_end
.hidden __cp_end
.global __cp_cancel
.hidden __cp_cancel
.hidden __cancel
.global __syscall_cp_asm
.hidden __syscall_cp_asm
.type __syscall_cp_asm,@function
__syscall_cp_asm:
__cp_begin:
ld.w $a0, $a0, 0
bnez $a0, __cp_cancel
move $t8, $a1 # reserve system call number
move $a0, $a2
move $a1, $a3
move $a2, $a4
move $a3, $a5
move $a4, $a6
move $a5, $a7
move $a7, $t8
syscall 0
__cp_end:
jr $ra
__cp_cancel:
la.local $t8, __cancel
jr $t8