mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-06 20:58:33 +01:00
ARC: run child from the separate start block in __clone
For better debug experience use separate code block with extra cfi_* directives to run child (same as in __clone3). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
parent
3681cdb8f8
commit
447273e0bf
1 changed files with 25 additions and 15 deletions
|
@ -20,9 +20,6 @@
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
#define _ERRNO_H 1
|
#define _ERRNO_H 1
|
||||||
#include <bits/errno.h>
|
#include <bits/errno.h>
|
||||||
#include <tcb-offsets.h>
|
|
||||||
|
|
||||||
#define CLONE_SETTLS 0x00080000
|
|
||||||
|
|
||||||
/* int clone(int (*fn)(void *), void *child_stack,
|
/* int clone(int (*fn)(void *), void *child_stack,
|
||||||
int flags, void *arg, ...
|
int flags, void *arg, ...
|
||||||
|
@ -63,19 +60,9 @@ ENTRY (__clone)
|
||||||
ARC_TRAP_INSN
|
ARC_TRAP_INSN
|
||||||
|
|
||||||
cmp r0, 0 /* return code : 0 new process, !0 parent. */
|
cmp r0, 0 /* return code : 0 new process, !0 parent. */
|
||||||
|
beq thread_start_clone
|
||||||
blt L (__sys_err2) /* < 0 (signed) error. */
|
blt L (__sys_err2) /* < 0 (signed) error. */
|
||||||
jnz [blink] /* Parent returns. */
|
j [blink] /* Parent returns. */
|
||||||
|
|
||||||
/* child jumps off to @fn with @arg as argument
|
|
||||||
TP register already set by kernel. */
|
|
||||||
jl.d [r10]
|
|
||||||
mov r0, r11
|
|
||||||
|
|
||||||
/* exit() with result from @fn (already in r0). */
|
|
||||||
mov r8, __NR_exit
|
|
||||||
ARC_TRAP_INSN
|
|
||||||
/* In case it ever came back. */
|
|
||||||
flag 1
|
|
||||||
|
|
||||||
L (__sys_err):
|
L (__sys_err):
|
||||||
mov r0, -EINVAL
|
mov r0, -EINVAL
|
||||||
|
@ -89,5 +76,28 @@ L (__sys_err2):
|
||||||
position independent. */
|
position independent. */
|
||||||
b __syscall_error
|
b __syscall_error
|
||||||
PSEUDO_END (__clone)
|
PSEUDO_END (__clone)
|
||||||
|
|
||||||
|
|
||||||
|
.align 4
|
||||||
|
.type thread_start_clone, %function
|
||||||
|
thread_start_clone:
|
||||||
|
cfi_startproc
|
||||||
|
/* Terminate call stack by noting ra is undefined. */
|
||||||
|
cfi_undefined (blink)
|
||||||
|
|
||||||
|
/* Child jumps off to @fn with @arg as argument. */
|
||||||
|
jl.d [r10]
|
||||||
|
mov r0, r11
|
||||||
|
|
||||||
|
/* exit() with result from @fn (already in r0). */
|
||||||
|
mov r8, __NR_exit
|
||||||
|
ARC_TRAP_INSN
|
||||||
|
|
||||||
|
/* In case it ever came back. */
|
||||||
|
flag 1
|
||||||
|
|
||||||
|
cfi_endproc
|
||||||
|
.size thread_start_clone, .-thread_start_clone
|
||||||
|
|
||||||
libc_hidden_def (__clone)
|
libc_hidden_def (__clone)
|
||||||
weak_alias (__clone, clone)
|
weak_alias (__clone, clone)
|
||||||
|
|
Loading…
Add table
Reference in a new issue