mailing list of musl libc
 help / color / mirror / code / Atom feed
a3cd5ce3c464db9d1914877c6beeb958ee917ae6 blob 1051 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
 
.text
.global __clone
.type __clone, %function
__clone:
	# int clone(fn, stack, flags, arg, ptid, tls, ctid)
	#            a  b       c     d     e    f    g
	#            3  4       5     6     7    8    9
	# pseudo C code:
	# tid = syscall(SYS_clone,c,b,e,f,g);
	# if (!tid) syscall(SYS_exit, a(d));
	# return tid;

	# save r30/r31 on stack so we can put fn/arg in them
	stdu 30, -32(1)
	std  31,   8(1)

	# save r3 (func) into r30, and r6(arg) into r31
	mr   30, 3
	mr   31, 6

	# shuffle args into correct registers and call SYS_clone
	mr    3, 5
	#mr   4, 4
	mr    5, 7
	mr    6, 8
	mr    7, 9
	li    0, 120  # SYS_clone = 120
	sc

	# if error, negate return (errno)
	bns+  1f
	neg   3, 3

1:	# if we're the parent, goto cleanup
	cmpwi cr7, 3, 0
	bne   cr7, 2f

	# we're the child. call fn(arg)
	mr     3, 31
	mr    12, 30
	mtctr 12
	bctrl

	# call SYS_exit. exit code is already in r3 from fn return value
	li    0, 1    # SYS_exit = 1
	sc

2:	# cleanup: restore r30/r31 from stack and return
	ld   30, 0(1)
	ld   31, 8(1)
	addi  1, 1, 32
	blr

debug log:

solving a3cd5ce ...
found a3cd5ce in https://inbox.vuxu.org/musl/1459113619-24090-3-git-send-email-koorogi@koorogi.info/ ||
	https://inbox.vuxu.org/musl/1459747571-9123-1-git-send-email-koorogi@koorogi.info/

applying [1/2] https://inbox.vuxu.org/musl/1459113619-24090-3-git-send-email-koorogi@koorogi.info/
diff --git a/src/thread/powerpc64/clone.s b/src/thread/powerpc64/clone.s
new file mode 100644
index 0000000..a3cd5ce

Checking patch src/thread/powerpc64/clone.s...
1:59: new blank line at EOF.
+
Applied patch src/thread/powerpc64/clone.s cleanly.
warning: 1 line adds whitespace errors.

skipping https://inbox.vuxu.org/musl/1459747571-9123-1-git-send-email-koorogi@koorogi.info/ for a3cd5ce
index at:
100644 a3cd5ce3c464db9d1914877c6beeb958ee917ae6	src/thread/powerpc64/clone.s

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).