I think you got it right. I compiled a small test program on linux/x86 using 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:
<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
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ís 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 <[EMAIL PROTECTED]> 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 is
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
int main(void) { int i; i = 3 + 4; return 0; }
_______________________________________________ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel