am 9cbe1e63: Merge "Fix __pthread_clone and __bionic_clone error handling on x86."
# Via Elliott Hughes (1) and Gerrit Code Review (1) * commit '9cbe1e63ddf8b61b8ded3d357a30c3d6ed67906f': Fix __pthread_clone and __bionic_clone error handling on x86.
This commit is contained in:
commit
32a2340067
@ -21,27 +21,33 @@ ENTRY(__pthread_clone)
|
||||
|
||||
subl $16, %ecx
|
||||
movl 20(%esp), %ebx
|
||||
|
||||
# make system call
|
||||
movl $__NR_clone, %eax
|
||||
int $0x80
|
||||
test %eax, %eax
|
||||
jns 1f
|
||||
|
||||
cmpl $0, %eax
|
||||
je pc_child
|
||||
jg pc_parent
|
||||
|
||||
# an error occurred, set errno and return -1
|
||||
negl %eax
|
||||
pushl %eax
|
||||
call __set_errno
|
||||
addl $4, %esp
|
||||
orl $-1, %eax
|
||||
jmp 2f
|
||||
|
||||
1:
|
||||
jnz 2f
|
||||
jmp pc_return
|
||||
|
||||
pc_child:
|
||||
# we're in the child thread now, call __thread_entry
|
||||
# with the appropriate arguments on the child stack
|
||||
# we already placed most of them
|
||||
call __thread_entry
|
||||
hlt
|
||||
|
||||
2:
|
||||
pc_parent:
|
||||
# we're the parent; nothing to do.
|
||||
pc_return:
|
||||
popl %ecx
|
||||
popl %ebx
|
||||
ret
|
||||
@ -75,27 +81,33 @@ ENTRY(__bionic_clone)
|
||||
movl 24(%esp), %edx
|
||||
movl 32(%esp), %esi
|
||||
movl 28(%esp), %edi
|
||||
|
||||
# make system call
|
||||
movl $__NR_clone, %eax
|
||||
int $0x80
|
||||
test %eax, %eax
|
||||
jns 1f
|
||||
|
||||
cmpl $0, %eax
|
||||
je bc_child
|
||||
jg bc_parent
|
||||
|
||||
# an error occurred, set errno and return -1
|
||||
negl %eax
|
||||
pushl %eax
|
||||
call __set_errno
|
||||
addl $4, %esp
|
||||
orl $-1, %eax
|
||||
jmp 2f
|
||||
|
||||
1:
|
||||
jnz 2f
|
||||
jmp bc_return
|
||||
|
||||
bc_child:
|
||||
# we're in the child now, call __bionic_clone_entry
|
||||
# with the appropriate arguments on the child stack
|
||||
# we already placed most of them
|
||||
call __bionic_clone_entry
|
||||
hlt
|
||||
|
||||
2:
|
||||
bc_parent:
|
||||
# we're the parent; nothing to do.
|
||||
bc_return:
|
||||
popl %edi
|
||||
popl %esi
|
||||
popl %ebx
|
||||
|
Loading…
x
Reference in New Issue
Block a user