qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Correction needed for R5900 instruction decoding
@ 2018-11-01 11:06 Aleksandar Markovic
  2018-11-01 14:31 ` Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Aleksandar Markovic @ 2018-11-01 11:06 UTC (permalink / raw)
  To: qemu-devel@nongnu.org; +Cc: Petar Jovanovic, Stefan Markovic, Aleksandar Rikalo

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.

Thanks,
Aleksandar

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-11-02 17:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).