am cd834618: am 63b14755: Merge "libc/x86: ensure the stack 16-byte aligned when tasks created"
* commit 'cd834618c4752b61d54ff4005a8baa8219b822e4': libc/x86: ensure the stack 16-byte aligned when tasks created
This commit is contained in:
commit
4e362f230b
@ -13,16 +13,21 @@ __pthread_clone:
|
|||||||
pushl %ebx
|
pushl %ebx
|
||||||
pushl %ecx
|
pushl %ecx
|
||||||
movl 16(%esp), %ecx
|
movl 16(%esp), %ecx
|
||||||
movl 20(%esp), %ebx
|
|
||||||
|
# save tls
|
||||||
|
movl %ecx, %ebx
|
||||||
|
# 16-byte alignment on child stack
|
||||||
|
andl $~15, %ecx
|
||||||
|
|
||||||
# insert arguments onto the child stack
|
# insert arguments onto the child stack
|
||||||
movl 12(%esp), %eax
|
movl 12(%esp), %eax
|
||||||
movl %eax, -12(%ecx)
|
movl %eax, -16(%ecx)
|
||||||
movl 24(%esp), %eax
|
movl 24(%esp), %eax
|
||||||
movl %eax, -8(%ecx)
|
movl %eax, -12(%ecx)
|
||||||
movl %ecx, -4(%ecx)
|
movl %ebx, -8(%ecx)
|
||||||
|
|
||||||
subl $16, %ecx
|
subl $16, %ecx
|
||||||
|
movl 20(%esp), %ebx
|
||||||
movl $__NR_clone, %eax
|
movl $__NR_clone, %eax
|
||||||
int $0x80
|
int $0x80
|
||||||
test %eax, %eax
|
test %eax, %eax
|
||||||
@ -40,7 +45,7 @@ __pthread_clone:
|
|||||||
# 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
|
||||||
jmp __thread_entry
|
call __thread_entry
|
||||||
hlt
|
hlt
|
||||||
|
|
||||||
2:
|
2:
|
||||||
|
@ -51,6 +51,8 @@
|
|||||||
#
|
#
|
||||||
_start:
|
_start:
|
||||||
mov %esp, %eax
|
mov %esp, %eax
|
||||||
|
# before push arguments, align the stack to a 16 byte boundary
|
||||||
|
andl $~15, %esp
|
||||||
mov $1f, %edx
|
mov $1f, %edx
|
||||||
pushl %edx
|
pushl %edx
|
||||||
mov $0f, %edx
|
mov $0f, %edx
|
||||||
|
@ -51,6 +51,8 @@
|
|||||||
#
|
#
|
||||||
_start:
|
_start:
|
||||||
mov %esp, %eax
|
mov %esp, %eax
|
||||||
|
# before push arguments, align the stack to a 16 byte boundary
|
||||||
|
andl $~15, %esp
|
||||||
mov $1f, %edx
|
mov $1f, %edx
|
||||||
pushl %edx
|
pushl %edx
|
||||||
mov $0f, %edx
|
mov $0f, %edx
|
||||||
|
Loading…
x
Reference in New Issue
Block a user