qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Aleksandar Markovic <amarkovic@wavecomp.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Stefan Markovic <smarkovic@wavecomp.com>,
	Petar Jovanovic <pjovanovic@wavecomp.com>,
	Aleksandar Rikalo <arikalo@wavecomp.com>
Subject: Re: [Qemu-devel] Correction needed for R5900 instruction decoding
Date: Fri, 2 Nov 2018 18:51:05 +0100	[thread overview]
Message-ID: <3046b1b0-c8dc-5055-bb82-f689cec37cb1@redhat.com> (raw)
In-Reply-To: <BN6PR2201MB125116B5479010DB326DCCFCC6CE0@BN6PR2201MB1251.namprd22.prod.outlook.com>

Hi Aleksandar,

On 1/11/18 12:06, Aleksandar Markovic wrote:
> Hi, Fridrik,
> 
> I did some closer code inspection of R5900 in last few days, and I noticed some sub-optimal implementation in the area where R5900-specific opcodes overlap with the rest-of-MIPS-CPUs opcodes.
> 
> The right implementation should be based on the principle that all such cases are covered with if statements involving INSN_R5900 flag, like this:
> 
>          if (ctx->insn_flags & INSN_R5900) {
>              <R5900-specific handling>
>          } else {
>              <rest-of-MIPS-handling>
>          }
> 
> You followed that principle for OPC_SPECIAL2 and OPC_SPECIAL3, but for some other opcodes not. For example, there are lines:
> 
>      if (reg == 0 && (opc == OPC_MFHI || opc == TX79_MMI_MFHI1 ||
>                       opc == OPC_MFLO || opc == TX79_MMI_MFLO1)) {
> 
> or
> 
>       switch (opc) {
>       case OPC_MFHI:
>       case TX79_MMI_MFHI1:
> 
> Such implementation makes it difficult to discern R5900 and non-R5900 cases. Potentialy allows bugs to sneak in and affect non-R5900 support.
> 
> The correction is not that difficult, I gather. Worse comme to worst, you can remove R5900 MFLO1 and MFHI1 altogether, they are not that essential at this moment, but do try correcting the decoding stuff as I described. Can you please make these changes in next few days or so (given that 3.1 release is getting closer and closer), and send them to the list?
> 
> It is my bad that I didn't spot this during review, but in any case, I think this should be fixed in 3.1 to make sure that non-R5900 functionalities are intact.

Don't be too bad on yourself, we are human thus not perfect :) This is 
why having more that one (or not always the same) person reviewing is 
helpful.

You can share the blame with all the person subscribed to the list who 
did not look at the patch ;)

Regards,

Phil.

> 
> Thanks,
> Aleksandar
> 
> 

      parent reply	other threads:[~2018-11-02 17:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-01 11:06 [Qemu-devel] Correction needed for R5900 instruction decoding Aleksandar Markovic
2018-11-01 14:31 ` Philippe Mathieu-Daudé
2018-11-01 17:23   ` Fredrik Noring
2018-11-01 18:07     ` Aleksandar Markovic
2018-11-02 13:43     ` Aleksandar Markovic
2018-11-02 14:31       ` Fredrik Noring
2018-11-02 15:03         ` Aleksandar Markovic
2018-11-02 15:18           ` Peter Maydell
2018-11-02 15:49             ` Fredrik Noring
2018-11-01 14:35 ` Emilio G. Cota
2018-11-02 17:51 ` Philippe Mathieu-Daudé [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=3046b1b0-c8dc-5055-bb82-f689cec37cb1@redhat.com \
    --to=philmd@redhat.com \
    --cc=amarkovic@wavecomp.com \
    --cc=arikalo@wavecomp.com \
    --cc=pjovanovic@wavecomp.com \
    --cc=qemu-devel@nongnu.org \
    --cc=smarkovic@wavecomp.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).