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
|
subl $16, %ecx
|
||||||
movl 20(%esp), %ebx
|
movl 20(%esp), %ebx
|
||||||
|
|
||||||
|
# make system call
|
||||||
movl $__NR_clone, %eax
|
movl $__NR_clone, %eax
|
||||||
int $0x80
|
int $0x80
|
||||||
test %eax, %eax
|
|
||||||
jns 1f
|
cmpl $0, %eax
|
||||||
|
je pc_child
|
||||||
|
jg pc_parent
|
||||||
|
|
||||||
# an error occurred, set errno and return -1
|
# an error occurred, set errno and return -1
|
||||||
negl %eax
|
negl %eax
|
||||||
|
pushl %eax
|
||||||
call __set_errno
|
call __set_errno
|
||||||
|
addl $4, %esp
|
||||||
orl $-1, %eax
|
orl $-1, %eax
|
||||||
jmp 2f
|
jmp pc_return
|
||||||
|
|
||||||
1:
|
|
||||||
jnz 2f
|
|
||||||
|
|
||||||
|
pc_child:
|
||||||
# we're in the child thread now, call __thread_entry
|
# we're in the child thread now, call __thread_entry
|
||||||
# with the appropriate arguments on the child stack
|
# with the appropriate arguments on the child stack
|
||||||
# we already placed most of them
|
# we already placed most of them
|
||||||
call __thread_entry
|
call __thread_entry
|
||||||
hlt
|
hlt
|
||||||
|
|
||||||
2:
|
pc_parent:
|
||||||
|
# we're the parent; nothing to do.
|
||||||
|
pc_return:
|
||||||
popl %ecx
|
popl %ecx
|
||||||
popl %ebx
|
popl %ebx
|
||||||
ret
|
ret
|
||||||
@ -75,27 +81,33 @@ ENTRY(__bionic_clone)
|
|||||||
movl 24(%esp), %edx
|
movl 24(%esp), %edx
|
||||||
movl 32(%esp), %esi
|
movl 32(%esp), %esi
|
||||||
movl 28(%esp), %edi
|
movl 28(%esp), %edi
|
||||||
|
|
||||||
|
# make system call
|
||||||
movl $__NR_clone, %eax
|
movl $__NR_clone, %eax
|
||||||
int $0x80
|
int $0x80
|
||||||
test %eax, %eax
|
|
||||||
jns 1f
|
cmpl $0, %eax
|
||||||
|
je bc_child
|
||||||
|
jg bc_parent
|
||||||
|
|
||||||
# an error occurred, set errno and return -1
|
# an error occurred, set errno and return -1
|
||||||
negl %eax
|
negl %eax
|
||||||
|
pushl %eax
|
||||||
call __set_errno
|
call __set_errno
|
||||||
|
addl $4, %esp
|
||||||
orl $-1, %eax
|
orl $-1, %eax
|
||||||
jmp 2f
|
jmp bc_return
|
||||||
|
|
||||||
1:
|
|
||||||
jnz 2f
|
|
||||||
|
|
||||||
|
bc_child:
|
||||||
# we're in the child now, call __bionic_clone_entry
|
# we're in the child now, call __bionic_clone_entry
|
||||||
# with the appropriate arguments on the child stack
|
# with the appropriate arguments on the child stack
|
||||||
# we already placed most of them
|
# we already placed most of them
|
||||||
call __bionic_clone_entry
|
call __bionic_clone_entry
|
||||||
hlt
|
hlt
|
||||||
|
|
||||||
2:
|
bc_parent:
|
||||||
|
# we're the parent; nothing to do.
|
||||||
|
bc_return:
|
||||||
popl %edi
|
popl %edi
|
||||||
popl %esi
|
popl %esi
|
||||||
popl %ebx
|
popl %ebx
|
||||||
|
Loading…
x
Reference in New Issue
Block a user