All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Cc: anarkhos@vfemail.net
Subject: Re: [Qemu-devel] Endian and userspace issues
Date: Tue, 4 Jan 2005 20:16:03 +0000	[thread overview]
Message-ID: <200501042016.03910.paul@codesourcery.com> (raw)
In-Reply-To: <p06100518be009d266600@[24.20.233.105]>

On Tuesday 04 January 2005 19:44, anarkhos@vfemail.net wrote:
>  I became interested in QEMU when a Darwin port was revealed.
> Unfortunately, user mode emulation isn't supported yet. However, even when
> it is, I don't think (as I understand it) it will allow non-native binaries
> (in either ELF or Mach-O format) to call native ones. I found it
> interesting the documentation touts that user mode emulation can run WINE,
> but the entire WINE set of libs would have to run under emulation.
>
>  I understand that there is an inherent difficulty in that x86 executables
> assume they are running in little endian mode (I call it mode since some
> CPUs can run in either), but if one wants to have a shared user space with
> one set of natively optimized libraries what better way to implement it? We
> would have faster linking and faster CPU emulation.

The problem is that to mix any two different types of code (big/little endian, 
native ppc vs emultated x86, whatever) you need a well defined interface 
between the two so that you can insert thunks. These thunks do whatever 
conversion is necessary. To do this you need to know all information passed 
across the interface. In practice this means not just the actual function 
arguments, but also any data passed/returned indirectly via pointers, and any 
data accessed via global variables. 

For userspace emulation the thunked interface is the linux syscall layer. This 
is designed to be a clean interface between two different types of code, so 
translating from guest syscalls to host syscalls is relatively simple.

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

  reply	other threads:[~2005-01-04 20:29 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 [this message]
2005-01-04 20:37   ` anarkhos
2005-01-04 21:22     ` Paul Brook
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=200501042016.03910.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.