From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G3B5j-0004kC-4N for qemu-devel@nongnu.org; Wed, 19 Jul 2006 08:23:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G3B5i-0004k0-Hm for qemu-devel@nongnu.org; Wed, 19 Jul 2006 08:23:50 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G3B5i-0004jx-7F for qemu-devel@nongnu.org; Wed, 19 Jul 2006 08:23:50 -0400 Received: from [66.249.92.169] (helo=ug-out-1314.google.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1G3B8o-0007xt-Vm for qemu-devel@nongnu.org; Wed, 19 Jul 2006 08:27:03 -0400 Received: by ug-out-1314.google.com with SMTP id s2so268767uge for ; Wed, 19 Jul 2006 05:23:48 -0700 (PDT) Message-ID: <3e1533500607190523qe98bf86g69261a08ec3a1a03@mail.gmail.com> Date: Wed, 19 Jul 2006 13:23:48 +0100 From: "Luis Pureza" Subject: Re: [Qemu-devel] Run program without kernel. Possible? (part 2) In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_140228_9242810.1153311828473" References: <3e1533500607181116l1b16c2c9g54c587ea4002fc29@mail.gmail.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org ------=_Part_140228_9242810.1153311828473 Content-Type: multipart/alternative; boundary="----=_Part_140229_20456720.1153311828473" ------=_Part_140229_20456720.1153311828473 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, I think you got it right. I compiled a small test program on linux/x86 usin= g a cross compiler that generates sparc binaries. Then I tried to emulate it (still on linux/x86) using $ qemu-sparc -d in_asm program and it starts emulating but then fails: Unhandled trap: 0x2 pc: 40002bac npc: 40002bb0 General Registers: %g0: 00000000 %g1: 40002bac %g2: 00000000 %g3: 00000000 %g4: 40002800 %g5: 00000000 %g6: 00000000 %g7: 00000000 Current Register Window: %o0: 00000000 %o1: 00000000 %o2: 00000000 %o3: 00000000 %o4: 00000000 %o5: 00000000 %o6: b7dbb2a0 %o7: 40002b00 %l0: 00000000 %l1: 00000000 %l2: 00000000 %l3: 00000000 %l4: 00000000 %l5: 00000000 %l6: 00000000 %l7: 00000000 %i0: 00000000 %i1: 00000000 %i2: 00000000 %i3: 00000000 %i4: 00000000 %i5: 00000000 %i6: 00000000 %i7: 00000000 Floating Point Registers: psr: 0x04000000 -> ---- --- wim: 0x00000001 fsr: 0x00000000 According to the SPARC manual that is an illegal instruction trap. The log contains: ########################################################## start end size prot 40000000-40004000 00004000 rwx b7d76000-b7df6000 00080000 rw- b7df6000-b7df7000 00001000 --- start_brk 0x40003adc end_code 0x400038c4 start_code 0x40000000 end_data 0x400038c4 start_stack 0xb7df52e0 brk 0x40003adc entry 0x40000000 -------------- IN: 0x40000000: mov %g0, %g4 0x40000004: sethi %hi(0x40002800), %g4 0x40000008: jmp %g4 + 0x2f8 ! 0x40002af8 0x4000000c: nop -------------- IN: 0x40002af8: sethi %hi(0x40002800), %g1 0x40002afc: or %g1, 0x3ac, %g1 ! 0x40002bac 0x40002b00: call %g1 0x40002b04: nop -------------- IN: 0x40002bac: rd %psr, %l3 ########################################################## This last instruction seems to be completely legal, so I don't really know what's happening... The source for the program is in attachment. Thanks for your help. Lu=EDs Pureza P.S.: By the way, every time I tried qemu-i386 using examples from the official documentation, it failed with this error: cannot set up thread-local storage: set_thread_area failed when setting up thread-local storage Seems to be something related to my glibc. My problem? On 7/18/06, Johannes Schindelin wrote: > > Hi, > > Yes. To a certain extent: If you run x86 linux, and you want to execute a > program for PPC linux, you can use the usermode emulation (-user). > > Unfortunately, this is only possible if you run Linux _and_ the program i= s > for Linux (on another CPU). > > If you want to do this for Darwin, you might be lucky with the usermode > emulation of darwine (which is not yet merged with mainstream QEmu, > unfortunately). > > Maybe you want to ask in a more precise fashion what you want to achieve? > > Ciao, > Dscho > > > > _______________________________________________ > Qemu-devel mailing list > Qemu-devel@nongnu.org > http://lists.nongnu.org/mailman/listinfo/qemu-devel > ------=_Part_140229_20456720.1153311828473 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi,

I think you got it right. I compiled a small test program on lin= ux/x86 using a cross compiler that generates sparc binaries.

Then I = tried to emulate it (still on linux/x86) using

$ qemu-sparc -d in_as= m program

and it starts emulating but then fails:

Unhandled trap: 0x2
pc: 40002bac npc: 40002bb0
General Regis= ters:
%g0: 00000000 %g1: 40002bac %g2: 00000000 %g3: 00000000
%g4: 40002800 %g5: 00000000 %g6: 00000000 %g7: 00000000
Current Re= gister Window:
%o0: 00000000 %o1: 00000000 %o2: 00000000 %o3: 0000= 0000
%o4: 00000000 %o5: 00000000 %o6: b7dbb2a0 %o7: 40002b00
%l0: 00000000 %l1: 00000000 %l2: 00000000 %l3: 00000000
%l4: 00000= 000 %l5: 00000000 %l6: 00000000 %l7: 00000000
%i0: 00000000 %i1:= 00000000 %i2: 00000000 %i3: 00000000
%i4: 00000000 %i5: 00000000 = %i6: 00000000 %i7: 00000000

Floating Point Registers:
<All 0>
psr: 0x04000000 ->= ---- --- wim: 0x00000001
fsr: 0x00000000

According to the SPARC = manual that is an illegal instruction trap. The log contains:

######= ####################################################
start end size prot
40000000-40004000 00004000 rwx
b7= d76000-b7df6000 00080000 rw-
b7df6000-b7df7000 00001000 ---
start_brk= 0x40003adc
end_code 0x400038c4
start_code 0x40000000
end_da= ta 0x400038c4
start_stack 0xb7df52e0
brk 0x40003adc
entry 0x40000= 000
--------------
IN:
0x40000000: mov %g0, %g4
0x40000004: = sethi %hi(0x40002800), %g4
0x40000008: jmp %g4 + 0x2f8 ! 0x40002af8
0x4000000c: nop

--------------
IN:
0x40002af8: sethi %h= i(0x40002800), %g1
0x40002afc: or %g1, 0x3ac, %g1 ! 0x40002bac<= br>0x40002b00: call %g1
0x40002b04: nop

--------------
IN:
0x40002bac: rd %psr, %l3
######################################= ####################
This last instruction seems to be completely legal, so I don't really k= now what's happening...
The source for the program is in attachment.
=
Thanks for your help.

Lu=EDs Pureza

P.S.: By the way, eve= ry time I tried qemu-i386 using examples from the official documentation, i= t failed with this error:

cannot set up thread-local storage: set_thread_area failed when set= ting up thread-local storage

Seems to be something related to my gli= bc. My problem?


On 7/18/0= 6,=20 Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Hi,

Yes. To a certain extent: If you run x86 linux, and you want to = execute a
program for PPC linux, you can use the usermode emulation (-us= er).

Unfortunately, this is only possible if you run Linux _and_ the= program is
for Linux (on another CPU).

If you want to do this for Darwin, y= ou might be lucky with the usermode
emulation of darwine (which is not y= et merged with mainstream QEmu,
unfortunately).

Maybe you want to= ask in a more precise fashion what you want to achieve?

Ciao,
Dscho



_____________________________________= __________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel

------=_Part_140229_20456720.1153311828473-- ------=_Part_140228_9242810.1153311828473 Content-Type: text/x-csrc; name=teste3.c; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: base64 X-Attachment-Id: f_eptlx6gy Content-Disposition: attachment; filename="teste3.c" aW50IG1haW4odm9pZCkKewoJaW50IGk7CglpID0gMyArIDQ7CglyZXR1cm4gMDsKfQo= ------=_Part_140228_9242810.1153311828473--