qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [MIPS Malta] Wrong relative jump in the YAMON print subrout


From: Jakub Jermar
Subject: [Qemu-devel] [MIPS Malta] Wrong relative jump in the YAMON print subroutine
Date: Fri, 14 Dec 2012 00:35:04 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0

Hello,

there appears to be a bug in the hand-written machine code which causes
the YAMON print subroutine to jump to a wrong location after printing
the first character. In hw/mips_malta.c, line 619, there is:

stl_raw(p++, 0x08000205);                                    /* j 814 */

which results in the following wrong code being generated:

   0xbfc00814:  lbu     a0,0(t2)
   0xbfc00818:  addiu   t2,t2,1
   0xbfc0081c:  beqz    a0,0xbfc00834
   0xbfc00820:  nop
   0xbfc00824:  jal     0xbfc00870
   0xbfc00828:  nop
   0xbfc0082c:  j       0xb0000814     <==== HERE

While in fact we would like it to branch to 0xbfc00814 instead. To
achieve this effect, the line needs to be changed to read as:

stl_raw(p++, 0x1000fff9);                                   /* j 814 */

so that we get:

   0xbfc00814:  lbu     a0,0(t2)
   0xbfc00818:  addiu   t2,t2,1
   0xbfc0081c:  beqz    a0,0xbfc00834
   0xbfc00820:  nop
   0xbfc00824:  jal     0xbfc00870
   0xbfc00828:  nop
   0xbfc0082c:  b       0xbfc00814

I verified the print subroutine works as expected with the fix.

Please find the fix attached to this message.

Regards,
Jakub

Attachment: yamon-print.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]