17f2ac410Schristos /* C-SKY assembler/disassembler support. 2*6881a400Schristos Copyright (C) 2004-2022 Free Software Foundation, Inc. 37f2ac410Schristos Contributed by C-SKY Microsystems and Mentor Graphics. 47f2ac410Schristos 57f2ac410Schristos This file is part of GDB and GAS. 67f2ac410Schristos 77f2ac410Schristos GDB and GAS are free software; you can redistribute it and/or 87f2ac410Schristos modify it under the terms of the GNU General Public License as 97f2ac410Schristos published by the Free Software Foundation; either version 3, or (at 107f2ac410Schristos your option) any later version. 117f2ac410Schristos 127f2ac410Schristos GDB and GAS are distributed in the hope that it will be useful, but 137f2ac410Schristos WITHOUT ANY WARRANTY; without even the implied warranty of 147f2ac410Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 157f2ac410Schristos General Public License for more details. 167f2ac410Schristos 177f2ac410Schristos You should have received a copy of the GNU General Public License 187f2ac410Schristos along with GDB or GAS; see the file COPYING3. If not, write to the 197f2ac410Schristos Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, 207f2ac410Schristos MA 02110-1301, USA. */ 217f2ac410Schristos 227f2ac410Schristos #include "dis-asm.h" 237f2ac410Schristos 247f2ac410Schristos /* The following bitmasks control instruction set architecture. */ 25*6881a400Schristos #define CSKYV1_ISA_E1 ((uint64_t) 1 << 0) 26*6881a400Schristos #define CSKYV2_ISA_E1 ((uint64_t) 1 << 1) 27*6881a400Schristos #define CSKYV2_ISA_1E2 ((uint64_t) 1 << 2) 28*6881a400Schristos #define CSKYV2_ISA_2E3 ((uint64_t) 1 << 3) 29*6881a400Schristos #define CSKYV2_ISA_3E7 ((uint64_t) 1 << 4) 30*6881a400Schristos #define CSKYV2_ISA_7E10 ((uint64_t) 1 << 5) 31*6881a400Schristos #define CSKYV2_ISA_3E3R1 ((uint64_t) 1 << 6) 32*6881a400Schristos #define CSKYV2_ISA_3E3R2 ((uint64_t) 1 << 7) 33*6881a400Schristos #define CSKYV2_ISA_10E60 ((uint64_t) 1 << 8) 34*6881a400Schristos #define CSKYV2_ISA_3E3R3 ((uint64_t) 1 << 9) 357f2ac410Schristos 36*6881a400Schristos #define CSKY_ISA_TRUST ((uint64_t) 1 << 11) 37*6881a400Schristos #define CSKY_ISA_CACHE ((uint64_t) 1 << 12) 38*6881a400Schristos #define CSKY_ISA_NVIC ((uint64_t) 1 << 13) 39*6881a400Schristos #define CSKY_ISA_CP ((uint64_t) 1 << 14) 40*6881a400Schristos #define CSKY_ISA_MP ((uint64_t) 1 << 15) 41*6881a400Schristos #define CSKY_ISA_MP_1E2 ((uint64_t) 1 << 16) 42*6881a400Schristos #define CSKY_ISA_JAVA ((uint64_t) 1 << 17) 43*6881a400Schristos #define CSKY_ISA_MAC ((uint64_t) 1 << 18) 44*6881a400Schristos #define CSKY_ISA_MAC_DSP ((uint64_t) 1 << 19) 457f2ac410Schristos 467f2ac410Schristos /* Base ISA for csky v1 and v2. */ 47*6881a400Schristos #define CSKY_ISA_DSP ((uint64_t) 1 << 20) 48*6881a400Schristos #define CSKY_ISA_DSP_1E2 ((uint64_t) 1 << 21) 49*6881a400Schristos #define CSKY_ISA_DSP_ENHANCE ((uint64_t) 1 << 22) 50*6881a400Schristos #define CSKY_ISA_DSPE60 ((uint64_t) 1 << 23) 517f2ac410Schristos 527f2ac410Schristos /* Base float instruction (803f & 810f). */ 53*6881a400Schristos #define CSKY_ISA_FLOAT_E1 ((uint64_t) 1 << 25) 547f2ac410Schristos /* M_FLOAT support (810f). */ 55*6881a400Schristos #define CSKY_ISA_FLOAT_1E2 ((uint64_t) 1 << 26) 567f2ac410Schristos /* 803 support (803f). */ 57*6881a400Schristos #define CSKY_ISA_FLOAT_1E3 ((uint64_t) 1 << 27) 587f2ac410Schristos /* 807 support (803f & 807f). */ 59*6881a400Schristos #define CSKY_ISA_FLOAT_3E4 ((uint64_t) 1 << 28) 607d62b00eSchristos /* 860 support. */ 61*6881a400Schristos #define CSKY_ISA_FLOAT_7E60 ((uint64_t) 1 << 36) 627f2ac410Schristos /* Vector DSP support. */ 63*6881a400Schristos #define CSKY_ISA_VDSP ((uint64_t) 1 << 29) 64*6881a400Schristos #define CSKY_ISA_VDSP_2 ((uint64_t) 1 << 30) 657f2ac410Schristos 667f2ac410Schristos /* The following bitmasks control cpu architecture for CSKY. */ 677f2ac410Schristos #define CSKY_ABI_V1 (1 << 28) 687f2ac410Schristos #define CSKY_ABI_V2 (2 << 28) 697f2ac410Schristos #define CSKY_ARCH_MASK 0x0000001F 707f2ac410Schristos #define CSKY_ABI_MASK 0xF0000000 717f2ac410Schristos 727f2ac410Schristos #define CSKY_ARCH_510 0x1 737f2ac410Schristos #define CSKY_ARCH_610 0x2 747f2ac410Schristos #define CSKY_ARCH_801 0xa 757f2ac410Schristos #define CSKY_ARCH_802 0x10 767f2ac410Schristos #define CSKY_ARCH_803 0x9 777d62b00eSchristos /* 804 use the same arch flag as 803 yet. */ 787d62b00eSchristos #define CSKY_ARCH_804 0x9 797d62b00eSchristos #define CSKY_ARCH_805 0x11 807f2ac410Schristos #define CSKY_ARCH_807 0x6 817f2ac410Schristos #define CSKY_ARCH_810 0x8 827d62b00eSchristos #define CSKY_ARCH_860 0xb 837d62b00eSchristos /* 800 is a special arch supporting all instructions for ABIV2. */ 847d62b00eSchristos #define CSKY_ARCH_800 0x1f 857f2ac410Schristos 867f2ac410Schristos #define CSKY_ARCH_MAC (1 << 15) 877f2ac410Schristos #define CSKY_ARCH_DSP (1 << 14) 887f2ac410Schristos #define CSKY_ARCH_FLOAT (1 << 13) 897f2ac410Schristos #define CSKY_ARCH_SIMD (1 << 12) 907f2ac410Schristos #define CSKY_ARCH_CP (1 << 11) 917f2ac410Schristos #define CSKY_ARCH_MP (1 << 10) 927f2ac410Schristos #define CSKY_ARCH_CACHE (1 << 9) 937f2ac410Schristos #define CSKY_ARCH_JAVA (1 << 8) 947f2ac410Schristos #define CSKY_ARCH_APS (1 << 7) 957f2ac410Schristos 96*6881a400Schristos /* eflag's Versions. */ 97*6881a400Schristos #define CSKY_VERSION_V1 (1 << 24) 98*6881a400Schristos #define CSKY_VERSION_V2 (2 << 24) 99*6881a400Schristos #define CSKY_VERSION_V3 (3 << 24) 100*6881a400Schristos 1017f2ac410Schristos #define IS_CSKY_V1(a) \ 1027f2ac410Schristos (((a) & CSKY_ABI_MASK) == CSKY_ABI_V1) 1037f2ac410Schristos #define IS_CSKY_V2(a) \ 1047f2ac410Schristos (((a) & CSKY_ABI_MASK) == CSKY_ABI_V2) 1057f2ac410Schristos #define IS_CSKY_ARCH_V1(a) \ 1067f2ac410Schristos (((a) & CSKY_ARCH_MASK) == CSKY_ARCH_510 \ 1077f2ac410Schristos || ((a) & CSKY_ARCH_MASK) == CSKY_ARCH_610) 1087f2ac410Schristos #define IS_CSKY_ARCH_V2(a) \ 1097f2ac410Schristos (!(IS_CSKY_ARCH_V1 (a))) 1107f2ac410Schristos 1117f2ac410Schristos #define IS_CSKY_ARCH_510(a) (((a) & CSKY_ARCH_MASK) == CSKY_ARCH_510) 1127f2ac410Schristos #define IS_CSKY_ARCH_610(a) (((a) & CSKY_ARCH_MASK) == CSKY_ARCH_610) 1137f2ac410Schristos #define IS_CSKY_ARCH_801(a) (((a) & CSKY_ARCH_MASK) == CSKY_ARCH_801) 1147f2ac410Schristos #define IS_CSKY_ARCH_802(a) (((a) & CSKY_ARCH_MASK) == CSKY_ARCH_802) 1157f2ac410Schristos #define IS_CSKY_ARCH_803(a) (((a) & CSKY_ARCH_MASK) == CSKY_ARCH_803) 1167f2ac410Schristos #define IS_CSKY_ARCH_807(a) (((a) & CSKY_ARCH_MASK) == CSKY_ARCH_807) 1177f2ac410Schristos #define IS_CSKY_ARCH_810(a) (((a) & CSKY_ARCH_MASK) == CSKY_ARCH_810) 1187f2ac410Schristos 1197f2ac410Schristos #define CPU_ARCH_MASK \ 1207f2ac410Schristos (CSKY_ARCH_JAVA | CSKY_ARCH_FLOAT | CSKY_ARCH_DSP | CSKY_ARCH_MASK) 1217f2ac410Schristos 1227f2ac410Schristos #ifdef __cplusplus 1237f2ac410Schristos extern "C" { 1247f2ac410Schristos #endif 1257f2ac410Schristos extern int print_insn_csky (bfd_vma memaddr, struct disassemble_info *info); 1267f2ac410Schristos #ifdef __cplusplus 1277f2ac410Schristos } 1287f2ac410Schristos #endif 129