On 12 October 2016 at 17:42, Michael Walle <mich...@walle.cc> wrote:
> Am 2016-10-12 18:35, schrieb Peter Maydell:
>> but I noticed while doing the review that our LOG_DIS
>> is wrong for the compare-immediates:
>> LOG_DIS("cmpei r%d, r%d, %d\n", dc->r0, dc->r1,
>> sign_extend(dc->imm16, 16));
>> but the processor reference manual says cmpei's mnemonic
>> should have dc->r1 first and dc->r0 second.
>> (Similarly for the logging for the other immediate compares.)
> Argh, you're eyes are too good ;) I'll have a look.
If you're looking at lm32 bugs in general, you might also
be interested in the one coverity report for lm32, which
is that in hw/display/milkymist-tmu2.c this code from tmu2_start()
fb_len = 2*s->regs[R_TEXHRES]*s->regs[R_TEXVRES];
is reported as a potential overflow, because the s->regs
fields are 32 bits and so the multiplies are done as
32*32 (truncating) but fb_len is 64 bit. Changing the
2 to 2ULL is probably the simplest fix...