Help getting amd64 assembly patch into wine?

Kyle Auble randomidman48 at yahoo.com
Thu Oct 4 15:52:39 CDT 2012


On 10/03/2012 09:49 PM, Dan Kegel wrote:

> The main challenge was figuring out how to get the variable
> list of arguments off the stack, and then put them back onto
> the stack when calling the provided function pointer.
> This bit of varargs hackery can't be done in pure C as far as I
> can tell, so I used assembly.
> I started programming in machine language long ago,
> so getting that working wasn't too hard once I
> realized that's what was needed.  Getting it to pass the
> Alexandre test is another matter.

> Alexandre did give feedback on one earlier iteration of
> the patch, telling me I was re-inventing the wheel, so I
> tossed my old assembly and copied the helper-calling code
> nearly verbatim from call_method in oleaut32/typelib.c

I haven't studied assembly in a while, and I've
never looked at this part of Wine before, but
every once in a while, a silly question from a
novice doesn't hurt.

I'm just wondering is assembly definitely needed?
This is just based on some googling and skimming
through StackOverflow, but it sounds like you can
still use va_list on amd64. It just takes some
tweaking:
http://stackoverflow.com/questions/8047362

One method involves a "va_copy" macro, but that
may only apply to C99 or later:
https://forums.oracle.com/forums/message.jspa?messageID=8536520

The other solution mentioned just involves
wrapping va_list inside a struct, as mentioned in
the top answer of the first link. I don't know if
that helps or if I'm totally misunderstanding the
problem.

- Kyle




More information about the wine-devel mailing list