Wine Emulation: Swapping functions

Pierre d'Herbemont stegefin at free.fr
Wed Aug 25 06:32:22 CDT 2004


On 24 août 04, at 22:50, Alexandre Julliard wrote:

> "Pierre d'Herbemont" <stegefin at free.fr> writes:
>
>> Hi Alexandre,
>>
>> This patch allows to load a PE exe to memory. You may notice that
>> there is no "mass" byte swapping. The technics used here is a bit
>> developer here:
>> http://stegefin.free.fr/wine/
>> You might prefer a more conventional way of doing the byte swapping,
>> in this case tell me. We might still need this approach since it could
>> efficient for sharing data accross the LE exe and the BE winelib.
>
> It doesn't seem very efficient to trap on every memory access...
> Besides, I don't see how this can possibly work, there is no guarantee
> that the compiler is going to generate accesses that always match the
> size of the requested type, memcpy() being the obvious example.

I agree. though memcpy would need a wrapper which would set the dest 
memory region to litlle endian, but we are coming to the limitation of 
this method.

> I think you are going in the wrong direction with this; the right way
> IMO is to compile Wine for x86 and run the whole Wine+app under the
> CPU emulator. Otherwise you'll have to write wrappers for each of the
> 15,000 APIs.

I agree it is easier, but as mike pointed we can't easily access OS X 
API, though I am sure there is a way. Anyway I would like to give the 
emulation inside method a try. I think using automatically generated 
wrapper can work for most APIs. For sure it won't be easy but I think 
there is hope in succeeding. I'll also try to add to qemu the 
darwin-user target, so we can see the limitation of going this way ;)

Pierre.




More information about the wine-devel mailing list