Fix the order of arguments to sys_clone for x86.
Unlike x86-64, x86's arguments are just like every other architecture's. Change-Id: Ic6da23f2a70599683b68e7e12ab9ba061e0b349c
This commit is contained in:
parent
6ae2f22dc0
commit
99c393dff3
@ -7,29 +7,32 @@ ENTRY(__bionic_clone)
|
|||||||
pushl %esi
|
pushl %esi
|
||||||
pushl %edi
|
pushl %edi
|
||||||
|
|
||||||
# insert arguments onto the child stack
|
# Align child stack.
|
||||||
movl 20(%esp), %ecx
|
movl 20(%esp), %ecx
|
||||||
andl $~15, %ecx
|
andl $~15, %ecx
|
||||||
movl 36(%esp), %eax
|
|
||||||
movl %eax, -16(%ecx)
|
|
||||||
movl 40(%esp), %eax
|
|
||||||
movl %eax, -12(%ecx)
|
|
||||||
|
|
||||||
|
# Copy 'fn' and 'arg' onto the child stack
|
||||||
|
movl 36(%esp), %eax # Read 'fn'.
|
||||||
|
movl %eax, -16(%ecx) # Write 'fn'.
|
||||||
|
movl 40(%esp), %eax # Read 'arg'.
|
||||||
|
movl %eax, -12(%ecx) # Write 'arg'.
|
||||||
subl $16, %ecx
|
subl $16, %ecx
|
||||||
movl 16(%esp), %ebx
|
|
||||||
movl 24(%esp), %edx
|
|
||||||
movl 32(%esp), %esi
|
|
||||||
movl 28(%esp), %edi
|
|
||||||
|
|
||||||
# make system call
|
# Make the system call.
|
||||||
movl $__NR_clone, %eax
|
movl $__NR_clone, %eax
|
||||||
|
movl 16(%esp), %ebx # flags
|
||||||
|
#movl %ecx, %ecx # child stack (already there)
|
||||||
|
movl 24(%esp), %edx # parent_tid
|
||||||
|
movl 28(%esp), %esi # tls
|
||||||
|
movl 32(%esp), %edi # child_tid
|
||||||
int $0x80
|
int $0x80
|
||||||
|
|
||||||
|
# Check result.
|
||||||
cmpl $0, %eax
|
cmpl $0, %eax
|
||||||
je bc_child
|
je bc_child
|
||||||
jg bc_parent
|
jg bc_parent
|
||||||
|
|
||||||
# an error occurred, set errno and return -1
|
# An error occurred, so set errno and return -1.
|
||||||
negl %eax
|
negl %eax
|
||||||
pushl %eax
|
pushl %eax
|
||||||
call __set_errno
|
call __set_errno
|
||||||
@ -38,9 +41,6 @@ ENTRY(__bionic_clone)
|
|||||||
jmp bc_return
|
jmp bc_return
|
||||||
|
|
||||||
bc_child:
|
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
|
call __bionic_clone_entry
|
||||||
hlt
|
hlt
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user