All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Running the user emulation
@ 2010-08-11  8:31 C K Kashyap
  2010-08-11  8:42 ` Stefan Weil
  0 siblings, 1 reply; 9+ messages in thread
From: C K Kashyap @ 2010-08-11  8:31 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 267 bytes --]

Hi,
I've built qemu on my mac osx using this config -
./configure --prefix=/Users/ckk/local/ --target-list="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

[-- Attachment #2: Type: text/html, Size: 325 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] Running the user emulation
  2010-08-11  8:31 [Qemu-devel] Running the user emulation C K Kashyap
@ 2010-08-11  8:42 ` Stefan Weil
  2010-08-11  9:06   ` C K Kashyap
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Weil @ 2010-08-11  8:42 UTC (permalink / raw)
  To: C K Kashyap; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 686 bytes --]

Am 11.08.2010 10:31, schrieb C K Kashyap:
> Hi,
> I've built qemu on my mac osx using this config -
> ./configure --prefix=/Users/ckk/local/ --target-list="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=i386-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

[-- Attachment #2: Type: text/html, Size: 1197 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] Running the user emulation
  2010-08-11  8:42 ` Stefan Weil
@ 2010-08-11  9:06   ` C K Kashyap
  2010-08-11  9:18     ` Stefan Weil
  0 siblings, 1 reply; 9+ messages in thread
From: C K Kashyap @ 2010-08-11  9:06 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1022 bytes --]

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?



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=/Users/ckk/local/ --target-list="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=i386-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

[-- Attachment #2: Type: text/html, Size: 1593 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] Running the user emulation
  2010-08-11  9:06   ` C K Kashyap
@ 2010-08-11  9:18     ` Stefan Weil
  2010-08-11  9:33       ` C K Kashyap
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Weil @ 2010-08-11  9:18 UTC (permalink / raw)
  To: C K Kashyap; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1563 bytes --]

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 <weil@mail.berlios.de 
> <mailto: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=/Users/ckk/local/
>>     --target-list="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=i386-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


[-- Attachment #2: Type: text/html, Size: 2375 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] Running the user emulation
  2010-08-11  9:18     ` Stefan Weil
@ 2010-08-11  9:33       ` C K Kashyap
  2010-08-11 10:03         ` Stefan Weil
  2010-08-11 18:38         ` Natalia Portillo
  0 siblings, 2 replies; 9+ messages in thread
From: C K Kashyap @ 2010-08-11  9:33 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1943 bytes --]

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 similar 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 <weil@mail.berlios.de> 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 <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=/Users/ckk/local/ --target-list="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=i386-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

[-- Attachment #2: Type: text/html, Size: 2919 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] Running the user emulation
  2010-08-11  9:33       ` C K Kashyap
@ 2010-08-11 10:03         ` Stefan Weil
  2010-08-11 11:26           ` C K Kashyap
  2010-08-11 18:38         ` Natalia Portillo
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Weil @ 2010-08-11 10:03 UTC (permalink / raw)
  To: C K Kashyap; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 3048 bytes --]

Am 11.08.2010 11:33, schrieb C K Kashyap:
> 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 
> similar on mac (as far as writing to stdout is concerned) .... Would 
> it be possible/easy to give it a shot?
>
>

It should be possible. Projects like wine can emulate windows system 
calls on linux.
Emulating darwin system calls on linux is much easier.

If you want to try it yourself, you could start by removing the exit 
from file configure:

     if test "$linux" != "yes" ; then
       echo "ERROR: Target '$target' is only available on a Linux host"
       # exit 1
     fi

Then you can run 'configure --target-list=i386-linux-user'.
Run make and fix all error messages which you will get.
If you think they are in code which you don't need for your a.out,
#if 0 ... #endif helps to remove that code.

Run the new-built qemu-i386 with your a.out and fix the remaining bugs.

That's all :-)


> On Wed, Aug 11, 2010 at 2:48 PM, Stefan Weil <weil@mail.berlios.de 
> <mailto:weil@mail.berlios.de>> 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
>>     <weil@mail.berlios.de <mailto: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=/Users/ckk/local/
>>>         --target-list="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=i386-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


[-- Attachment #2: Type: text/html, Size: 4321 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] Running the user emulation
  2010-08-11 10:03         ` Stefan Weil
@ 2010-08-11 11:26           ` C K Kashyap
  0 siblings, 0 replies; 9+ messages in thread
From: C K Kashyap @ 2010-08-11 11:26 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2922 bytes --]

Thanks Stefan for the explanation ... It does not look like a pleasant thing
to do though :)

On Wed, Aug 11, 2010 at 3:33 PM, Stefan Weil <weil@mail.berlios.de> wrote:

>  Am 11.08.2010 11:33, schrieb C K Kashyap:
>
> 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 similar
> on mac (as far as writing to stdout is concerned) .... Would it be
> possible/easy to give it a shot?
>
>
>
> It should be possible. Projects like wine can emulate windows system calls
> on linux.
> Emulating darwin system calls on linux is much easier.
>
> If you want to try it yourself, you could start by removing the exit from
> file configure:
>
>     if test "$linux" != "yes" ; then
>       echo "ERROR: Target '$target' is only available on a Linux host"
>       # exit 1
>     fi
>
> Then you can run 'configure --target-list=i386-linux-user'.
> Run make and fix all error messages which you will get.
> If you think they are in code which you don't need for your a.out,
> #if 0 ... #endif helps to remove that code.
>
> Run the new-built qemu-i386 with your a.out and fix the remaining bugs.
>
> That's all :-)
>
>
>  On Wed, Aug 11, 2010 at 2:48 PM, Stefan Weil <weil@mail.berlios.de>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 <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=/Users/ckk/local/ --target-list="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=i386-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

[-- Attachment #2: Type: text/html, Size: 4606 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] Running the user emulation
  2010-08-11  9:33       ` C K Kashyap
  2010-08-11 10:03         ` Stefan Weil
@ 2010-08-11 18:38         ` Natalia Portillo
  2010-08-12  8:37           ` C K Kashyap
  1 sibling, 1 reply; 9+ messages in thread
From: Natalia Portillo @ 2010-08-11 18:38 UTC (permalink / raw)
  To: C K Kashyap; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2521 bytes --]

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ó:

> 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 similar 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 <weil@mail.berlios.de> 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 <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=/Users/ckk/local/ --target-list="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=i386-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


[-- Attachment #2: Type: text/html, Size: 3677 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] Running the user emulation
  2010-08-11 18:38         ` Natalia Portillo
@ 2010-08-12  8:37           ` C K Kashyap
  0 siblings, 0 replies; 9+ messages in thread
From: C K Kashyap @ 2010-08-12  8:37 UTC (permalink / raw)
  To: Natalia Portillo; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 3289 bytes --]

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 <claunia@claunia.com>wrote:

> 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ó:
>
> 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 similar
> 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 <weil@mail.berlios.de> 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 <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=/Users/ckk/local/ --target-list="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=i386-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

[-- Attachment #2: Type: text/html, Size: 4611 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-08-12  8:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-11  8:31 [Qemu-devel] Running the user emulation C K Kashyap
2010-08-11  8:42 ` Stefan Weil
2010-08-11  9:06   ` C K Kashyap
2010-08-11  9:18     ` Stefan Weil
2010-08-11  9:33       ` C K Kashyap
2010-08-11 10:03         ` Stefan Weil
2010-08-11 11:26           ` C K Kashyap
2010-08-11 18:38         ` Natalia Portillo
2010-08-12  8:37           ` C K Kashyap

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.