diff options
author | Jeff Law <law@redhat.com> | 1996-08-31 19:22:11 +0000 |
---|---|---|
committer | Jeff Law <law@redhat.com> | 1996-08-31 19:22:11 +0000 |
commit | 529418ddc475e8e16b487b85e12a81c16abd12d0 (patch) | |
tree | 953c170ee13b221a3e417e63dc5f6a44417f660f /opcodes | |
parent | ba39d3dde1601a98887020c8bf1eeaf20c5e8709 (diff) | |
download | gdb-529418ddc475e8e16b487b85e12a81c16abd12d0.zip gdb-529418ddc475e8e16b487b85e12a81c16abd12d0.tar.gz gdb-529418ddc475e8e16b487b85e12a81c16abd12d0.tar.bz2 |
* v850-dis.c: New file. Skeleton for disassembler support.
* Makefile.in Remove v850 references, they're not needed here
and they weren't being sanitized away.
* configure.in: Add v850-dis.o when building v850 toolchains.
* configure: Rebuilt.
* disassemble.c (disassembler): Call v850 disassembler.
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/v850-dis.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/opcodes/v850-dis.c b/opcodes/v850-dis.c new file mode 100644 index 0000000..3ee3959 --- /dev/null +++ b/opcodes/v850-dis.c @@ -0,0 +1,78 @@ +/* Disassemble V850 instructions. + Copyright (C) 1996 Free Software Foundation, Inc. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + + +#include <stdio.h> + +#include "ansidecl.h" +#include "opcode/v850.h" +#include "dis-asm.h" + +int +print_insn_v850 (memaddr, info) + bfd_vma memaddr; + struct disassemble_info *info; +{ + int status; + bfd_byte buffer[4]; + unsigned long insn; + + status = (*info->read_memory_func) (memaddr, buffer, 4, info); + if (status != 0) + { + (*info->memory_error_func) (status, memaddr, info); + return -1; + } + insn = bfd_getl32 (buffer); + + disassemble (insn, info); + if ((insn & 0x0600) == 0x0600) + return 4; + else + return 2; +} + +disassemble (insn, info) + unsigned long insn; + struct disassemble_info *info; +{ + struct v850_opcode *op = (struct v850_opcode *)v850_opcodes; + int match = 0; + /* If this is a two byte insn, then mask off the high bits. */ + if ((insn & 0x0600) != 0x0600) + insn &= 0xffff; + + /* Find the opcode. */ + while (op->name) + { + if ((op->mask & insn) == op->opcode) + { + match = 1; + (*info->fprintf_func) (info->stream, "%s\t", op->name); + break; + } + op++; + } + + if (!match) + { + if ((insn & 0x0600) != 0x0600) + (*info->fprintf_func) (info->stream, ".short\t0x%04x", insn); + else + (*info->fprintf_func) (info->stream, ".long\t0x%08x", insn); + } +} |