From: Paul Brook <paul@codesourcery.com>
To: anarkhos@vfemail.net
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Endian and userspace issues
Date: Tue, 4 Jan 2005 21:22:48 +0000 [thread overview]
Message-ID: <200501042122.49111.paul@codesourcery.com> (raw)
In-Reply-To: <p0610051bbe00ada543b3@[24.20.233.105]>
On Tuesday 04 January 2005 20:37, anarkhos@vfemail.net wrote:
> >However shared libraries tend to have much less cleanly defined
> > interfaces. They tend do share data structures, and be much more closely
> > linked. This makes adding the translation layer between the two much more
> > difficult, if not impossible. It generally requires designing the
> > interface with this in mind from the start, and in general can't be
> > retrofitted to existing libraries. Shared libraries (aka dlls) share an
> > address space with the main application, so tend to be very hard to
> > disentangle from each other.
> >
> >Paul
>
> I can see your point in that if a non-native app passed an address to a
> space of little endian memory to a native DLL which required big-endian
> memory...but my suggestion was that everything would be native-endian after
> one initial translation.
This only works in trivial cases. For instance anything involving 64-bit
arithmetic on a 32-bit machine will load a 64-bit value with two separate
32-bit loads. After your translation these will be the wrong way round.
> PS: WINE can insert thunk layers between the app and DLLs or between the
> DLLs. It currently does this for debugging purposes (printing arguments and
> return values), but could it not convert these values before passing them
> on?
But WINE knows the details of the libraries it is thunking, and can only do it
for specific dlls, right?
Translating function arguments requires source level knowledge if the library
(how many and what type of arguments to expect). If you only have simple
arguments/return values this is ok, when pointers and structures are involved
it becomes much more complicated because you need to know the purpose of each
field.
This is reasonably straightforward if implemented at the source level (either
library or applicaton is annotated properly and compiled specifically for
this). For a specific special case interface (eg. mozilla plugins), it should
be possible with a bit of work (depends on the interface). AFAICS it is not
possible to implement a general code that will work with arbitrary
libraries/libraries.
Paul
next prev parent reply other threads:[~2005-01-04 21:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-04 19:44 [Qemu-devel] Endian and userspace issues anarkhos
2005-01-04 20:16 ` Paul Brook
2005-01-04 20:37 ` anarkhos
2005-01-04 21:22 ` Paul Brook [this message]
2005-01-05 4:11 ` John Davidorff Pell
2005-01-05 4:17 ` anarkhos
[not found] ` <p0610051ebe011a73c421@24.20.233.105>
2005-01-05 6:00 ` Karl Magdsick
2005-01-05 10:34 ` Gwenole Beauchesne
2005-01-05 13:03 ` Daniel Egger
2005-01-05 13:38 ` Magnus Damm
2005-01-05 14:00 ` Daniel Egger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200501042122.49111.paul@codesourcery.com \
--to=paul@codesourcery.com \
--cc=anarkhos@vfemail.net \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.