From ecc68fd60fe8e9a06aaaf5f87ed983f91eef41d1 Mon Sep 17 00:00:00 2001 From: scottr Date: Thu, 19 Jun 1997 17:39:38 +0000 Subject: [PATCH] Disassemble the MOVE16 instruction. Also, correct the spelling of `unknown' while were here, as suggested. From Denny Gentry , PR 3567. --- sys/arch/m68k/m68k/db_disasm.c | 54 ++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/sys/arch/m68k/m68k/db_disasm.c b/sys/arch/m68k/m68k/db_disasm.c index d956d05d6f97..33301eeaa8a6 100644 --- a/sys/arch/m68k/m68k/db_disasm.c +++ b/sys/arch/m68k/m68k/db_disasm.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_disasm.c,v 1.19 1996/10/30 08:22:39 is Exp $ */ +/* $NetBSD: db_disasm.c,v 1.20 1997/06/19 17:39:38 scottr Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -110,6 +110,7 @@ void opcode_1110 __P((dis_buffer_t *, u_short)); void opcode_fpu __P((dis_buffer_t *, u_short)); void opcode_mmu __P((dis_buffer_t *, u_short)); void opcode_mmu040 __P((dis_buffer_t *, u_short)); +void opcode_move16 __P((dis_buffer_t *, u_short)); /* subs of groups */ void opcode_movec __P((dis_buffer_t *, u_short)); @@ -1327,6 +1328,9 @@ opcode_coproc(dbuf, opc) case 2: opcode_mmu040(dbuf, opc); return; + case 3: + opcode_move16(dbuf, opc); + return; } switch (BITFIELD(opc,8,6)) { case 0: @@ -1344,7 +1348,7 @@ opcode_coproc(dbuf, opc) case 5: default: } - addstr(dbuf, "UKNOWN COPROC OPCODE"); + addstr(dbuf, "UNKNOWN COPROC OPCODE"); return; } @@ -2275,6 +2279,52 @@ opcode_movec(dbuf, opc) } } +/* + * disassemble move16 opcode. + */ +void +opcode_move16(dbuf, opc) +dis_buffer_t *dbuf; + u_short opc; +{ + u_short ext; + + addstr(dbuf, "move16\t"); + + if (ISBITSET(opc, 5)) { + PRINT_AREG(dbuf, BITFIELD(opc,2,0)); + addstr(dbuf, "@+,"); + ext = *(dbuf->val + 1); + PRINT_AREG(dbuf, BITFIELD(ext,14,12)); + addstr(dbuf, "@+"); + dbuf->used++; + } else { + switch (BITFIELD(opc,4,3)) { + case 0: + PRINT_AREG(dbuf, BITFIELD(opc,2,0)); + addstr(dbuf, "@+,"); + get_immed(dbuf, SIZE_LONG); + break; + case 1: + get_immed(dbuf, SIZE_LONG); + addchar(','); + PRINT_AREG(dbuf, BITFIELD(opc,2,0)); + addstr(dbuf, "@+"); + break; + case 2: + PRINT_AREG(dbuf, BITFIELD(opc,2,0)); + addstr(dbuf, "@,"); + get_immed(dbuf, SIZE_LONG); + break; + case 3: + get_immed(dbuf, SIZE_LONG); + addchar(','); + PRINT_AREG(dbuf, BITFIELD(opc,2,0)); + addchar('@'); + break; + } + } +} /* * copy const string 's' into ``dbuf''->casm