From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=35561 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OjTI2-0003xy-MA for qemu-devel@nongnu.org; Thu, 12 Aug 2010 04:37:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OjTHx-0002mX-VD for qemu-devel@nongnu.org; Thu, 12 Aug 2010 04:37:30 -0400 Received: from mail-wy0-f173.google.com ([74.125.82.173]:41161) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OjTHx-0002mI-O5 for qemu-devel@nongnu.org; Thu, 12 Aug 2010 04:37:25 -0400 Received: by wyi11 with SMTP id 11so1177652wyi.4 for ; Thu, 12 Aug 2010 01:37:23 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <4C626277.803@mail.berlios.de> <4C626AC8.8050908@mail.berlios.de> Date: Thu, 12 Aug 2010 14:07:23 +0530 Message-ID: Subject: Re: [Qemu-devel] Running the user emulation From: C K Kashyap Content-Type: multipart/alternative; boundary=0016e64c2764783d9f048d9c4674 List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Natalia Portillo Cc: qemu-devel@nongnu.org --0016e64c2764783d9f048d9c4674 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable You mean qemu on NetBSD or NetBSD in general - if so, I know that even Solaris can also execute linux binaries. And to do it, it would require me to modify the mac os - which I have no clue how to. Maybe I'll try out what Stefan said - although, on the face of it, it looks like an endless cycles of makefile fixes - it might just turn out to be easy. The idea is that, qemu already knows how to load up the elf etc .. and has the engine to execute x86 instructions .... all that's required is to provide an infrastructure that imitates linux's system calls. On Thu, Aug 12, 2010 at 12:08 AM, Natalia Portillo wro= te: > You can check how NetBSD does that. > > NetBSD is able to run executables from other UNIXes and POSIX-compatible > systems, including, Linux, IRIX, Darwin. > They do that with a series of syscall conversions and library > substitutions. > > That should be portable to use Mac OS X as host instead of NetBSD, and to > run thru QEMU (running x86 Linux software on PowerPC Darwin) > > Regards, > Natalia Portillo > > El 11/08/2010, a las 10:33, C K Kashyap escribi=F3: > > I was wondering if it would be easy to force build the user-emulation on > mac - as in, lets say my a.out from linux is really trivial - even > statically linked for that matter. All it does is, say, write "hello > world\n" to the screen - I'd imaging that write system call would be simi= lar > on mac (as far as writing to stdout is concerned) .... Would it be > possible/easy to give it a shot? > > > On Wed, Aug 11, 2010 at 2:48 PM, Stefan Weil wrote= : > >> Am 11.08.2010 11:06, schrieb C K Kashyap: >> >> Let me see if I understand this right - >> >> qemu loads the a.out and begins to interpret the x86 instructions in the >> a.out and when a system call happens, it makes the call the host system = .... >> is that right? >> >> >> >> Right. That's the way how linux user mode emulation (for example >> qemu-i386) works. >> See linux-user/syscall.c if you want to see more details. >> >> bsd-user and darwin-user are also supported (more or less), but >> darwin-user >> only supports translation of darwin/powerpc to darwin/x86 syscalls. >> It won't help you to run a linux a.out on your mac. >> >> >> >> >> On Wed, Aug 11, 2010 at 2:12 PM, Stefan Weil wrote= : >> >> Am 11.08.2010 10:31, schrieb C K Kashyap: >> >> Hi, >> I've built qemu on my mac osx using this config - >> ./configure --prefix=3D/Users/ckk/local/ --target-list=3D"i386-softmmu >> x86_64-softmmu" --enable-linux-user >> >> Now, I have a simple a.out built on linux - how can I run it using qemu = on >> my mac box? >> >> -- >> Regards, >> Kashyap >> >> >> Hi Kashyap, >> >> you cannot run it in user mode emulation unless you replace Mac OS by >> Linux >> on your mac box. Linux user emulations requires a Linux host. >> >> If you have a Linux host, you would need --target-list=3Di386-linux-user= . >> >> You can run your a.out if you run system emulation (e.g. >> i386-softmmu/qemu) >> and install Linux there, of course. >> >> Regards, >> Stefan >> >> >> >> >> -- >> Regards, >> Kashyap >> >> >> > > > -- > Regards, > Kashyap > > > --=20 Regards, Kashyap --0016e64c2764783d9f048d9c4674 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable You mean qemu on NetBSD or NetBSD in general - if so, I know that even Sola= ris can also execute linux binaries. And to do it, it would require me to m= odify the mac os - which I have no clue how to.

Maybe I'll try o= ut what Stefan said - although, on the face of it, it looks like an endless= cycles of makefile fixes - it might just turn out to be easy.

The idea is that, qemu already knows how to load up the elf etc .. and = has the engine to execute x86 instructions .... all that's required is = to provide an infrastructure that imitates linux's system calls.

On Thu, Aug 12, 2010 at 12:08 AM, Natalia Po= rtillo <claunia= @claunia.com> wrote:
You can check how NetBSD does that.
NetBSD is able to run executables from other UNIXes and P= OSIX-compatible systems, including, Linux, IRIX, Darwin.
They do = that with a series of syscall conversions and library substitutions.

That should be portable to use Mac OS X as host instead= of NetBSD, and to run thru QEMU (running x86 Linux software on PowerPC Dar= win)

Regards,
Natalia Portillo

El 11/08/2010, a las 10:33, C K Kashyap escri= bi=F3:

I was wondering if it would be easy to force build the user-emulation on m= ac - as in, lets say my a.out from linux is really trivial - even staticall= y linked for that matter. All it does is, say, write "hello world\n&qu= ot; to the screen - I'd imaging that write system call would be similar= on mac (as far as writing to stdout is concerned) .... Would it be possibl= e/easy to give it a shot?


On Wed, Aug 11, 2010 at 2:48 PM, Stefan = Weil <weil@mail.berlios.de> wrote:
=20
Am 11.08.2010 11:06, schrieb C K Kashyap:
=20 Let me see if I understand this right -

qemu loads the a.out and begins to interpret the x86 instructions in the a.out and when a system call happens, it makes the call the host system .... is that right?



Right. That's the way how linux user mode emulation (for example qemu-i386) works.
See linux-user/syscall.c if you want to see more details.

bsd-user and darwin-user are also supported (more or less), but darwin-user
only supports translation of darwin/powerpc to darwin/x86 syscalls.
It won't help you to run a linux a.out on your mac.




On Wed, Aug 11, 2010 at 2:12 PM, Stefan Weil <weil@mail.berlios.de> wrote:
Am 11.08.2010 10:31, schrieb C K Kashyap:
Hi,
I've built qemu on my mac osx using this config -
./configure --prefix=3D/Users/ckk/local/ --target-list=3D"i386-softmmu x86_64-softmmu" --enable-linux-user

Now, I have a simple a.out built on linux - how can I run it using qemu on my mac box?

--
Regards,
Kashyap

Hi Kashyap,

you cannot run it in user mode emulation unless you replace Mac OS by Linux
on your mac box. Linux user emulations requires a Linux host.

If you have a Linux host, you would need --target-list=3Di386-linux-user.
You can run your a.out if you run system emulation (e.g. i386-softmmu/qemu)
and install Linux there, of course.

Regards,
Stefan



--
Regards,
Kashyap




--
Regards,
Kashyap




--
Regards,
Kashyap
--0016e64c2764783d9f048d9c4674--