qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Chris Metcalf <cmetcalf@ezchip.com>
Cc: "walt@tilera.com" <walt@tilera.com>,
	Riku Voipio <riku.voipio@iki.fi>,
	Chen Gang S <gang.chen@sunrus.com.cn>,
	Richard Henderson <rth@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] target-tilegx: Execute _start and reach to __libc_start_main successfully
Date: Tue, 24 Feb 2015 23:38:01 +0900	[thread overview]
Message-ID: <CAFEAcA8M08bgzK8tZDh7455KMevvTtNFV1vS04fNs6UBcdK19g@mail.gmail.com> (raw)
In-Reply-To: <54EC88D6.3060402@ezchip.com>

On 24 February 2015 at 23:21, Chris Metcalf <cmetcalf@ezchip.com> wrote:
> On 2/24/2015 2:53 AM, Chen Gang S wrote:
>>
>>   typedef struct CPUTLState {
>> +    uint64_t regs[TILEGX_R_COUNT]; /* Common used registers by outside */
>> +    uint64_t zero;                 /* Zero register */
>> +    uint64_t pc;                   /* Current pc */
>>       CPU_COMMON
>>   } CPUTLState;
>
>
> I skimmed through this and my only comment is that I was surprised to see
> "zero" as part of the state, since it's always 0.  :-)  No doubt there is
> some reason that this makes sense.

I think that is definitely an error...

>> +#define TILEGX_GEN_CHK_BEGIN(x) \
>> +    if ((x) == TILEGX_R_ZERO) {
>> +#define TILEGX_GEN_CHK_END(x) \
>> +        return 0; \
>> +    } \
>> +    if ((x) >= TILEGX_R_COUNT) { \
>> +        return -1; \
>> +    }
>
>
> This macro pattern seems potentially a little confusing and I do wonder if
> there is some way to avoid having to explicitly check the zero register
> every time; for example, maybe you make it a legitimate part of the state
> and declare that there are 64 registers, and then just always finish any
> register-update phase by re-zeroing that register?  It might yield a smaller
> code footprint and probably be just as fast, as long as it was easy to know
> where registers were updated.

See target-arm/translate-a64.c for one way to handle an
always-reads-as-zero register.

-- PMM

  reply	other threads:[~2015-02-24 14:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24  7:53 [Qemu-devel] [PATCH] target-tilegx: Execute _start and reach to __libc_start_main successfully Chen Gang S
2015-02-24  8:07 ` Chen Gang S
2015-02-24 14:21 ` Chris Metcalf
2015-02-24 14:38   ` Peter Maydell [this message]
2015-02-24 15:39     ` Chen Gang S
2015-02-24 16:42       ` Richard Henderson
2015-02-24 17:08         ` Chen Gang S
2015-02-24 16:31   ` Chen Gang S
2015-02-24 16:46     ` Chris Metcalf
2015-02-24 17:25       ` Chen Gang S
2015-02-24 18:18         ` Chris Metcalf
2015-02-25  1:01           ` Chen Gang S
2015-02-24 17:55 ` Richard Henderson
2015-02-25  3:40   ` Chen Gang S
2015-02-25 17:19     ` Richard Henderson
2015-02-26  1:44       ` Chen Gang S
2015-02-26 16:31         ` Richard Henderson
2015-02-26 23:30           ` Chen Gang S
2015-02-27  3:01         ` Chris Metcalf
2015-02-27  3:41           ` Chen Gang S

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=CAFEAcA8M08bgzK8tZDh7455KMevvTtNFV1vS04fNs6UBcdK19g@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=cmetcalf@ezchip.com \
    --cc=gang.chen@sunrus.com.cn \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    --cc=rth@redhat.com \
    --cc=walt@tilera.com \
    /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).