qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Blue Swirl" <blauwirbel@gmail.com>
To: Fabrice Bellard <fabrice@bellard.org>
Cc: Paul Brook <paul@codesourcery.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: [PATCH][RFC] Run time TCGv size check for debugging
Date: Sat, 1 Nov 2008 14:00:50 +0200	[thread overview]
Message-ID: <f43fc5580811010500n48bcef6ay9ddfdaa89884d3f0@mail.gmail.com> (raw)
In-Reply-To: <4909808C.5040602@bellard.org>

[-- Attachment #1: Type: text/plain, Size: 1875 bytes --]

On 10/30/08, Fabrice Bellard <fabrice@bellard.org> wrote:
> Paul Brook wrote:
>  > On Wednesday 29 October 2008, Fabrice Bellard wrote:
>  >> Blue Swirl wrote:
>  >>> Hi,
>  >>>
>  >>> When emulating a mixed 32/64 bit Qemu target CPUs it's easy to confuse
>  >>> the TCGv size, passing 32 bit TCGv to a function expecting a 64 bit
>  >>> one and vice versa. This patch adds a run time sanity check for TCGv
>  >>> sizes.
>  >>>
>  >>> Because a 32 bit Qemu host does not really use 64 bit TCGvs, the patch
>  >>> is only functional on a 64 bit host. Of course also a pure 32 bit Qemu
>  >>> target is not likely to suffer from TCGv size confusion.
>  >>>
>  >>> Some use cases are not covered yet. Comments?
>  >> Theses tests can be done at compile time by introducing the TCGv_i32 and
>  >> TCGv_i64 types. The same can be done with the helpers by using a few
>  >> macros to declare them.
>  >
>  > That would also require updating all the target code in translate.c to use
>  > these types.  In principle there's no reason why this couldn't be done, but
>  > it'd be a much more invasive change.
>
>
> If you define TCGv as the word size of the emulated CPU, it will
>  eliminates most of the changes.

This version introduces TCGv_i32 and TCGv_i64. TCGv_ptr and TCGv (TL
sized) are based on them.

For Sparc, the patch is very invasive (I just commented out the
helpers to avoid that part)  but I think i386 would need much smaller
changes.

With the patch, I found some bugs in Sparc translation. I'm not sure
what to do with helpers, there should be a way to declare the size of
the arguments somehow and then the calling should be easier than:
tcg_gen_helper_1_4_i64_tl_i32_i32_i32(helper_ld_asi, dst, addr, r_asi,
r_size, r_sign);

Otherwise, I think only some variant of the TCGV_LOW parts are worth
committing, they make the code slightly more easy to understand.

[-- Attachment #2: compile_time_tcgv_size_check.diff.bz2 --]
[-- Type: application/x-bzip2, Size: 14840 bytes --]

[-- Attachment #3: sparc_tcgv_size_fixes.diff --]
[-- Type: plain/text, Size: 6657 bytes --]

  reply	other threads:[~2008-11-01 12:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-29 19:31 [Qemu-devel] [PATCH][RFC] Run time TCGv size check for debugging Blue Swirl
2008-10-29 19:53 ` Paul Brook
2008-10-29 20:06   ` Blue Swirl
2008-10-29 20:14     ` Paul Brook
2008-10-29 20:25       ` Blue Swirl
2008-10-29 21:37 ` [Qemu-devel] " Fabrice Bellard
2008-10-30  0:07   ` Paul Brook
2008-10-30  9:38     ` Fabrice Bellard
2008-11-01 12:00       ` Blue Swirl [this message]
2008-11-01 12:59         ` Paul Brook
2008-11-01 16:56           ` Paul Brook
2008-11-01 17:03             ` Blue Swirl

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=f43fc5580811010500n48bcef6ay9ddfdaa89884d3f0@mail.gmail.com \
    --to=blauwirbel@gmail.com \
    --cc=fabrice@bellard.org \
    --cc=paul@codesourcery.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).