2004-02-21 00:23:01 +08:00
|
|
|
|
/* SHmedia opcode support. -*- C -*-
|
|
|
|
|
|
2009-09-02 15:25:43 +08:00
|
|
|
|
Copyright 2000, 2005, 2007, 2009 Free Software Foundation, Inc.
|
2004-02-21 00:23:01 +08:00
|
|
|
|
|
|
|
|
|
Contributed by Red Hat Inc; developed under contract from Hitachi
|
|
|
|
|
Semiconductor (America) Inc.
|
|
|
|
|
|
|
|
|
|
This file is part of the GNU Binutils.
|
|
|
|
|
|
|
|
|
|
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
|
2007-07-05 17:49:03 +08:00
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2004-02-21 00:23:01 +08:00
|
|
|
|
(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
|
2005-07-01 19:16:33 +08:00
|
|
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
|
MA 02110-1301, USA. */
|
2004-02-21 00:23:01 +08:00
|
|
|
|
|
2007-07-05 17:49:03 +08:00
|
|
|
|
|
2004-02-21 00:23:01 +08:00
|
|
|
|
/* This file is an addendum to sh-media.cpu. Heavy use of C code isn't
|
|
|
|
|
appropriate in .cpu files, so it resides here. This especially applies
|
|
|
|
|
to assembly/disassembly where parsing/printing can be quite involved.
|
|
|
|
|
Such things aren't really part of the specification of the cpu, per se,
|
|
|
|
|
so .cpu files provide the general framework and .opc files handle the
|
|
|
|
|
nitty-gritty details as necessary.
|
|
|
|
|
|
|
|
|
|
Each section is delimited with start and end markers.
|
|
|
|
|
|
|
|
|
|
<arch>-opc.h additions use: "-- opc.h"
|
|
|
|
|
<arch>-opc.c additions use: "-- opc.c"
|
|
|
|
|
<arch>-asm.c additions use: "-- asm.c"
|
|
|
|
|
<arch>-dis.c additions use: "-- dis.c"
|
2005-07-01 19:16:33 +08:00
|
|
|
|
<arch>-ibd.h additions use: "-- ibd.h" */
|
2004-02-21 00:23:01 +08:00
|
|
|
|
|
|
|
|
|
/* -- opc.h */
|
|
|
|
|
|
|
|
|
|
/* Allows reason codes to be output when assembler errors occur. */
|
|
|
|
|
#define CGEN_VERBOSE_ASSEMBLER_ERRORS
|
|
|
|
|
|
|
|
|
|
/* Override disassembly hashing - there are variable bits in the top
|
|
|
|
|
byte of these instructions. */
|
|
|
|
|
#define CGEN_DIS_HASH_SIZE 8
|
|
|
|
|
#define CGEN_DIS_HASH(buf,value) (((* (unsigned char*) (buf)) >> 6) % CGEN_DIS_HASH_SIZE)
|
|
|
|
|
|
|
|
|
|
/* -- asm.c */
|
|
|
|
|
|
|
|
|
|
static const char *
|
2005-07-01 19:16:33 +08:00
|
|
|
|
parse_fsd (CGEN_CPU_DESC cd,
|
|
|
|
|
const char ** strp,
|
|
|
|
|
int opindex,
|
|
|
|
|
long * valuep)
|
2004-02-21 00:23:01 +08:00
|
|
|
|
{
|
2005-07-01 19:16:33 +08:00
|
|
|
|
abort ();
|
2004-02-21 00:23:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -- dis.c */
|
|
|
|
|
|
|
|
|
|
static void
|
2005-07-01 19:16:33 +08:00
|
|
|
|
print_likely (CGEN_CPU_DESC cd,
|
|
|
|
|
void * dis_info,
|
|
|
|
|
long value,
|
|
|
|
|
unsigned int attrs,
|
|
|
|
|
bfd_vma pc,
|
|
|
|
|
int length)
|
2004-02-21 00:23:01 +08:00
|
|
|
|
{
|
|
|
|
|
disassemble_info *info = (disassemble_info *) dis_info;
|
2005-07-01 19:16:33 +08:00
|
|
|
|
|
2004-02-21 00:23:01 +08:00
|
|
|
|
(*info->fprintf_func) (info->stream, (value) ? "/l" : "/u");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -- */
|