mailing list of musl libc
 help / color / mirror / code / Atom feed
92ebe76ce3fedffe1d83f94865f03065b28488ff blob 1002 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
54
55
56
57
58
 
.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;

# SYS_clone = 120
# SYS_exit = 1

# create initial stack frame for new thread
clrrwi 4, 4, 4
li 0, 0
stwu 0, -16(4)

# save fn and arg to child stack
stw 3, 4(4)
stw 6, 8(4)

#move c into first arg
mr 3, 5
#mr 4, 4
mr 5, 7
mr 6, 8
mr 7, 9

# move syscall number into r0    
li 0, 120

sc

# check for syscall error
bns+ 1f # jump to label 1 if no summary overflow.
#else
neg 3, 3 #negate the result (errno)
1:
# compare sc result with 0
cmpwi cr7, 3, 0

# if not 0, return
bnelr cr7

#else: we're the child
#call funcptr: move arg (d) into r3
lwz 3, 8(1)
#load funcptr (a) into CTR
lwz 0, 4(1)
mtctr 0
# call CTR reg
bctrl
# mov SYS_exit into r0 (the exit param is already in r3)
li 0, 1
sc
debug log:

solving 92ebe76 ...
found 92ebe76 in https://inbox.vuxu.org/musl/1462052365-4747-1-git-send-email-koorogi@koorogi.info/
found a57dbcc in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 a57dbcced8f357c13db3ac23e727823a5597da05	src/thread/powerpc/clone.s

applying [1/1] https://inbox.vuxu.org/musl/1462052365-4747-1-git-send-email-koorogi@koorogi.info/
diff --git a/src/thread/powerpc/clone.s b/src/thread/powerpc/clone.s
index a57dbcc..92ebe76 100644

Checking patch src/thread/powerpc/clone.s...
Applied patch src/thread/powerpc/clone.s cleanly.

index at:
100644 92ebe76ce3fedffe1d83f94865f03065b28488ff	src/thread/powerpc/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).