46
46
cror cr0*4+eq,cr1*4+eq,cr0*4+eq
47
47
beq- cr0,L(badargs)
49
/* Set up stack frame for parent. */
51
cfi_adjust_cfa_offset (80)
49
/* Save some regs in parm save area. */
63
61
/* Set up stack frame for child. */
66
stdu r0,-48(r4) /* min stack frame is 48 bytes per ABI */
64
stdu r0,-112(r4) /* min stack frame is 112 bytes per ABI */
68
66
/* Save fn, args, stack across syscall. */
69
mr r29,r3 /* Function in r29. */
70
mr r30,r4 /* Stack pointer in r30. */
67
mr r30,r3 /* Function in r30. */
72
mr r28,r5 /* Flags in r28. */
69
mr r29,r5 /* Flags in r29. */
74
71
mr r31,r6 /* Argument in r31. */
76
/* 'flags' argument is first parameter to clone syscall. (The other
77
argument is the stack pointer, already in r4.) */
73
/* 'flags' argument is first parameter to clone syscall.
74
Second is the stack pointer, already in r4. */
79
76
/* Move the parent_tid, child_tid and tls arguments. */
94
91
bne- cr1,L(parent) /* The '-' is to minimise the race. */
97
andis. r0,r28,CLONE_THREAD>>16
94
andis. r0,r29,CLONE_THREAD>>16
101
98
bne- cr0,L(nomoregetpid)
102
99
DO_CALL(SYS_ify(getpid))
119
116
b JUMPTARGET(__GI__exit)
121
118
b JUMPTARGET(_exit)
119
/* We won't ever get here but provide a nop so that the linker
120
will insert a toc adjusting stub if necessary. */
127
TAIL_CALL_SYSCALL_ERROR
125
130
/* Parent. Restore registers & return. */
134
b JUMPTARGET(__syscall_error)
138
b JUMPTARGET(__syscall_error)
141
148
END (BP_SYM (__clone))
143
150
weak_alias (BP_SYM (__clone), BP_SYM (clone))