This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] opcodes/h8300-dis.c


Hi,

Attached is a patch for opcodes/h8300-dis.c. The patch fixes incorrect
disassembly of inc.[wl] and dec.[wl]. It also fixes two typos.

/* h8300-hms-gcc -mh -Wall -O2 -fomit-frame-pointer -o incbug.o incbug.c */
void
test ()
{
  asm ("inc.w\t#0x01,r0");
  asm ("inc.l\t#0x01,er1");
  asm ("dec.w\t#0x01,r2");
  asm ("dec.l\t#0x01,er3");
}

The C code above results in the disassembly below:

Without the patch:

/* h8300-hms-objdump --no-show-raw-insn -d incbug.o */
00000000 <_test>:
   0:	0b 50             inc.w	#0x1,r0
   2:	0b 71             inc.w	#0x1,r1 <- this shuold really be inc.l
#0x1,er1
   4:	1b 52             dec.w	#0x1,r2
   6:	1b 73             dec.w	#0x1,r3 <- this shuold really be dec.l
#0x1,er3
   8:	54 70             rts	

With the patch:

/* h8300-hms-objdump --no-show-raw-insn -d incbug.o */
00000000 <_test>:
   0:	0b 50             inc.w	#0x1,r0
   2:	0b 71             inc.l	#0x1,er1 <- good!
   4:	1b 52             dec.w	#0x1,r2
   6:	1b 73             dec.l	#0x1,er3 <- good!
   8:	54 70             rts	

For your information, the instruction manuals for the target are available
at:

H8/300 (You won't find dec.[wl] or inc.[wl] on this chip.)
http://semiconductor.hitachi.com/products/pdf/h33tp001d1.pdf

H8/300H
http://semiconductor.hitachi.com/products/pdf/h3htp002d1.pdf

H8/S
http://semiconductor.hitachi.com/products/pdf/h82tp001d2.pdf

Thanks,

Kazu Hirata

h8300-dis.patch

ChangeLog-h8300-dis


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]