qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Luis Pureza" <pureza@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Run program without kernel. Possible? (part 2)
Date: Wed, 19 Jul 2006 13:23:48 +0100	[thread overview]
Message-ID: <3e1533500607190523qe98bf86g69261a08ec3a1a03@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.63.0607182024420.29667@wbgn013.biozentrum.uni-wuerzburg.de>


[-- Attachment #1.1: Type: text/plain, Size: 3098 bytes --]

Hi,

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 <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 (-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
>

[-- Attachment #1.2: Type: text/html, Size: 3697 bytes --]

[-- Attachment #2: teste3.c --]
[-- Type: text/x-csrc, Size: 50 bytes --]

int main(void)
{
	int i;
	i = 3 + 4;
	return 0;
}

  reply	other threads:[~2006-07-19 12:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-18 18:16 [Qemu-devel] Run program without kernel. Possible? (part 2) Luis Pureza
2006-07-18 18:27 ` Johannes Schindelin
2006-07-19 12:23   ` Luis Pureza [this message]
2006-07-19 13:20     ` Blue Swirl
2006-07-18 19:52 ` Marco Matthies

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3e1533500607190523qe98bf86g69261a08ec3a1a03@mail.gmail.com \
    --to=pureza@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).