Help getting amd64 assembly patch into wine?

David Laight david at l8s.co.uk
Fri Oct 5 12:30:59 CDT 2012


On Fri, Oct 05, 2012 at 04:27:24PM +0200, Joerg-Cyril.Hoehle at t-systems.com wrote:
> So bad, now what is actually needed?
> 
> Think assembly.
> 
> Using your test example:
> +    p_vcomp_fork(0, 5, _test_worker5, 1, 2, 3, 4, 5);
> 
> _vcomp_fork finds data:
> 1. on the stack
> 2. in registers
> 3. in FP registers
> The C stack layout is (topmost first):
>   0, then 5, &_test_worker5, 1, 2, etc.

That sort of stack layout is likely to be valid for i386, but not for amd64.
64-bit (amd64) windows uses a different calling convention from (almost)
every one else.
But I don't think you can convert a partially consumed va_list back into
an argument list (eg to delete an initail argument) without 'cheating'.

On linux (and probably windows) the first int/ptr args are passed in
integer registers and the first few FP args are passed in FP registers.
When the registers run out, values are stacked.

This means that these two calls are equivalent:
	printf("int %d, fp %f\n", 2, 3.15159);
	printf("int %d, fp %f\n", 3.15159, 2);
the va_arg() processing has to remember which registers have already
been processed in order to know where to find the next argument.

	David

-- 
David Laight: david at l8s.co.uk



More information about the wine-devel mailing list