mailing list of musl libc
 help / color / mirror / code / Atom feed
e971ab4bed05da1c9b25f90ac2d72a5f5c627f81 blob 912 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
debug log:

solving e971ab4b ...
found e971ab4b in https://git.vuxu.org/mirror/musl/

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).