|
From: <sv...@va...> - 2005-05-18 22:42:28
|
Author: njn Date: 2005-05-18 23:42:24 +0100 (Wed, 18 May 2005) New Revision: 3771 Modified: trunk/coregrind/m_syscalls/syscall-amd64-linux.S trunk/coregrind/m_syscalls/syscall-x86-linux.S Log: Comment only change: improve comments on VG_(clone) for x86 and AMD64. Modified: trunk/coregrind/m_syscalls/syscall-amd64-linux.S =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/coregrind/m_syscalls/syscall-amd64-linux.S 2005-05-18 19:50:20 = UTC (rev 3770) +++ trunk/coregrind/m_syscalls/syscall-amd64-linux.S 2005-05-18 22:42:24 = UTC (rev 3771) @@ -83,12 +83,12 @@ =20 System call requires: =20 + int $__NR_clone in %rax int flags in %rdi void* child_stack in %rsi pid_t* parent_tid in %rdx pid_t* child_tid in %r10 void* tls_ptr in %r8 - =20 */ .globl VG_(clone) VG_(clone): Modified: trunk/coregrind/m_syscalls/syscall-x86-linux.S =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/coregrind/m_syscalls/syscall-x86-linux.S 2005-05-18 19:50:20 UT= C (rev 3770) +++ trunk/coregrind/m_syscalls/syscall-x86-linux.S 2005-05-18 22:42:24 UT= C (rev 3771) @@ -71,11 +71,24 @@ fork()-like return-twice semantics, so it needs special handling here. =20 - int VG_(clone)(int (*fn)(void *), void *child_stack, int flags, void *a= rg,=20 - 0 4 8 12 - pid_t *child_tid, pid_t *parent_tid, vki_modify_ldt_t *) - 16 20 24 + Upon entry, we have: =20 + int (fn)(void*) in 0+FSZ(%esp) + void* child_stack in 4+FSZ(%esp) + int flags in 8+FSZ(%esp) + void* arg in 12+FSZ(%esp) + pid_t* child_tid in 16+FSZ(%esp) + pid_t* parent_tid in 20+FSZ(%esp) + void* tls_ptr in 24+FSZ(%esp) + + System call requires: + + int $__NR_clone in %eax + int flags in %ebx + void* child_stack in %ecx + pid_t* parent_tid in %edx + pid_t* child_tid in %edi + void* tls_ptr in %esi */ .globl VG_(clone) VG_(clone): @@ -83,7 +96,7 @@ push %ebx push %edi /* set up child stack with function and arg */ - movl 4+FSZ(%esp), %ecx /* child stack */ + movl 4+FSZ(%esp), %ecx /* syscall arg2: child stack */ movl 12+FSZ(%esp), %ebx /* fn arg */ movl 0+FSZ(%esp), %eax /* fn */ lea -8(%ecx), %ecx /* make space on stack */ @@ -91,21 +104,21 @@ movl %eax, 0(%ecx) /* fn */ =20 /* get other args to clone */ - movl 8+FSZ(%esp), %ebx /* flags */ - movl 20+FSZ(%esp), %edx /* parent tid * */ - movl 16+FSZ(%esp), %edi /* child tid * */ - movl 24+FSZ(%esp), %esi /* modify_ldt_t * */ + movl 8+FSZ(%esp), %ebx /* syscall arg1: flags */ + movl 20+FSZ(%esp), %edx /* syscall arg3: parent tid * */ + movl 16+FSZ(%esp), %edi /* syscall arg4: child tid * */ + movl 24+FSZ(%esp), %esi /* syscall arg5: tls_ptr * */ movl $__NR_clone, %eax - int $0x80 - testl %eax, %eax + int $0x80 /* clone() */ + testl %eax, %eax /* child if retval =3D=3D 0 */ jnz 1f =20 /* CHILD - call thread function */ popl %eax - call *%eax + call *%eax /* call fn */ =20 /* exit with result */ - movl %eax, %ebx + movl %eax, %ebx /* arg1: return value from fn */ movl $__NR_exit, %eax int $0x80 =20 |