|
From: Jeremy F. <je...@go...> - 2004-07-28 21:03:51
|
On Wed, 2004-07-28 at 19:03 +0100, Nicholas Nethercote wrote: > Erk, and so it seems %ecx gets passed to sys_clone too. Any ideas why > they didn't use %esi for the 4th arg as usual, but used %edi instead? clone() (along with fork and vfork) has an unusual calling convention because it isn't passed args as such, but the complete register set. It then picks out the registers it wants; the child ends up with a copy of all the parent's registers. %esi is used for the TLS info, so %edi is really the "fifth" argument. Note that VG_(clone) is just something I wrote, and it doesn't necessarily conform to any other clone-like function API, and the order of its args are arbitrary. As an aside, this isn't really a different calling convention. All syscalls are passed a struct pt_regs argument, which is placed on the stack. If the function is prototyped to take separate args, it gets the first members of struct pt_regs: ebx, ecx, edx, esi... J |