All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Port to IRIX host
@ 2004-10-03  7:13 Johannes Schindelin
  2004-10-03 11:57 ` Fabrice Bellard
  0 siblings, 1 reply; 12+ messages in thread
From: Johannes Schindelin @ 2004-10-03  7:13 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 368 bytes --]

Hi,

I just ran Linux in QEmu on IRIX(mips) for the first time! The patch is
attached. The other attachment is my documentation, which you might find
helpful, if only to understand how QEmu works. It consists of three parts:
Detailed explanation of dynamic translation, a HOWTO port to a new host,
and a loose collection of problems I encountered/solved.

Ciao,
Dscho

[-- Attachment #2: Type: APPLICATION/x-gunzip, Size: 6196 bytes --]

[-- Attachment #3: Type: APPLICATION/x-gunzip, Size: 39798 bytes --]

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

* Re: [Qemu-devel] Port to IRIX host
  2004-10-03  7:13 [Qemu-devel] Port to IRIX host Johannes Schindelin
@ 2004-10-03 11:57 ` Fabrice Bellard
  2004-10-03 14:00   ` Johannes Schindelin
  0 siblings, 1 reply; 12+ messages in thread
From: Fabrice Bellard @ 2004-10-03 11:57 UTC (permalink / raw)
  To: qemu-devel

Thank you for the mips port and the documentation. Just one remark 
before merging your patch: could you distinguish the IRIX specific parts 
from the mips specific ones ? I saw you used '#ifdef __mips__' at places 
where it may be in fact IRIX specific code.

Another note: for MIPS, using an alternate (embedded ?) ABI may give 
simpler code for op.o, in particular for the 'op parameters' and for the 
function calls. Did you look at this ?

I can add your documentation in a new doc/ directory in QEMU. Do you 
have other ideas ?

Fabrice.

Johannes Schindelin wrote:
> Hi,
> 
> I just ran Linux in QEmu on IRIX(mips) for the first time! The patch is
> attached. The other attachment is my documentation, which you might find
> helpful, if only to understand how QEmu works. It consists of three parts:
> Detailed explanation of dynamic translation, a HOWTO port to a new host,
> and a loose collection of problems I encountered/solved.
> 
> Ciao,
> Dscho
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel

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

* Re: [Qemu-devel] Port to IRIX host
  2004-10-03 11:57 ` Fabrice Bellard
@ 2004-10-03 14:00   ` Johannes Schindelin
  2004-10-03 14:12     ` Jim C. Brown
                       ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Johannes Schindelin @ 2004-10-03 14:00 UTC (permalink / raw)
  To: qemu-devel

Hi,

On Sun, 3 Oct 2004, Fabrice Bellard wrote:

> Thank you for the mips port and the documentation. Just one remark
> before merging your patch: could you distinguish the IRIX specific parts
> from the mips specific ones ? I saw you used '#ifdef __mips__' at places
> where it may be in fact IRIX specific code.

Yes, you are correct. I just used what was easiest for me, but I will add
a check in configure, and according to that, a define.

> Another note: for MIPS, using an alternate (embedded ?) ABI may give
> simpler code for op.o, in particular for the 'op parameters' and for the
> function calls. Did you look at this ?

I tried to find another ABI, and as you can find in Makefile.target, I use
the -mno-abicalls option to gcc, exactly for that reason. As I stated in
the Remarks section of my documentation: after many experiments I just
gave up and coded it in assembly. BTW I did not know one thing about MIPS
assembler before starting this little project, so my code is very likely
not to be optimal.

> I can add your documentation in a new doc/ directory in QEMU. Do you
> have other ideas ?

Thank you! And you can rename the file...

Other ideas? Of course: Next step is a target-mips ;-) No really, I would
appreciate if some people review my code - that means all but mips-dis.c,
which is pasted together from gdb - and you commit it.

Please note that there is one TODO left: Right now everything works fine
in single step mode, but as soon as I disable that, a guest Linux hangs
in the calibration loop. I guess there's something awkward with
interrupts.

Also, I did not thoroughly test the 8-bit support in hw/vga.c. My SDL gave
me 8 bit per default - IRIX's X is capable of having windows side by side
with different depths... and so SDL choses the worst :-) BTW, the lack of
support for 8 bit depths probably was the reason that QEmu with a remote X
display did show a window, but no content.

In order to deal with those unaligned accesses in hw/vga_template.h, I
introduced a macro "stl_host", which stores an unaligned uin32_t in host
byte order. Should this rather be "stlu_host", and defined in cpu-all.h?

To be honest, my IRIX machine is not a very fast one, so I did the port
mainly because I could, and also because I wanted to learn the internals
of QEmu and MIPS...

A question: i386-user is supposed to only run linux binaries, right? What
are the reasons that it is disabled on Windows? Could there be a way to
make it run on Windows, and also on IRIX?

Ciao,
Dscho

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

* Re: [Qemu-devel] Port to IRIX host
  2004-10-03 14:00   ` Johannes Schindelin
@ 2004-10-03 14:12     ` Jim C. Brown
  2004-10-03 14:44     ` Fabrice Bellard
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Jim C. Brown @ 2004-10-03 14:12 UTC (permalink / raw)
  To: qemu-devel

On Sun, Oct 03, 2004 at 04:00:50PM +0200, Johannes Schindelin wrote:
> A question: i386-user is supposed to only run linux binaries, right? What
> are the reasons that it is disabled on Windows? Could there be a way to
> make it run on Windows, and also on IRIX?
> 
> Ciao,
> Dscho
> 

i386-user makes Linux syscalls. To use it in Windows, you'd have to emulate the
linux syscalls. Same for IRIX. Its purpose (the original purpose of qemu) is to
let you run x86 linux binaries (such as Wine) on non-x86 distros.

-- 
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.

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

* Re: [Qemu-devel] Port to IRIX host
  2004-10-03 14:00   ` Johannes Schindelin
  2004-10-03 14:12     ` Jim C. Brown
@ 2004-10-03 14:44     ` Fabrice Bellard
  2004-10-04  6:41       ` Johannes Schindelin
  2004-10-03 15:23     ` Karl Magdsick
  2004-10-03 16:48     ` Karl Magdsick
  3 siblings, 1 reply; 12+ messages in thread
From: Fabrice Bellard @ 2004-10-03 14:44 UTC (permalink / raw)
  To: qemu-devel

Johannes Schindelin wrote:
> Yes, you are correct. I just used what was easiest for me, but I will add
> a check in configure, and according to that, a define.

Good.

>>Another note: for MIPS, using an alternate (embedded ?) ABI may give
>>simpler code for op.o, in particular for the 'op parameters' and for the
>>function calls. Did you look at this ?
> 
> 
> I tried to find another ABI, and as you can find in Makefile.target, I use
> the -mno-abicalls option to gcc, exactly for that reason. As I stated in
> the Remarks section of my documentation: after many experiments I just
> gave up and coded it in assembly. BTW I did not know one thing about MIPS
> assembler before starting this little project, so my code is very likely
> not to be optimal.

OK. I am sure there is a better solution for the op parameters, but this 
is not critical since your solution is working.

>>I can add your documentation in a new doc/ directory in QEMU. Do you
>>have other ideas ?
> 
> 
> Thank you! And you can rename the file...
> 
> Other ideas? Of course: Next step is a target-mips ;-) 

target-mips would be very good and not difficult to add. It would be 
useful to some people as mips CPUs are used in many embedded devices. 
Moreover you could finish to learn mips assembler :-)

> No really, I would
> appreciate if some people review my code - that means all but mips-dis.c,
> which is pasted together from gdb - and you commit it.

I think I won't commit it before the 0.6.1 release, except maybe for the 
documentation.

> Please note that there is one TODO left: Right now everything works fine
> in single step mode, but as soon as I disable that, a guest Linux hangs
> in the calibration loop. I guess there's something awkward with
> interrupts.
> 
> Also, I did not thoroughly test the 8-bit support in hw/vga.c. My SDL gave
> me 8 bit per default - IRIX's X is capable of having windows side by side
> with different depths... and so SDL choses the worst :-) BTW, the lack of
> support for 8 bit depths probably was the reason that QEmu with a remote X
> display did show a window, but no content.
> 
> In order to deal with those unaligned accesses in hw/vga_template.h, I
> introduced a macro "stl_host", which stores an unaligned uin32_t in host
> byte order. Should this rather be "stlu_host", and defined in cpu-all.h?

Maybe using cpu_to_xxx macros would suffice ? I have not looked at your 
VGA patches yet.

> To be honest, my IRIX machine is not a very fast one, so I did the port
> mainly because I could, and also because I wanted to learn the internals
> of QEmu and MIPS...
> 
> A question: i386-user is supposed to only run linux binaries, right? What
> are the reasons that it is disabled on Windows? Could there be a way to
> make it run on Windows, and also on IRIX?

It would need to code a Linux emulation. I think it is better to spend 
time on improving the system emulation !

Fabrice.

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

* Re: [Qemu-devel] Port to IRIX host
  2004-10-03 14:00   ` Johannes Schindelin
  2004-10-03 14:12     ` Jim C. Brown
  2004-10-03 14:44     ` Fabrice Bellard
@ 2004-10-03 15:23     ` Karl Magdsick
  2004-10-03 16:48     ` Karl Magdsick
  3 siblings, 0 replies; 12+ messages in thread
From: Karl Magdsick @ 2004-10-03 15:23 UTC (permalink / raw)
  To: qemu-devel

> 
> A question: i386-user is supposed to only run linux binaries, right? What
> are the reasons that it is disabled on Windows? Could there be a way to
> make it run on Windows, and also on IRIX?
> 

i386-user passes the Linux system calls strait through to the native
system.  You could probably get away with adding some code to
translate Linux syscalls to IRIX syscalls (with varying degrees of
glue code to emulate correct behavior) for the most common cases and
(initially) having QEMU print an error message and exit when it
reaches an unimplemented system call.  In this way, you could
gradually add support for all of the Linux syscalls.

As far as running x86 Linux binaries on x86 Win32, if you already have
a way to translate Linux syscalls to Win32 syscalls, QEMU provides
little or no advantage.  CoLinux is a project that has ported the
Linux kernel to be a WinNT subsystem so that WinNT can deal with Linux
system calls.   With CoLinux alone, you can run x86 Linux binaries on
WinNT.

Now, if you're running WinNT 3.51 on MIPS or PPC and ported CoLinux to
your system, then i386-user would be useful.  i386-user could also in
theory be used on a MIPS or PPC WinNT system to run i386 WinNT
binaries.

There is a project called DarWine that is porting Wine to Darwin (the
core of Apple's OS X).  This will allow Darwin to handle Win32 system
calls passed through by i386-user.  The specific goal of DarWine is to
allow Darwin x86 to directly run x86 Win32 programs and to allow
Darwin PPC  (including OS X) to run x86 Win32 programs when used with
QEMU i386-user.  You can find DarWine at the OpenDarwin project
(www.OpenDarwin.org).


-Karl

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

* Re: [Qemu-devel] Port to IRIX host
  2004-10-03 14:00   ` Johannes Schindelin
                       ` (2 preceding siblings ...)
  2004-10-03 15:23     ` Karl Magdsick
@ 2004-10-03 16:48     ` Karl Magdsick
  2004-10-04  6:42       ` Johannes Schindelin
  3 siblings, 1 reply; 12+ messages in thread
From: Karl Magdsick @ 2004-10-03 16:48 UTC (permalink / raw)
  To: qemu-devel

> > Just one remark
> > before merging your patch: could you distinguish the IRIX specific parts
> > from the mips specific ones ? I saw you used '#ifdef __mips__' at places
> > where it may be in fact IRIX specific code.
> 
> Yes, you are correct. I just used what was easiest for me, but I will add
> a check in configure, and according to that, a define.

In my closet, I have an SGI Indy (MIPS64) with Debian Linux installed.
 Now I'm really tempted to dust it off and try running some of those
packages that fail to compile for MIPS.

At the time I stopped using the Indy machine, Debian used the 32-bit
MIPS kernels.  I'm not sure if this has changed recently.  Is the MIPS
port for 64-bit or 32-bit MIPS?

In any case, the MIPS port of QEMU looks really cool.  Thanks for all
the hard work!  About how many hours did it take to port QEMU to MIPS?


-Karl

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

* Re: [Qemu-devel] Port to IRIX host
  2004-10-03 14:44     ` Fabrice Bellard
@ 2004-10-04  6:41       ` Johannes Schindelin
  0 siblings, 0 replies; 12+ messages in thread
From: Johannes Schindelin @ 2004-10-04  6:41 UTC (permalink / raw)
  To: qemu-devel

Hi,

On Sun, 3 Oct 2004, Fabrice Bellard wrote:

> Johannes Schindelin wrote:
> >
> > I tried to find another ABI, and as you can find in Makefile.target, I use
> > the -mno-abicalls option to gcc, exactly for that reason. As I stated in
> > the Remarks section of my documentation: after many experiments I just
> > gave up and coded it in assembly. BTW I did not know one thing about MIPS
> > assembler before starting this little project, so my code is very likely
> > not to be optimal.
>
> OK. I am sure there is a better solution for the op parameters, but this
> is not critical since your solution is working.

You're right. I will give it another try.

> > Other ideas? Of course: Next step is a target-mips ;-)
>
> target-mips would be very good and not difficult to add. It would be
> useful to some people as mips CPUs are used in many embedded devices.
> Moreover you could finish to learn mips assembler :-)

;-)

Time permitting, I will start that.

> I think I won't commit it before the 0.6.1 release, except maybe for the
> documentation.

As you changed the version number on Wednesday, 't can't be long. And
there is some work left for the IRIX port.

> > In order to deal with those unaligned accesses in hw/vga_template.h, I
> > introduced a macro "stl_host", which stores an unaligned uin32_t in host
> > byte order. Should this rather be "stlu_host", and defined in cpu-all.h?
>
> Maybe using cpu_to_xxx macros would suffice ? I have not looked at your
> VGA patches yet.

It is just a

#ifdef WORDS_BIGENDIAN
#define stl_host cpu_to_be32wu
#else
#define stl_host cpu_to_le32wu
#endif

> > A question: i386-user is supposed to only run linux binaries, right? What
> > are the reasons that it is disabled on Windows? Could there be a way to
> > make it run on Windows, and also on IRIX?
>
> It would need to code a Linux emulation. I think it is better to spend
> time on improving the system emulation !

Well, I am no crack when it comes to device drivers... And I really like
the idea of running Linux-i386 binaries on IRIX... Furthermore, I strongly
believe that versatile code is clean code.

Ciao,
Dscho

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

* Re: [Qemu-devel] Port to IRIX host
  2004-10-03 16:48     ` Karl Magdsick
@ 2004-10-04  6:42       ` Johannes Schindelin
  2004-10-11 13:55         ` Ian Rogers
  0 siblings, 1 reply; 12+ messages in thread
From: Johannes Schindelin @ 2004-10-04  6:42 UTC (permalink / raw)
  To: Karl Magdsick, qemu-devel

Hi,

On Sun, 3 Oct 2004, Karl Magdsick wrote:

> At the time I stopped using the Indy machine, Debian used the 32-bit
> MIPS kernels.  I'm not sure if this has changed recently.  Is the MIPS
> port for 64-bit or 32-bit MIPS?

It's 32-bit. I am using it on a 64-bit IRIX, though. It just was easier
that way.

> In any case, the MIPS port of QEMU looks really cool.  Thanks for all
> the hard work!  About how many hours did it take to port QEMU to MIPS?

Looking into my archive, I think I started it about Sept 9th, about 50-60
hours. Though I hope that my documentation will reduce that drastically
for similar efforts.

If you undust your Indy, could you try to compile it on Linux? After all,
I am running IRIX on my machines, and my gcc uses SGI's assembler, linker
and all.

Ciao,
Dscho

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

* Re: [Qemu-devel] Port to IRIX host
  2004-10-04  6:42       ` Johannes Schindelin
@ 2004-10-11 13:55         ` Ian Rogers
  2004-10-11 15:02           ` Johannes Schindelin
  2004-10-11 15:56           ` [Qemu-devel] transitive was: " Anand Kumria
  0 siblings, 2 replies; 12+ messages in thread
From: Ian Rogers @ 2004-10-11 13:55 UTC (permalink / raw)
  To: qemu-devel

Hi,

are there any plans for a MIPS target? I've just been reading:

http://www.sgi.com/company_info/newsroom/press_releases/2004/october/linux_vis.html

Thanks,
Ian

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

* Re: [Qemu-devel] Port to IRIX host
  2004-10-11 13:55         ` Ian Rogers
@ 2004-10-11 15:02           ` Johannes Schindelin
  2004-10-11 15:56           ` [Qemu-devel] transitive was: " Anand Kumria
  1 sibling, 0 replies; 12+ messages in thread
From: Johannes Schindelin @ 2004-10-11 15:02 UTC (permalink / raw)
  To: qemu-devel

Hi,

On Mon, 11 Oct 2004, Ian Rogers wrote:

> are there any plans for a MIPS target?

I looked a little bit at that, but MIPS is not just IRIX, as Anders
Gavare, the author, of mips64emul pointed out to me. For starters,
mips64emul seems a better place to look: in the NEWS, Anders says he had
partial success booting IRIX.

Ciao,
Dscho

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

* [Qemu-devel] transitive was: Port to IRIX host
  2004-10-11 13:55         ` Ian Rogers
  2004-10-11 15:02           ` Johannes Schindelin
@ 2004-10-11 15:56           ` Anand Kumria
  1 sibling, 0 replies; 12+ messages in thread
From: Anand Kumria @ 2004-10-11 15:56 UTC (permalink / raw)
  To: qemu-devel

On Mon, 11 Oct 2004 14:55:28 +0100, Ian Rogers wrote:

> Hi,
> 
> are there any plans for a MIPS target? I've just been reading:
> 
> http://www.sgi.com/company_info/newsroom/press_releases/2004/october/linux_vis.html
> 

Interesting. Looks like Transitive may have a difficult time ahead of them
once qemu hits 1.0 - btw, are there any specific things in mind for 1.0?

I've looked at the TODO a lot of the items on the list seem to be rather
specialised -- it isn't immediately obvious, for example, why a cycle
counter would be a useful things to have.

Cheers,
Anand

-- 
linux.conf.au 2005   -  http://lca2005.linux.org.au/  -  Birthplace of Tux
April 18th to 23rd   -  http://lca2005.linux.org.au/  -       LINUX
Canberra, Australia  -  http://lca2005.linux.org.au/  -    Get bitten!

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

end of thread, other threads:[~2004-10-11 15:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-03  7:13 [Qemu-devel] Port to IRIX host Johannes Schindelin
2004-10-03 11:57 ` Fabrice Bellard
2004-10-03 14:00   ` Johannes Schindelin
2004-10-03 14:12     ` Jim C. Brown
2004-10-03 14:44     ` Fabrice Bellard
2004-10-04  6:41       ` Johannes Schindelin
2004-10-03 15:23     ` Karl Magdsick
2004-10-03 16:48     ` Karl Magdsick
2004-10-04  6:42       ` Johannes Schindelin
2004-10-11 13:55         ` Ian Rogers
2004-10-11 15:02           ` Johannes Schindelin
2004-10-11 15:56           ` [Qemu-devel] transitive was: " Anand Kumria

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.