From: malc <av1474@comtv.ru>
To: Ulrich Hecht <uli@suse.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] TCG S/390 backend
Date: Tue, 12 May 2009 16:29:52 +0400 (MSD) [thread overview]
Message-ID: <Pine.LNX.4.64.0905121602040.2137@linmac.oyster.ru> (raw)
In-Reply-To: <200905121338.45589.uli@suse.de>
On Tue, 12 May 2009, Ulrich Hecht wrote:
> On Tuesday 05 May 2009, malc wrote:
> > On Tue, 5 May 2009, Ulrich Hecht wrote:
> > > Now i386, AMD64, ARM, SH4, and m68k system emulators work. MIPS
> > > works at least as well as on an AMD64 host, i.e. the test image from
> > > qemu.org just
> >
> > Should work with '-M mips'.
>
> It complains about a missing "mips_bios.bin" then, which isn't in
> pc-bios.
Harmless. To verify I just built fresh QEMU checkout and run things like
this:
/path/to/freshly/built/qemu/mips-softmmu/qemu-system-mips \
-kernel vmlinux-2.6.18-3-qemu \
-initrd initrd.gz \
-append console=ttyS0 \
-monitor stdio \
-m 128 \
-M mips
Got:
qemu: Warning, could not load MIPS bios '/usr/local/share/qemu/mips_bios.bin'
Then pressing ctrl-alt-2 brought me straight to ttyS0 where Linux was
printing it's boot messages.
>
> > > sits there without doing anything. The SPARC test image fails with a
> > > memory access exception in the target system, but works on an AMD64
> > > host, so there probably still is a bug somewhere in the backend.
> >
> > Tried to compare `-d in_asm' outputs of S390/AMD64 when using
> > deterministic execution (`-icount N')?
>
> I found the problem: TCG does not zero- or sign-extend arguments to
> function calls. Unlike, for instance, AMD64, 32-bit arithmetic ops on
> S/390 leave the upper 32 bits of the destination register untouched, so
> there could be any kind of garbage there. If a helper taking a 64-bit
> argument is called with the result of such an operation, stuff breaks.
> IMO, TCG should do the extension in tcg_reg_alloc_call(), but that seems
> to be impossible because it has no information on the types of the input
> arguments the callee expects. Working around this in the backend is
> hardly possible as it does not have the information either.
If the target performs 32bit arithmetics on 64bit arguments then all bets
are off - the target that does that is broken. FWIW on PPC64 logical and
simple arithmetic ops do not have 32-bit forms so that higher order bits
(lower order according to IBM for which many people are eternally grateful)
contain "garbage". Shifts/muls/divs have separate 32/64bit forms though
and, at least, for shifts those lower/higher order bits will be masked.
>
> I have the suspicion that even on other 64-bit hosts, this only works by
> accident (if it does at all): Even if the 32-bit arithmetic op does sign
> extension, what if the function argument is a pointer? Depending on the
> address, the function may get a value with a lot of F's in front...
If 32-bit arithmetic op is performed on a 64-bit pointer target
translation is broken.
>
> Any ideas?
As an experiment you can try to manually zero/sign extend results of all
_i32 ops, but methinks the real problem should be identified.
--
mailto:av1474@comtv.ru
prev parent reply other threads:[~2009-05-12 12:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-05 12:24 [Qemu-devel] [PATCH] TCG S/390 backend Ulrich Hecht
2009-05-05 18:28 ` malc
2009-05-12 11:38 ` Ulrich Hecht
2009-05-12 12:29 ` Paul Brook
2009-05-12 12:29 ` malc [this message]
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=Pine.LNX.4.64.0905121602040.2137@linmac.oyster.ru \
--to=av1474@comtv.ru \
--cc=qemu-devel@nongnu.org \
--cc=uli@suse.de \
/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).