/*cris.h--HeaderfileforCRISopcodeandregistertables.Copyright(C)2000,2001,2004FreeSoftwareFoundation,Inc.ContributedbyAxisCommunicationsAB,Lund,Sweden.OriginallywrittenforGAS1.38.1byMikaelAsker.Updated,BFDizedandGNUifiedbyHans-PeterNilsson.ThisfileispartofGAS,GDBandtheGNUbinutils.GAS,GDB,andGNUbinutilsisfreesoftware;youcanredistributeitand/ormodifyitunderthetermsoftheGNUGeneralPublicLicenseaspublishedbytheFreeSoftwareFoundation;eitherversion2,or(atyouroption)anylaterversion.GAS,GDB,andGNUbinutilsaredistributedinthehopethattheywillbeuseful,butWITHOUTANYWARRANTY;withouteventheimpliedwarrantyofMERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.SeetheGNUGeneralPublicLicenseformoredetails.YoushouldhavereceivedacopyoftheGNUGeneralPublicLicensealongwiththisprogram;ifnot,writetotheFreeSoftwareFoundation,Inc.,51FranklinStreet-FifthFloor,Boston,MA02110-1301,USA.*/#ifndef__CRIS_H_INCLUDED_#define__CRIS_H_INCLUDED_#if!defined(__STDC__)&&!defined(const)#defineconst#endif/* Registers. */#defineMAX_REG(15)#defineREG_SP(14)#defineREG_PC(15)/*CPUversioncontrolofdisassemblyandassemblyofinstructions.Mayaffecthowtheinstructionisassembled,atleastthesizeofimmediateoperands.*/enumcris_insn_version_usage{/* Any version. */cris_ver_version_all=0,/* Indeterminate (intended for disassembly only, or obsolete). */cris_ver_warning,/* Only for v0..3 (Etrax 1..4). */cris_ver_v0_3,/* Only for v3 or higher (ETRAX 4 and beyond). */cris_ver_v3p,/* Only for v8 (Etrax 100). */cris_ver_v8,/* Only for v8 or higher (ETRAX 100, ETRAX 100 LX). */cris_ver_v8p,/* Only for v0..10. FIXME: Not sure what to do with this. */cris_ver_sim_v0_10,/* Only for v0..10. */cris_ver_v0_10,/* Only for v3..10. (ETRAX 4, ETRAX 100 and ETRAX 100 LX). */cris_ver_v3_10,/* Only for v8..10 (ETRAX 100 and ETRAX 100 LX). */cris_ver_v8_10,/* Only for v10 (ETRAX 100 LX) and same series. */cris_ver_v10,/* Only for v10 (ETRAX 100 LX) and same series. */cris_ver_v10p,/*Onlyforv32orhigher(codenameGUINNESS).Ofcoursesomeoralltheseofmaychangetocris_ver_v32pif/whenthere'sanewrevision.*/cris_ver_v32p};/* Special registers. */structcris_spec_reg{constchar*constname;unsignedintnumber;/* The size of the register. */unsignedintreg_size;/*WhatCPUversionthespecialregisterofthatnameisimplementedin.Ifcris_ver_warning,emitanunimplemented-warning.*/enumcris_insn_version_usageapplicable_version;/*Theremightbeaspecificwarningforusingaspecialregisterhere.*/constchar*constwarning;};externconststructcris_spec_regcris_spec_regs[];/* Support registers (kind of special too, but not named as such). */structcris_support_reg{constchar*constname;unsignedintnumber;};externconststructcris_support_regcris_support_regs[];structcris_cond15{/* The name of the condition. */constchar*constname;/* What CPU version this condition name applies to. */enumcris_insn_version_usageapplicable_version;};externconststructcris_cond15cris_conds15[];/* Opcode-dependent constants. */#defineAUTOINCR_BIT(0x04)/* Prefixes. */#defineBDAP_QUICK_OPCODE(0x0100)#defineBDAP_QUICK_Z_BITS(0x0e00)#defineBIAP_OPCODE(0x0540)#defineBIAP_Z_BITS(0x0a80)#defineDIP_OPCODE(0x0970)#defineDIP_Z_BITS(0xf280)#defineBDAP_INDIR_LOW(0x40)#defineBDAP_INDIR_LOW_Z(0x80)#defineBDAP_INDIR_HIGH(0x09)#defineBDAP_INDIR_HIGH_Z(0x02)#defineBDAP_INDIR_OPCODE(BDAP_INDIR_HIGH*0x0100+BDAP_INDIR_LOW)#defineBDAP_INDIR_Z_BITS(BDAP_INDIR_HIGH_Z*0x100+BDAP_INDIR_LOW_Z)#defineBDAP_PC_LOW(BDAP_INDIR_LOW+REG_PC)#defineBDAP_INCR_HIGH(BDAP_INDIR_HIGH+AUTOINCR_BIT)/*Noprefixmusthavethiscodeforits"match"bitsintheopcode-table."BCC .+2"willdonicely.*/#defineNO_CRIS_PREFIX0/* Definitions for condition codes. */#defineCC_CC0x0#defineCC_HS0x0#defineCC_CS0x1#defineCC_LO0x1#defineCC_NE0x2#defineCC_EQ0x3#defineCC_VC0x4#defineCC_VS0x5#defineCC_PL0x6#defineCC_MI0x7#defineCC_LS0x8#defineCC_HI0x9#defineCC_GE0xA#defineCC_LT0xB#defineCC_GT0xC#defineCC_LE0xD#defineCC_A0xE#defineCC_EXT0xF/*Atableofstrings"cc","cs"...indexedwithconditioncodevaluesasabove.*/externconstchar*constcris_cc_strings[];/* Bcc quick. */#defineBRANCH_QUICK_LOW(0)#defineBRANCH_QUICK_HIGH(0)#defineBRANCH_QUICK_OPCODE(BRANCH_QUICK_HIGH*0x0100+BRANCH_QUICK_LOW)#defineBRANCH_QUICK_Z_BITS(0x0F00)/* BA quick. */#defineBA_QUICK_HIGH(BRANCH_QUICK_HIGH+CC_A*0x10)#defineBA_QUICK_OPCODE(BA_QUICK_HIGH*0x100+BRANCH_QUICK_LOW)/* Bcc [PC+]. */#defineBRANCH_PC_LOW(0xFF)#defineBRANCH_INCR_HIGH(0x0D)#defineBA_PC_INCR_OPCODE\((BRANCH_INCR_HIGH+CC_A*0x10)*0x0100+BRANCH_PC_LOW)/* Jump. *//*Notethatoldversionsgeneratedspecialregister8(inhighbits)andnot-that-oldversionsrecognizeditasajump-instruction.ThatopcodenowbelongstoJUMPU.*/#defineJUMP_INDIR_OPCODE(0x0930)#defineJUMP_INDIR_Z_BITS(0xf2c0)#defineJUMP_PC_INCR_OPCODE\(JUMP_INDIR_OPCODE+AUTOINCR_BIT*0x0100+REG_PC)#defineMOVE_M_TO_PREG_OPCODE0x0a30#defineMOVE_M_TO_PREG_ZBITS0x01c0/* BDAP.D N,PC. */#defineMOVE_PC_INCR_OPCODE_PREFIX\(((BDAP_INCR_HIGH|(REG_PC<<4))<<8)|BDAP_PC_LOW|(2<<4))#defineMOVE_PC_INCR_OPCODE_SUFFIX\(MOVE_M_TO_PREG_OPCODE|REG_PC|(AUTOINCR_BIT<<8))#defineJUMP_PC_INCR_OPCODE_V32(0x0DBF)/* BA DWORD (V32). */#defineBA_DWORD_OPCODE(0x0EBF)/* Nop. */#defineNOP_OPCODE(0x050F)#defineNOP_Z_BITS(0xFFFF^NOP_OPCODE)#defineNOP_OPCODE_V32(0x05B0)#defineNOP_Z_BITS_V32(0xFFFF^NOP_OPCODE_V32)/*Forthecompatibilitymode,let'suse"MOVE R0,P0".Doesn'taffectregistersorflags.Unfortunatelyshutsoffinterruptsforonecyclefor<v32,buttheredoesn'tseemtobeanyalternativewithoutthateffect.*/#defineNOP_OPCODE_COMMON(0x630)#defineNOP_OPCODE_ZBITS_COMMON(0xffff&~NOP_OPCODE_COMMON)/* LAPC.D */#defineLAPC_DWORD_OPCODE(0x0D7F)#defineLAPC_DWORD_Z_BITS(0x0fff&~LAPC_DWORD_OPCODE)/* Structure of an opcode table entry. */enumcris_imm_oprnd_size_type{/* No size is applicable. */SIZE_NONE,/* Always 32 bits. */SIZE_FIX_32,/* Indicated by size of special register. */SIZE_SPEC_REG,/* Indicated by size field, signed. */SIZE_FIELD_SIGNED,/* Indicated by size field, unsigned. */SIZE_FIELD_UNSIGNED,/* Indicated by size field, no sign implied. */SIZE_FIELD};/*ForGDB.FIXME:Isthisthebestwaytohandleopcodeinterpretation?*/enumcris_op_type{cris_not_implemented_op=0,cris_abs_op,cris_addi_op,cris_asr_op,cris_asrq_op,cris_ax_ei_setf_op,cris_bdap_prefix,cris_biap_prefix,cris_break_op,cris_btst_nop_op,cris_clearf_di_op,cris_dip_prefix,cris_dstep_logshift_mstep_neg_not_op,cris_eight_bit_offset_branch_op,cris_move_mem_to_reg_movem_op,cris_move_reg_to_mem_movem_op,cris_move_to_preg_op,cris_muls_op,cris_mulu_op,cris_none_reg_mode_add_sub_cmp_and_or_move_op,cris_none_reg_mode_clear_test_op,cris_none_reg_mode_jump_op,cris_none_reg_mode_move_from_preg_op,cris_quick_mode_add_sub_op,cris_quick_mode_and_cmp_move_or_op,cris_quick_mode_bdap_prefix,cris_reg_mode_add_sub_cmp_and_or_move_op,cris_reg_mode_clear_op,cris_reg_mode_jump_op,cris_reg_mode_move_from_preg_op,cris_reg_mode_test_op,cris_scc_op,cris_sixteen_bit_offset_branch_op,cris_three_operand_add_sub_cmp_and_or_op,cris_three_operand_bound_op,cris_two_operand_bound_op,cris_xor_op};structcris_opcode{/* The name of the insn. */constchar*name;/* Bits that must be 1 for a match. */unsignedintmatch;/* Bits that must be 0 for a match. */unsignedintlose;/* See the table in "opcodes/cris-opc.c". */constchar*args;/* Nonzero if this is a delayed branch instruction. */chardelayed;/* Size of immediate operands. */enumcris_imm_oprnd_size_typeimm_oprnd_size;/* Indicates which version this insn was first implemented in. */enumcris_insn_version_usageapplicable_version;/* What kind of operation this is. */enumcris_op_typeop;};externconststructcris_opcodecris_opcodes[];/*Thesemacrosareforthetarget-specificflagsindisassemble_infousedatdisassembly.*//*Thisinsnaccessesmemory.Thisflagismoretrustworthythancheckinginsn_typefor"dis_dref"whichdoesnotworkfore.g."JSR [foo]".*/#defineCRIS_DIS_FLAG_MEMREF(1<<0)/* The "target" field holds a register number. */#defineCRIS_DIS_FLAG_MEM_TARGET_IS_REG(1<<1)/* The "target2" field holds a register number; add it to "target". */#defineCRIS_DIS_FLAG_MEM_TARGET2_IS_REG(1<<2)/*Yetanotheradd-on:theregisterin"target2"mustbemultipliedby2beforeaddingto"target".*/#defineCRIS_DIS_FLAG_MEM_TARGET2_MULT2(1<<3)/*Yetanotheradd-on:theregisterin"target2"mustbemultipliedby4(mutuallyexclusivewith.._MULT2).*/#defineCRIS_DIS_FLAG_MEM_TARGET2_MULT4(1<<4)/*Theregisterin"target2"isanindirectmemoryreference(oftheregisterthere),addto"target".Assumedsizeisdword(mutuallyexclusivewith.._MULT[24]).*/#defineCRIS_DIS_FLAG_MEM_TARGET2_MEM(1<<5)/*Add-ontoCRIS_DIS_FLAG_MEM_TARGET2_MEM;thememoryaccessis"byte";sign-extendedbeforeaddingto"target".*/#defineCRIS_DIS_FLAG_MEM_TARGET2_MEM_BYTE(1<<6)/*Add-ontoCRIS_DIS_FLAG_MEM_TARGET2_MEM;thememoryaccessis"word";sign-extendedbeforeaddingto"target".*/#defineCRIS_DIS_FLAG_MEM_TARGET2_MEM_WORD(1<<7)#endif/* __CRIS_H_INCLUDED_ *//**Localvariables:*eval:(c-set-style"gnu")*indent-tabs-mode:t*End:*/