qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jia Liu <proljc@gmail.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v8 08/16] target-or32: Add instruction translation
Date: Fri, 6 Jul 2012 08:23:56 +0800	[thread overview]
Message-ID: <CAJBMM-toxB5YYhw-0C_2kTBvEgG9kCtYofKOaKMyCaOPswCM-Q@mail.gmail.com> (raw)
In-Reply-To: <CAAu8pHttLVTvdktnjH8OjubVtBSAFn7vJDjLGPHAifhr6C2jkQ@mail.gmail.com>

Hi Blue,

On Fri, Jul 6, 2012 at 2:45 AM, Blue Swirl <blauwirbel@gmail.com> wrote:
> On Wed, Jul 4, 2012 at 11:59 PM, Jia Liu <proljc@gmail.com> wrote:
>> On Wed, Jul 4, 2012 at 10:23 AM, Jia Liu <proljc@gmail.com> wrote:
>>> Hi Blue,
>>>
>>> On Wed, Jul 4, 2012 at 2:48 AM, Blue Swirl <blauwirbel@gmail.com> wrote:
>>>> On Sun, Jul 1, 2012 at 2:45 AM, Jia Liu <proljc@gmail.com> wrote:
>>>>> +    switch (op0) {
>>>>> +    case 0x00:    /* l.j */
>>>>> +        LOG_DIS("l.j %d\n", N26);
>>>>> +    case 0x01:    /* l.jal */
>>>>> +        LOG_DIS("l.jal %d\n", N26);
>>>>> +    case 0x03:    /* l.bnf */
>>>>> +        LOG_DIS("l.bnf %d\n", N26);
>>>>> +    case 0x04:    /* l.bf */
>>>>> +        LOG_DIS("l.bf %d\n", N26);
>>>>> +
>>>>> +        gen_jump(dc, N26, 0, op0);
>>>>
>>>> The cases 0x00 to 0x03 will fall through to this case, calling LOG_DIS
>>>> one to four times.
>>>
>>> Sorry, I can't find a better path. Is this code OK?
>>>
>>>     switch (op0) {
>>>     case 0x00:    /* l.j */
>>>     case 0x01:    /* l.jal */
>>>     case 0x03:    /* l.bnf */
>>>     case 0x04:    /* l.bf */
>>>         LOG_DIS("l.j/l.jal/l.bnf/l.bf %d\n", N26);
>>>
>>>         gen_jump(dc, N26, 0, op0);
>>>
>>
>> or is this code OK?
>>
>>     switch (op0) {
>>     case 0x00:    /* l.j */
>>         LOG_DIS("l.j %d\n", N26);
>>         gen_jump(dc, N26, 0, op0);
>>         break;
>>     case 0x01:    /* l.jal */
>>         LOG_DIS("l.jal %d\n", N26);
>>         gen_jump(dc, N26, 0, op0);
>>         break;
>>     case 0x03:    /* l.bnf */
>>         LOG_DIS("l.bnf %d\n", N26);
>>         gen_jump(dc, N26, 0, op0);
>>         break;
>>     case 0x04:    /* l.bf */
>>         LOG_DIS("l.bf %d\n", N26);
>>         gen_jump(dc, N26, 0, op0);
>>         break;
>
> Yes, with N26 defined only when LOG_DIS does something (see below).
>
>>
>>
>>>>> +
>>>>> +    case 0x11:    /* l.jr */
>>>>> +        LOG_DIS("l.jr r%d\n", rb);
>>>>> +    case 0x12:    /* l.jalr */
>>>>> +        LOG_DIS("l.jalr r%d\n", rb);
>>>>> +
>>>>> +        gen_jump(dc, 0, rb, op0);
>>>>
>>>> Also here.
>>>>
>>>
>>> And, this?
>>>
>>      case 0x11:    /* l.jr */
>
> Now there's no LOG_DIS() line.

Oh! I was too careless! It shouldn't a LOG_DIS() here!
Thank you very much!

>
>>          gen_jump(dc, 0, rb, op0);
>>          break;
>>      case 0x12:    /* l.jalr */
>>          LOG_DIS("l.jr r%d\n", rb);
>>          gen_jump(dc, 0, rb, op0);
>>          break;
>>
>>>>> +static void dec_sys(DisasContext *dc, uint32_t insn)
>>>>> +{
>>>>> +    uint32_t op0;
>>>>> +    /*uint32_t K16;*/
>>>>> +    op0 = field(insn, 16, 8);
>>>>> +    /*K16 = field(insn, 0, 16);*/
>>>>> +
>>>>> +    switch (op0) {
>>>>> +    case 0x000:    /* l.sys */
>>>>> +        /*LOG_DIS("l.sys %d\n", K16);*/
>>>>
>>>> Why commented out?
>>>
>>> When I build QEMU, I got a error msg like "unused var K16, treat
>>> warnings as errors".
>>> I didn't find a better way to handle it, so, commented it.
>
> This can be avoided by adjusting those variable definitions which are
> only used by LOG_DIS() so that they are only defined when LOG_DIS
> needs them:
> #ifdef OPENRISC_DISAS
>   int K16, N26;
> #endif
>

Thank you very much! This is a very nice way.


>>>
>>>>
>>>>> +        tcg_gen_movi_tl(cpu_pc, dc->pc);
>>>>> +        gen_exception(dc, EXCP_SYSCALL);
>>>>> +        dc->is_jmp = DISAS_UPDATE;
>>>>> +        break;
>>>>> +
>>>>> +    case 0x100:    /* l.trap */
>>>>> +        /*LOG_DIS("l.trap %d\n", K16);*/
>>>>
>>>> Ditto
>>>>
>>>
>>> And, commented it here.
>>>
>>>>> +        tcg_gen_movi_tl(cpu_pc, dc->pc);
>>>>> +        gen_exception(dc, EXCP_TRAP);
>>>>> +        break;
>>>>> +
>>>
>>> Regards,
>>> Jia.
>>
>>
>> Regards,
>> Jia.


Regards,
Jia.

  reply	other threads:[~2012-07-06  0:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1341110730-444-1-git-send-email-proljc@gmail.com>
     [not found] ` <1341110730-444-9-git-send-email-proljc@gmail.com>
2012-07-03 18:48   ` [Qemu-devel] [PATCH v8 08/16] target-or32: Add instruction translation Blue Swirl
2012-07-04  2:23     ` Jia Liu
2012-07-04 23:59       ` Jia Liu
2012-07-05 18:45         ` Blue Swirl
2012-07-06  0:23           ` Jia Liu [this message]
     [not found] ` <1341110730-444-2-git-send-email-proljc@gmail.com>
2012-07-05 13:22   ` [Qemu-devel] [PATCH v8 01/16] target-or32: Add target stubs and QOM cpu Andreas Färber
2012-07-05 13:31     ` Paolo Bonzini
2012-07-05 15:31       ` Andreas Färber
2012-07-09  7:08     ` Jia Liu

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=CAJBMM-toxB5YYhw-0C_2kTBvEgG9kCtYofKOaKMyCaOPswCM-Q@mail.gmail.com \
    --to=proljc@gmail.com \
    --cc=blauwirbel@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).