qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Problem with PPC user emulation.
@ 2004-05-14 17:59 Karel Gardas
  2004-05-14 19:25 ` Jocelyn Mayer
  0 siblings, 1 reply; 8+ messages in thread
From: Karel Gardas @ 2004-05-14 17:59 UTC (permalink / raw)
  To: QEMU Development Mailing List


Hello,

I've tried PPC user emulation provided by this week source tree, but w/o
success. I've tested crosstool's 4 test binaries (hello world in c/c++
static and dynamic) but all four crash with:

thinkpad:/mnt/karel/cross-gcc/result/powerpc-405-linux-gnu/gcc-3.4.0-glibc-2.3.2/tmp$ ppc.sh ./powerpc-405-linux-gnu-hello
*** ERROR: idx a0 already assigned to a direct opcode
*** ERROR: unable to join indirect table idx [a0-37]
*** ERROR initializing PPC instruction 0xa0 0x37 0xfe
/opt/qemu-scripts/bin/ppc.sh: line 3:  3496 Segmentation fault      qemu-ppc -L /mnt/karel/cross-gcc/result/powerpc-405-linux-gnu/gcc-3.4.0-glibc-2.3.2/powerpc-405-linux-gnu/ $@
thinkpad:/mnt/karel/cross-gcc/result/powerpc-405-linux-gnu/gcc-3.4.0-glibc-2.3.2/tmp$

I used crosstool-0.28-pre13 for building ppc crosscompiler which is
gcc3.4.0 and glibc2.3.2 combination.

If you would like to see at least statically linked hello world binaries,
then they are:

http://mico.org/~karel/powerpc-405-linux-gnu-hello-static.bz2
http://mico.org/~karel/powerpc-405-linux-gnu-hello2-static.bz2

Cheers,

Karel
--
Karel Gardas                  kgardas@objectsecurity.com
ObjectSecurity Ltd.           http://www.objectsecurity.com

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

* Re: [Qemu-devel] Problem with PPC user emulation.
  2004-05-14 17:59 [Qemu-devel] Problem with PPC user emulation Karel Gardas
@ 2004-05-14 19:25 ` Jocelyn Mayer
  2004-05-14 19:26   ` Karel Gardas
  0 siblings, 1 reply; 8+ messages in thread
From: Jocelyn Mayer @ 2004-05-14 19:25 UTC (permalink / raw)
  To: qemu mailing list

On Fri, 2004-05-14 at 19:59, Karel Gardas wrote:
> Hello,
> 
> I've tried PPC user emulation provided by this week source tree, but w/o
> success. I've tested crosstool's 4 test binaries (hello world in c/c++
> static and dynamic) but all four crash with:
> 
> thinkpad:/mnt/karel/cross-gcc/result/powerpc-405-linux-gnu/gcc-3.4.0-glibc-2.3.2/tmp$ ppc.sh ./powerpc-405-linux-gnu-hello
> *** ERROR: idx a0 already assigned to a direct opcode
> *** ERROR: unable to join indirect table idx [a0-37]
> *** ERROR initializing PPC instruction 0xa0 0x37 0xfe
> /opt/qemu-scripts/bin/ppc.sh: line 3:  3496 Segmentation fault      qemu-ppc -L /mnt/karel/cross-gcc/result/powerpc-405-linux-gnu/gcc-3.4.0-glibc-2.3.2/powerpc-405-linux-gnu/ $@
> thinkpad:/mnt/karel/cross-gcc/result/powerpc-405-linux-gnu/gcc-3.4.0-glibc-2.3.2/tmp$
> 
> I used crosstool-0.28-pre13 for building ppc crosscompiler which is
> gcc3.4.0 and glibc2.3.2 combination.
> 

What is your host machine ?
It seems there is a mess in the way sections are handled by this gcc 
version and/or for your host machine.
This seems clear to me, because there can be no instruction with this
opcode, as major opcode is 6 bits long in PPC and so can't be 0xa0.

Could you please send me the qemu binary by mail, so I could check the
executable structure (the opcode table structure, in fact...) ?

But you may not be able to execute PPC405 dedicated binaries,
as this CPU implements some instructions that aren't in the PPC spec
then not emulated by Qemu. Those instructions seem not to be used in the
program you tried, but you should check that you always compile with -mcpu=powerpc flag
(not -mcpu=405) to get only generic PPC code, in order to execute inside Qemu.

-- 
Jocelyn Mayer <l_indien@magic.fr>
Never organized

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

* Re: [Qemu-devel] Problem with PPC user emulation.
  2004-05-14 19:25 ` Jocelyn Mayer
@ 2004-05-14 19:26   ` Karel Gardas
  2004-05-14 19:42     ` Jocelyn Mayer
  0 siblings, 1 reply; 8+ messages in thread
From: Karel Gardas @ 2004-05-14 19:26 UTC (permalink / raw)
  To: Jocelyn Mayer; +Cc: qemu mailing list

On Fri, 14 May 2004, Jocelyn Mayer wrote:

> On Fri, 2004-05-14 at 19:59, Karel Gardas wrote:
> > Hello,
> >
> > I've tried PPC user emulation provided by this week source tree, but w/o
> > success. I've tested crosstool's 4 test binaries (hello world in c/c++
> > static and dynamic) but all four crash with:
> >
> > thinkpad:/mnt/karel/cross-gcc/result/powerpc-405-linux-gnu/gcc-3.4.0-glibc-2.3.2/tmp$ ppc.sh ./powerpc-405-linux-gnu-hello
> > *** ERROR: idx a0 already assigned to a direct opcode
> > *** ERROR: unable to join indirect table idx [a0-37]
> > *** ERROR initializing PPC instruction 0xa0 0x37 0xfe
> > /opt/qemu-scripts/bin/ppc.sh: line 3:  3496 Segmentation fault      qemu-ppc -L /mnt/karel/cross-gcc/result/powerpc-405-linux-gnu/gcc-3.4.0-glibc-2.3.2/powerpc-405-linux-gnu/ $@
> > thinkpad:/mnt/karel/cross-gcc/result/powerpc-405-linux-gnu/gcc-3.4.0-glibc-2.3.2/tmp$
> >
> > I used crosstool-0.28-pre13 for building ppc crosscompiler which is
> > gcc3.4.0 and glibc2.3.2 combination.
> >
>
> What is your host machine ?

Debian GNU/Linux 3.0.

> It seems there is a mess in the way sections are handled by this gcc
> version and/or for your host machine.
> This seems clear to me, because there can be no instruction with this
> opcode, as major opcode is 6 bits long in PPC and so can't be 0xa0.
>
> Could you please send me the qemu binary by mail, so I could check the
> executable structure (the opcode table structure, in fact...) ?

Sure! I will send you the smaller one (C statically linked hello world
app)

> But you may not be able to execute PPC405 dedicated binaries,
> as this CPU implements some instructions that aren't in the PPC spec
> then not emulated by Qemu.

Aha! This might be the issue.

> Those instructions seem not to be used in the
> program you tried, but you should check that you always compile with -mcpu=powerpc flag
> (not -mcpu=405) to get only generic PPC code, in order to execute inside Qemu.

Hmm, I'm afraid whole gcc/glibc is compiled probably with -mcpu=405...

Anyway, thanks for the hint.

Karel
--
Karel Gardas                  kgardas@objectsecurity.com
ObjectSecurity Ltd.           http://www.objectsecurity.com

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

* Re: [Qemu-devel] Problem with PPC user emulation.
  2004-05-14 19:26   ` Karel Gardas
@ 2004-05-14 19:42     ` Jocelyn Mayer
  2004-05-14 19:44       ` Karel Gardas
  0 siblings, 1 reply; 8+ messages in thread
From: Jocelyn Mayer @ 2004-05-14 19:42 UTC (permalink / raw)
  To: Karel Gardas; +Cc: qemu-devel

On Fri, 2004-05-14 at 21:26, Karel Gardas wrote:
> On Fri, 14 May 2004, Jocelyn Mayer wrote:
> 
> > On Fri, 2004-05-14 at 19:59, Karel Gardas wrote:
> > > Hello,
> > >
> > > I've tried PPC user emulation provided by this week source tree, but w/o
> > > success. I've tested crosstool's 4 test binaries (hello world in c/c++
> > > static and dynamic) but all four crash with:
> > >
> > > thinkpad:/mnt/karel/cross-gcc/result/powerpc-405-linux-gnu/gcc-3.4.0-glibc-2.3.2/tmp$ ppc.sh ./powerpc-405-linux-gnu-hello
> > > *** ERROR: idx a0 already assigned to a direct opcode
> > > *** ERROR: unable to join indirect table idx [a0-37]
> > > *** ERROR initializing PPC instruction 0xa0 0x37 0xfe
> > > /opt/qemu-scripts/bin/ppc.sh: line 3:  3496 Segmentation fault      qemu-ppc -L /mnt/karel/cross-gcc/result/powerpc-405-linux-gnu/gcc-3.4.0-glibc-2.3.2/powerpc-405-linux-gnu/ $@
> > > thinkpad:/mnt/karel/cross-gcc/result/powerpc-405-linux-gnu/gcc-3.4.0-glibc-2.3.2/tmp$
> > >
> > > I used crosstool-0.28-pre13 for building ppc crosscompiler which is
> > > gcc3.4.0 and glibc2.3.2 combination.
> > >
> >
> > What is your host machine ?
> 
> Debian GNU/Linux 3.0.

On a PC ?

> 
> > It seems there is a mess in the way sections are handled by this gcc
> > version and/or for your host machine.
> > This seems clear to me, because there can be no instruction with this
> > opcode, as major opcode is 6 bits long in PPC and so can't be 0xa0.
> >
> > Could you please send me the qemu binary by mail, so I could check the
> > executable structure (the opcode table structure, in fact...) ?
> 
> Sure! I will send you the smaller one (C statically linked hello world
> app)

Well, I need the Qemu executable, not the emulated program, because the
point you report is a bug inside qemu: it stops before trying to execute
any emulated code, and I want to study the way it's been compiled by
gcc...

> > But you may not be able to execute PPC405 dedicated binaries,
> > as this CPU implements some instructions that aren't in the PPC spec
> > then not emulated by Qemu.
> 
> Aha! This might be the issue.

This is not the issue for your crash, but you may have other problems
later, using PPC405 binaries. I will had the 405 dedicated instructions
later, when the PPC core will more stable (I still have ennoying bugs to
solve).

-- 
Jocelyn Mayer <l_indien@magic.fr>
Never organized

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

* Re: [Qemu-devel] Problem with PPC user emulation.
  2004-05-14 19:42     ` Jocelyn Mayer
@ 2004-05-14 19:44       ` Karel Gardas
  2004-05-14 20:33         ` Herbert Poetzl
  0 siblings, 1 reply; 8+ messages in thread
From: Karel Gardas @ 2004-05-14 19:44 UTC (permalink / raw)
  To: Jocelyn Mayer; +Cc: qemu-devel

On Fri, 14 May 2004, Jocelyn Mayer wrote:

> On Fri, 2004-05-14 at 21:26, Karel Gardas wrote:
> > On Fri, 14 May 2004, Jocelyn Mayer wrote:
> >
> > > On Fri, 2004-05-14 at 19:59, Karel Gardas wrote:
> > > > Hello,
> > > >
> > > > I've tried PPC user emulation provided by this week source tree, but w/o
> > > > success. I've tested crosstool's 4 test binaries (hello world in c/c++
> > > > static and dynamic) but all four crash with:
> > > >
> > > > thinkpad:/mnt/karel/cross-gcc/result/powerpc-405-linux-gnu/gcc-3.4.0-glibc-2.3.2/tmp$ ppc.sh ./powerpc-405-linux-gnu-hello
> > > > *** ERROR: idx a0 already assigned to a direct opcode
> > > > *** ERROR: unable to join indirect table idx [a0-37]
> > > > *** ERROR initializing PPC instruction 0xa0 0x37 0xfe
> > > > /opt/qemu-scripts/bin/ppc.sh: line 3:  3496 Segmentation fault      qemu-ppc -L /mnt/karel/cross-gcc/result/powerpc-405-linux-gnu/gcc-3.4.0-glibc-2.3.2/powerpc-405-linux-gnu/ $@
> > > > thinkpad:/mnt/karel/cross-gcc/result/powerpc-405-linux-gnu/gcc-3.4.0-glibc-2.3.2/tmp$
> > > >
> > > > I used crosstool-0.28-pre13 for building ppc crosscompiler which is
> > > > gcc3.4.0 and glibc2.3.2 combination.
> > > >
> > >
> > > What is your host machine ?
> >
> > Debian GNU/Linux 3.0.
>
> On a PC ?

Err, sorry, yes, x86.

> > Sure! I will send you the smaller one (C statically linked hello world
> > app)
>
> Well, I need the Qemu executable, not the emulated program, because the
> point you report is a bug inside qemu: it stops before trying to execute
> any emulated code, and I want to study the way it's been compiled by
> gcc...

Ah, yes, sorry, I have not understood this. I will send it to you
immediately. FYI: Qemu was compiled by gcc3.4.0 + fsf binutils 2.14

Thanks,

Karel
--
Karel Gardas                  kgardas@objectsecurity.com
ObjectSecurity Ltd.           http://www.objectsecurity.com

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

* Re: [Qemu-devel] Problem with PPC user emulation.
  2004-05-14 19:44       ` Karel Gardas
@ 2004-05-14 20:33         ` Herbert Poetzl
  2004-05-14 20:42           ` Karel Gardas
  0 siblings, 1 reply; 8+ messages in thread
From: Herbert Poetzl @ 2004-05-14 20:33 UTC (permalink / raw)
  To: Karel Gardas; +Cc: qemu-devel

On Fri, May 14, 2004 at 09:44:19PM +0200, Karel Gardas wrote:
> On Fri, 14 May 2004, Jocelyn Mayer wrote:
> 
> > On Fri, 2004-05-14 at 21:26, Karel Gardas wrote:
> > > On Fri, 14 May 2004, Jocelyn Mayer wrote:
> > >
> > > > On Fri, 2004-05-14 at 19:59, Karel Gardas wrote:
> > > > > Hello,
> > > > >
> > > > > I've tried PPC user emulation provided by this week source tree, but w/o
> > > > > success. I've tested crosstool's 4 test binaries (hello world in c/c++
> > > > > static and dynamic) but all four crash with:
> > > > >
> > > > > thinkpad:/mnt/karel/cross-gcc/result/powerpc-405-linux-gnu/gcc-3.4.0-glibc-2.3.2/tmp$ ppc.sh ./powerpc-405-linux-gnu-hello
> > > > > *** ERROR: idx a0 already assigned to a direct opcode
> > > > > *** ERROR: unable to join indirect table idx [a0-37]
> > > > > *** ERROR initializing PPC instruction 0xa0 0x37 0xfe
> > > > > /opt/qemu-scripts/bin/ppc.sh: line 3:  3496 Segmentation fault      qemu-ppc -L /mnt/karel/cross-gcc/result/powerpc-405-linux-gnu/gcc-3.4.0-glibc-2.3.2/powerpc-405-linux-gnu/ $@
> > > > > thinkpad:/mnt/karel/cross-gcc/result/powerpc-405-linux-gnu/gcc-3.4.0-glibc-2.3.2/tmp$
> > > > >
> > > > > I used crosstool-0.28-pre13 for building ppc crosscompiler which is
> > > > > gcc3.4.0 and glibc2.3.2 combination.
> > > > >
> > > >
> > > > What is your host machine ?
> > >
> > > Debian GNU/Linux 3.0.
> >
> > On a PC ?
> 
> Err, sorry, yes, x86.
> 
> > > Sure! I will send you the smaller one (C statically linked hello world
> > > app)
> >
> > Well, I need the Qemu executable, not the emulated program, because the
> > point you report is a bug inside qemu: it stops before trying to execute
> > any emulated code, and I want to study the way it's been compiled by
> > gcc...
> 
> Ah, yes, sorry, I have not understood this. I will send it to you
> immediately. FYI: Qemu was compiled by gcc3.4.0 + fsf binutils 2.14

hmm, IIRC I had some issues with binutils 2.14 and gcc 3.4 ..
I upgraded to binutils 2.15.90.0.3 which fixed that ...

(might be completely unrelated, so do not rely on that)

best,
Herbert

> Thanks,
> 
> Karel
> --
> Karel Gardas                  kgardas@objectsecurity.com
> ObjectSecurity Ltd.           http://www.objectsecurity.com
> 
> 
> 
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://mail.nongnu.org/mailman/listinfo/qemu-devel

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

* Re: [Qemu-devel] Problem with PPC user emulation.
  2004-05-14 20:33         ` Herbert Poetzl
@ 2004-05-14 20:42           ` Karel Gardas
  2004-05-14 21:44             ` J. Mayer
  0 siblings, 1 reply; 8+ messages in thread
From: Karel Gardas @ 2004-05-14 20:42 UTC (permalink / raw)
  To: Herbert Poetzl; +Cc: qemu-devel

On Fri, 14 May 2004, Herbert Poetzl wrote:

> > Ah, yes, sorry, I have not understood this. I will send it to you
> > immediately. FYI: Qemu was compiled by gcc3.4.0 + fsf binutils 2.14
>
> hmm, IIRC I had some issues with binutils 2.14 and gcc 3.4 ..
> I upgraded to binutils 2.15.90.0.3 which fixed that ...
>
> (might be completely unrelated, so do not rely on that)

Hmm, sounds interesting. I've just checked and gcc website still note only
(for x86-linux platform):

i?86-*-linux*

As of GCC 3.3, binutils 2.13.1 or later is required for this platform. See
bug 10877 for more information.


So at least, this should be not so known bug...

Karel
--
Karel Gardas                  kgardas@objectsecurity.com
ObjectSecurity Ltd.           http://www.objectsecurity.com

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

* Re: [Qemu-devel] Problem with PPC user emulation.
  2004-05-14 20:42           ` Karel Gardas
@ 2004-05-14 21:44             ` J. Mayer
  0 siblings, 0 replies; 8+ messages in thread
From: J. Mayer @ 2004-05-14 21:44 UTC (permalink / raw)
  To: Karel Gardas; +Cc: qemu-devel

On Fri, 2004-05-14 at 22:42, Karel Gardas wrote:
> On Fri, 14 May 2004, Herbert Poetzl wrote:
> 
> > > Ah, yes, sorry, I have not understood this. I will send it to you
> > > immediately. FYI: Qemu was compiled by gcc3.4.0 + fsf binutils 2.14
> >
> > hmm, IIRC I had some issues with binutils 2.14 and gcc 3.4 ..
> > I upgraded to binutils 2.15.90.0.3 which fixed that ...
> >
> > (might be completely unrelated, so do not rely on that)
> 
> Hmm, sounds interesting. I've just checked and gcc website still note only
> (for x86-linux platform):
> 
> i?86-*-linux*
> 
> As of GCC 3.3, binutils 2.13.1 or later is required for this platform. See
> bug 10877 for more information.
> 
> 
> So at least, this should be not so known bug...

I just check your qemu program, using
GNU binutils version 2.14.90.0.8 20040114
in a 32 bits x86 environment and
GNU binutils version 2.15.90.0.1.1 20040303
in a amd64 environment on Gentoo.
The two versions show me the same problems:
- ELF flags say the executable has symbols, but objdump isn't able to
find them.
- the .opcodes section (which should contain the PPC opcodes tables)
pretend 8 bytes aligned but is, in fact, 16 bytes aligned.
- this section is quite empty: only 20 bytes, when it's 4992 bytes long
in my version.
- I failed to find the opcode tables in any section.

it seems that the binary has been partialy stripped, which is really
strange.

I didn't find a description of this bug (I suspect ld more than gcc,
but...).
You may try to use another binutils and/or gcc version, as suggested....

-- 
J. Mayer <l_indien@magic.fr>
Never organized

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

end of thread, other threads:[~2004-05-14 22:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-14 17:59 [Qemu-devel] Problem with PPC user emulation Karel Gardas
2004-05-14 19:25 ` Jocelyn Mayer
2004-05-14 19:26   ` Karel Gardas
2004-05-14 19:42     ` Jocelyn Mayer
2004-05-14 19:44       ` Karel Gardas
2004-05-14 20:33         ` Herbert Poetzl
2004-05-14 20:42           ` Karel Gardas
2004-05-14 21:44             ` J. Mayer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).