📄 tc-arm.c
字号:
static const struct reg_entry dn_table[] ={ {"d0", 0}, {"d1", 1}, {"d2", 2}, {"d3", 3}, {"d4", 4}, {"d5", 5}, {"d6", 6}, {"d7", 7}, {"d8", 8}, {"d9", 9}, {"d10", 10}, {"d11", 11}, {"d12", 12}, {"d13", 13}, {"d14", 14}, {"d15", 15}, {NULL, 0}};/* Maverick DSP coprocessor registers. */static const struct reg_entry mav_mvf_table[] ={ {"mvf0", 0}, {"mvf1", 1}, {"mvf2", 2}, {"mvf3", 3}, {"mvf4", 4}, {"mvf5", 5}, {"mvf6", 6}, {"mvf7", 7}, {"mvf8", 8}, {"mvf9", 9}, {"mvf10", 10}, {"mvf11", 11}, {"mvf12", 12}, {"mvf13", 13}, {"mvf14", 14}, {"mvf15", 15}, {NULL, 0}};static const struct reg_entry mav_mvd_table[] ={ {"mvd0", 0}, {"mvd1", 1}, {"mvd2", 2}, {"mvd3", 3}, {"mvd4", 4}, {"mvd5", 5}, {"mvd6", 6}, {"mvd7", 7}, {"mvd8", 8}, {"mvd9", 9}, {"mvd10", 10}, {"mvd11", 11}, {"mvd12", 12}, {"mvd13", 13}, {"mvd14", 14}, {"mvd15", 15}, {NULL, 0}};static const struct reg_entry mav_mvfx_table[] ={ {"mvfx0", 0}, {"mvfx1", 1}, {"mvfx2", 2}, {"mvfx3", 3}, {"mvfx4", 4}, {"mvfx5", 5}, {"mvfx6", 6}, {"mvfx7", 7}, {"mvfx8", 8}, {"mvfx9", 9}, {"mvfx10", 10}, {"mvfx11", 11}, {"mvfx12", 12}, {"mvfx13", 13}, {"mvfx14", 14}, {"mvfx15", 15}, {NULL, 0}};static const struct reg_entry mav_mvdx_table[] ={ {"mvdx0", 0}, {"mvdx1", 1}, {"mvdx2", 2}, {"mvdx3", 3}, {"mvdx4", 4}, {"mvdx5", 5}, {"mvdx6", 6}, {"mvdx7", 7}, {"mvdx8", 8}, {"mvdx9", 9}, {"mvdx10", 10}, {"mvdx11", 11}, {"mvdx12", 12}, {"mvdx13", 13}, {"mvdx14", 14}, {"mvdx15", 15}, {NULL, 0}};static const struct reg_entry mav_mvax_table[] ={ {"mvax0", 0}, {"mvax1", 1}, {"mvax2", 2}, {"mvax3", 3}, {NULL, 0}};static const struct reg_entry mav_dspsc_table[] ={ {"dspsc", 0}, {NULL, 0}};struct reg_map{ const struct reg_entry *names; int max_regno; struct hash_control *htab; const char *expected;};struct reg_map all_reg_maps[] ={ {rn_table, 15, NULL, N_("ARM register expected")}, {cp_table, 15, NULL, N_("bad or missing co-processor number")}, {cn_table, 15, NULL, N_("co-processor register expected")}, {fn_table, 7, NULL, N_("FPA register expected")}, {sn_table, 31, NULL, N_("VFP single precision register expected")}, {dn_table, 15, NULL, N_("VFP double precision register expected")}, {mav_mvf_table, 15, NULL, N_("Maverick MVF register expected")}, {mav_mvd_table, 15, NULL, N_("Maverick MVD register expected")}, {mav_mvfx_table, 15, NULL, N_("Maverick MVFX register expected")}, {mav_mvdx_table, 15, NULL, N_("Maverick MVFX register expected")}, {mav_mvax_table, 3, NULL, N_("Maverick MVAX register expected")}, {mav_dspsc_table, 0, NULL, N_("Maverick DSPSC register expected")},};/* Enumeration matching entries in table above. */enum arm_reg_type{ REG_TYPE_RN = 0,#define REG_TYPE_FIRST REG_TYPE_RN REG_TYPE_CP = 1, REG_TYPE_CN = 2, REG_TYPE_FN = 3, REG_TYPE_SN = 4, REG_TYPE_DN = 5, REG_TYPE_MVF = 6, REG_TYPE_MVD = 7, REG_TYPE_MVFX = 8, REG_TYPE_MVDX = 9, REG_TYPE_MVAX = 10, REG_TYPE_DSPSC = 11, REG_TYPE_MAX = 12};/* Functions called by parser. *//* ARM instructions. */static void do_arit PARAMS ((char *));static void do_cmp PARAMS ((char *));static void do_mov PARAMS ((char *));static void do_ldst PARAMS ((char *));static void do_ldstt PARAMS ((char *));static void do_ldmstm PARAMS ((char *));static void do_branch PARAMS ((char *));static void do_swi PARAMS ((char *));/* Pseudo Op codes. */static void do_adr PARAMS ((char *));static void do_adrl PARAMS ((char *));static void do_empty PARAMS ((char *));/* ARM v2. */static void do_mul PARAMS ((char *));static void do_mla PARAMS ((char *));/* ARM v2S. */static void do_swap PARAMS ((char *));/* ARM v3. */static void do_msr PARAMS ((char *));static void do_mrs PARAMS ((char *));/* ARM v3M. */static void do_mull PARAMS ((char *));/* ARM v4. */static void do_ldstv4 PARAMS ((char *));/* ARM v4T. */static void do_bx PARAMS ((char *));/* ARM v5T. */static void do_blx PARAMS ((char *));static void do_bkpt PARAMS ((char *));static void do_clz PARAMS ((char *));static void do_lstc2 PARAMS ((char *));static void do_cdp2 PARAMS ((char *));static void do_co_reg2 PARAMS ((char *));/* ARM v5TExP. */static void do_smla PARAMS ((char *));static void do_smlal PARAMS ((char *));static void do_smul PARAMS ((char *));static void do_qadd PARAMS ((char *));/* ARM v5TE. */static void do_pld PARAMS ((char *));static void do_ldrd PARAMS ((char *));static void do_co_reg2c PARAMS ((char *));/* ARM v5TEJ. */static void do_bxj PARAMS ((char *));/* Coprocessor Instructions. */static void do_cdp PARAMS ((char *));static void do_lstc PARAMS ((char *));static void do_co_reg PARAMS ((char *));/* FPA instructions. */static void do_fpa_ctrl PARAMS ((char *));static void do_fpa_ldst PARAMS ((char *));static void do_fpa_ldmstm PARAMS ((char *));static void do_fpa_dyadic PARAMS ((char *));static void do_fpa_monadic PARAMS ((char *));static void do_fpa_cmp PARAMS ((char *));static void do_fpa_from_reg PARAMS ((char *));static void do_fpa_to_reg PARAMS ((char *));/* VFP instructions. */static void do_vfp_sp_monadic PARAMS ((char *));static void do_vfp_dp_monadic PARAMS ((char *));static void do_vfp_sp_dyadic PARAMS ((char *));static void do_vfp_dp_dyadic PARAMS ((char *));static void do_vfp_reg_from_sp PARAMS ((char *));static void do_vfp_sp_from_reg PARAMS ((char *));static void do_vfp_sp_reg2 PARAMS ((char *));static void do_vfp_reg_from_dp PARAMS ((char *));static void do_vfp_reg2_from_dp PARAMS ((char *));static void do_vfp_dp_from_reg PARAMS ((char *));static void do_vfp_dp_from_reg2 PARAMS ((char *));static void do_vfp_reg_from_ctrl PARAMS ((char *));static void do_vfp_ctrl_from_reg PARAMS ((char *));static void do_vfp_sp_ldst PARAMS ((char *));static void do_vfp_dp_ldst PARAMS ((char *));static void do_vfp_sp_ldstmia PARAMS ((char *));static void do_vfp_sp_ldstmdb PARAMS ((char *));static void do_vfp_dp_ldstmia PARAMS ((char *));static void do_vfp_dp_ldstmdb PARAMS ((char *));static void do_vfp_xp_ldstmia PARAMS ((char *));static void do_vfp_xp_ldstmdb PARAMS ((char *));static void do_vfp_sp_compare_z PARAMS ((char *));static void do_vfp_dp_compare_z PARAMS ((char *));static void do_vfp_dp_sp_cvt PARAMS ((char *));static void do_vfp_sp_dp_cvt PARAMS ((char *));/* XScale. */static void do_xsc_mia PARAMS ((char *));static void do_xsc_mar PARAMS ((char *));static void do_xsc_mra PARAMS ((char *));/* Maverick. */static void do_mav_binops PARAMS ((char *, int, enum arm_reg_type, enum arm_reg_type));static void do_mav_binops_1a PARAMS ((char *));static void do_mav_binops_1b PARAMS ((char *));static void do_mav_binops_1c PARAMS ((char *));static void do_mav_binops_1d PARAMS ((char *));static void do_mav_binops_1e PARAMS ((char *));static void do_mav_binops_1f PARAMS ((char *));static void do_mav_binops_1g PARAMS ((char *));static void do_mav_binops_1h PARAMS ((char *));static void do_mav_binops_1i PARAMS ((char *));static void do_mav_binops_1j PARAMS ((char *));static void do_mav_binops_1k PARAMS ((char *));static void do_mav_binops_1l PARAMS ((char *));static void do_mav_binops_1m PARAMS ((char *));static void do_mav_binops_1n PARAMS ((char *));static void do_mav_binops_1o PARAMS ((char *));static void do_mav_binops_2a PARAMS ((char *));static void do_mav_binops_2b PARAMS ((char *));static void do_mav_binops_2c PARAMS ((char *));static void do_mav_binops_3a PARAMS ((char *));static void do_mav_binops_3b PARAMS ((char *));static void do_mav_binops_3c PARAMS ((char *));static void do_mav_binops_3d PARAMS ((char *));static void do_mav_triple PARAMS ((char *, int, enum arm_reg_type, enum arm_reg_type, enum arm_reg_type));static void do_mav_triple_4a PARAMS ((char *));static void do_mav_triple_4b PARAMS ((char *));static void do_mav_triple_5a PARAMS ((char *));static void do_mav_triple_5b PARAMS ((char *));static void do_mav_triple_5c PARAMS ((char *));static void do_mav_triple_5d PARAMS ((char *));static void do_mav_triple_5e PARAMS ((char *));static void do_mav_triple_5f PARAMS ((char *));static void do_mav_triple_5g PARAMS ((char *));static void do_mav_triple_5h PARAMS ((char *));static void do_mav_quad PARAMS ((char *, int, enum arm_reg_type, enum arm_reg_type, enum arm_reg_type, enum arm_reg_type));static void do_mav_quad_6a PARAMS ((char *));static void do_mav_quad_6b PARAMS ((char *));static void do_mav_dspsc_1 PARAMS ((char *));static void do_mav_dspsc_2 PARAMS ((char *));static void do_mav_shift PARAMS ((char *, enum arm_reg_type, enum arm_reg_type));static void do_mav_shift_1 PARAMS ((char *));static void do_mav_shift_2 PARAMS ((char *));static void do_mav_ldst PARAMS ((char *, enum arm_reg_type));static void do_mav_ldst_1 PARAMS ((char *));static void do_mav_ldst_2 PARAMS ((char *));static void do_mav_ldst_3 PARAMS ((char *));static void do_mav_ldst_4 PARAMS ((char *));static int mav_reg_required_here PARAMS ((char **, int, enum arm_reg_type));static int mav_parse_offset PARAMS ((char **, int *));static void fix_new_arm PARAMS ((fragS *, int, short, expressionS *, int, int));static int arm_reg_parse PARAMS ((char **, struct hash_control *));static enum arm_reg_type arm_reg_parse_any PARAMS ((char *));static const struct asm_psr * arm_psr_parse PARAMS ((char **));static void symbol_locate PARAMS ((symbolS *, const char *, segT, valueT, fragS *));static int add_to_lit_pool PARAMS ((void));static unsigned validate_immediate PARAMS ((unsigned));static unsigned validate_immediate_twopart PARAMS ((unsigned int, unsigned int *));static int validate_offset_imm PARAMS ((unsigned int, int));static void opcode_select PARAMS ((int));static void end_of_line PARAMS ((char *));static int reg_required_here PARAMS ((char **, int));static int psr_required_here PARAMS ((char **));static int co_proc_number PARAMS ((char **));static int cp_opc_expr PARAMS ((char **, int, int));static int cp_reg_required_here PARAMS ((char **, int));static int fp_reg_required_here PARAMS ((char **, int));static int vfp_sp_reg_required_here PARAMS ((char **, enum vfp_sp_reg_pos));static int vfp_dp_reg_required_here PARAMS ((char **, enum vfp_dp_reg_pos));static void vfp_sp_ldstm PARAMS ((char *, enum vfp_ldstm_type));static void vfp_dp_ldstm PARAMS ((char *, enum vfp_ldstm_type));static long vfp_sp_reg_list PARAMS ((char **, enum vfp_sp_reg_pos));static long vfp_dp_reg_list PARAMS ((char **));static int vfp_psr_required_here PARAMS ((char **str));static const struct vfp_reg *vfp_psr_parse PARAMS ((char **str));static int cp_address_offset PARAMS ((char **));static int cp_address_required_here PARAMS ((char **, int));static int my_get_float_expression PARAMS ((char **));static int skip_past_comma PARAMS ((char **));static int walk_no_bignums PARAMS ((symbolS *));static int negate_data_op PARAMS ((unsigned long *, unsigned long));static int data_op2 PARAMS ((char **));static int fp_op2 PARAMS ((char **));static long reg_list PARAMS ((char **));static void thumb_load_store PARAMS ((char *, int, int));static int decode_shift PARAMS ((char **, int));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -