#include <stdio.h>#include <sys/inst.h>#include "cmplrs/newinst.h"#include <disassembler.h>#include <string.h>#include "libelf.h"#include <elf.h>#include <errno.h>

Go to the source code of this file.
Defines | |
| #define | _MAD_MSB 1 |
| #define | ELF_ADDR Elf32_Addr |
| #define | ELF_WORD Elf32_Word |
| #define | F_DIS_INIT __dis_init32 |
| #define | F_REGISTER_NAME __register_name32 |
| #define | F_FP_REGISTER_NAME __fp_register_name32 |
| #define | F_C0_REGISTER_NAME __co_register_name32 |
| #define | F_Vec_REGISTER_NAME __disassembler_vec_register_name32 |
| #define | F_DISASM __disasm32 |
| #define | F_DIS_REGS __dis_regs32 |
| #define | F_DISASSEMBLER __disassembler32 |
| #define | DIS_REG_NAMES dis_reg_names32 |
| #define | HEXREG "0x%x" |
| #define | ZERO 0 |
| #define | private static |
| #define | true 1 |
| #define | false 0 |
| #define | ADDR_DEFAULT "%#010x\t" |
| #define | VALUE_DEFAULT "%#010x\t" |
| #define | NAME_DEFAULT COMPILER_NAMES |
Typedefs | |
| typedef int | boolean |
Functions/Subroutines | |
| int | dis_asm (char *, unsigned long long int) |
| int | F_DISASM (char *, ELF_ADDR, Elf32_Addr, Elf32_Addr *, ELF_ADDR *, Elf32_Addr *) |
| void | F_DIS_INIT (char *, char *, char *[], int) |
| char * | F_REGISTER_NAME (unsigned, Elf32_Addr *) |
| char * | F_C0_REGISTER_NAME (unsigned) |
| char * | F_FP_REGISTER_NAME (unsigned) |
| char * | F_Vec_REGISTER_NAME (unsigned r) |
| int | F_DISASSEMBLER (ELF_ADDR, int, char *(*get_symname)(unsigned), int(*get_regvalue)(unsigned), long(*get_bytes)(void), void(*print_header)(unsigned, unsigned)) |
Variables | |
| private char * | c1fmt_name [16] |
| type { | |
| char * addr_format | |
| char * value_format | |
| char ** reg_names | |
| int print_jal_targets | |
| } | save |
| static char * | op_name [64] |
| static char * | spec_name [64] |
| static char * | bcond_name [32] |
| static char * | cop1func_name [64] |
| static char * | bc_name [32] |
| static char * | c0func_name [64] |
| static char * | c0mfunc_name [64] |
| static char * | c0reg_name [32] |
| static char * | cop1xfunc_name [64] |
| static char * | cop2func_name [64] |
| char * | dis_reg_names [3][32] |
| #define _MAD_MSB 1 |
Definition at line 42 of file disassembler.c.
| #define ADDR_DEFAULT "%#010x\t" |
Definition at line 116 of file disassembler.c.
| #define DIS_REG_NAMES dis_reg_names32 |
Definition at line 90 of file disassembler.c.
| #define ELF_ADDR Elf32_Addr |
Definition at line 80 of file disassembler.c.
| #define ELF_WORD Elf32_Word |
Definition at line 81 of file disassembler.c.
| #define F_C0_REGISTER_NAME __co_register_name32 |
Definition at line 85 of file disassembler.c.
| #define F_DIS_INIT __dis_init32 |
| #define F_DIS_REGS __dis_regs32 |
| #define F_DISASM __disasm32 |
| #define F_DISASSEMBLER __disassembler32 |
Definition at line 89 of file disassembler.c.
| #define F_FP_REGISTER_NAME __fp_register_name32 |
Definition at line 84 of file disassembler.c.
| #define F_REGISTER_NAME __register_name32 |
Definition at line 83 of file disassembler.c.
| #define F_Vec_REGISTER_NAME __disassembler_vec_register_name32 |
Definition at line 86 of file disassembler.c.
| #define false 0 |
Definition at line 101 of file disassembler.c.
| #define HEXREG "0x%x" |
Definition at line 91 of file disassembler.c.
| #define NAME_DEFAULT COMPILER_NAMES |
Definition at line 118 of file disassembler.c.
| #define private static |
Definition at line 97 of file disassembler.c.
| #define true 1 |
Definition at line 100 of file disassembler.c.
| #define VALUE_DEFAULT "%#010x\t" |
Definition at line 117 of file disassembler.c.
| #define ZERO 0 |
Definition at line 96 of file disassembler.c.
| typedef int boolean |
Definition at line 99 of file disassembler.c.
| char* F_C0_REGISTER_NAME | ( | unsigned | ) |
| void F_DIS_INIT | ( | char * | , | |
| char * | , | |||
| char * | [], | |||
| int | ||||
| ) |
| int F_DISASM | ( | char * | , | |
| ELF_ADDR | , | |||
| Elf32_Addr | , | |||
| Elf32_Addr * | , | |||
| ELF_ADDR * | , | |||
| Elf32_Addr * | ||||
| ) |
| int F_DISASSEMBLER | ( | ELF_ADDR | iadr, | |
| int | regstyle, | |||
| char *(*)(unsigned) | get_symname, | |||
| int(*)(unsigned) | get_regvalue, | |||
| long(*)(void) | get_bytes, | |||
| void(*)(unsigned, unsigned) | print_header | |||
| ) |
Definition at line 1624 of file disassembler.c.
References ELF_ADDR, F_DIS_INIT, F_DIS_REGS, F_DISASM, print_header(), puts(), sprintf(), strcat(), and strlen().
| char* F_FP_REGISTER_NAME | ( | unsigned | ) |
| char* F_REGISTER_NAME | ( | unsigned | , | |
| Elf32_Addr * | ||||
| ) |
| char* F_Vec_REGISTER_NAME | ( | unsigned | r | ) |
| char* addr_format |
Definition at line 121 of file disassembler.c.
char* bc_name[32] [static] |
Initial value:
{
"f", "t", "fl", "tl",
"x04", "x05", "x06", "x07",
"x08", "x09", "x0a", "x0b",
"x0c", "x0d", "x0e", "x0f",
"x10", "x11", "x12", "x13",
"x14", "x15", "x16", "x17",
"x18", "x19", "x1a", "x1b",
"x1c", "x1d", "x1e", "x1f"
}
Definition at line 178 of file disassembler.c.
char* bcond_name[32] [static] |
Initial value:
{
"bltz", "bgez", "bltzl", "bgezl",
"spimi", "bcond05", "bcond06", "bcond07",
"tgei", "tgeiu", "tlti", "tltiu",
"teqi", "bcond0d", "tnei", "bcond0f",
"bltzal", "bgezal", "bltzall", "bgezall",
"bcond14", "bcond15", "bcond16", "bcond17",
"bcond18", "bcond19", "bcond1a", "bcond1b",
"bcond1c", "bcond1d", "bcond1e", "bcond1f"
}
Definition at line 155 of file disassembler.c.
char* c0func_name[64] [static] |
Initial value:
{
"op00", "tlbr", "tlbwi","op03", "op04", "op05", "tlbwr","op07",
"tlbp", "op9", "op10", "op11", "op12", "op13", "op14", "op15",
"rfe", "op17", "op18", "op19", "op20", "op21", "op22", "op23",
"eret", "op25", "op26", "op27", "op28", "op29", "op30", "op31",
"op32", "op33", "op34", "op35", "op36", "op37", "op38", "op39",
"op40", "op41", "op42", "op43", "op44", "op45", "op46", "op47",
"op48", "op49", "op50", "op51", "op52", "op53", "op54", "op55",
"op56", "op57", "op58", "op59", "op60", "op61", "op62", "op63"
}
Definition at line 189 of file disassembler.c.
char* c0mfunc_name[64] [static] |
Initial value:
{
"c0m00", "tlbr1", "tlbw", "c0m03", "c0m04", "c0m05", "c0m06", "c0m07",
"tlbp1", "dctr", "dctw", "c0m11", "c0m12", "c0m13", "c0m14", "c0m15",
"c0m16", "c0m17", "c0m18", "c0m19", "c0m20", "c0m21", "c0m22", "c0m23",
"c0m24", "c0m25", "c0m26", "c0m27", "c0m28", "c0m29", "c0m30", "c0m31",
"c0m32", "c0m33", "c0m34", "c0m35", "c0m36", "c0m37", "c0m38", "c0m39",
"c0m40", "c0m41", "c0m42", "c0m43", "c0m44", "c0m45", "c0m46", "c0m47",
"c0m48", "c0m49", "c0m50", "c0m51", "c0m52", "c0m53", "c0m54", "c0m55",
"c0m56", "c0m57", "c0m58", "c0m59", "c0m60", "c0m61", "c0m62", "c0m63"
}
Definition at line 200 of file disassembler.c.
char* c0reg_name[32] [static] |
Initial value:
{
"index","random","tlblo","tlblo1","context","pagemask","wired","c0r7",
"badvaddr","count","tlbhi","compare","sr", "cause","epc", "prid",
"config","lladdr","watchlo","watchhi","c0r20","c0r21","c0r22","c0r23",
"c0r24","c0r25","ecc","cacheerr","taglo","taghi","errorepc","c0r31"
}
Definition at line 211 of file disassembler.c.
| private char* c1fmt_name[16] |
Initial value:
{
"s", "d", "e", "q",
"w", "l", "ps", "fmt7",
"fmt8", "fmt9", "fmta", "fmtb",
"fmtc", "fmtd", "fmte", "fmtf"
}
Definition at line 103 of file disassembler.c.
char* cop1func_name[64] [static] |
Initial value:
{
"add", "sub", "mul", "div", "sqrt", "abs", "mov", "neg",
"round.l", "trunc.l", "ceil.l", "floor.l",
"round.w", "trunc.w", "ceil.w", "floor.w",
"fop10", "mov", "movz", "movn", "fop14", "recip", "rsqrt", "fop17",
"fop18", "fop19", "fop1a", "fop1b", "fop1c", "fop1d", "fop1e", "fop1f",
"cvt.s", "cvt.d", "cvt.e", "fop23", "cvt.w", "cvt.l", "cvt.ps", "fop27",
"cvt.s.pu", "fop29", "fop2a", "fop2b", "pll", "plu", "pul", "puu",
"c.f", "c.un", "c.eq", "c.ueq", "c.olt", "c.ult", "c.ole", "c.ule",
"c.sf", "c.ngle","c.seq", "c.ngl", "c.lt", "c.nge", "c.le", "c.ngt"
}
Definition at line 166 of file disassembler.c.
char* cop1xfunc_name[64] [static] |
Initial value:
{
"lwxc1", "ldxc1", "c1x02", "c1x03", "c1x04", "luxc1", "c1x06", "pfetch",
"swxc1", "sdxc1", "c1x10", "c1x11", "c1x12", "suxc1", "c1x14", "prefx",
"c1x16", "c1x17", "c1x18", "c1x19", "c1x20", "c1x21", "c1x22", "c1x23",
"c1x24", "c1x25", "c1x26", "c1x27", "alnv.ps", "c1x29", "c1x30", "c1x31",
"madd.s", "madd.d", "madd.e", "c1x35", "c1x36", "c1x37", "madd.ps", "c1x39",
"msub.s", "msub.d", "msub.e", "c1x43", "c1x44", "c1x45", "msub.ps", "c1x47",
"nmadd.s","nmadd.d","nmadd.e","c1x51", "c1x52", "c1x53", "nmadd.ps", "c1x55",
"nmsub.s","nmsub.d","nmsub.e","c1x59", "c1x60", "c1x61", "nmsub.ps", "c1x63",
}
Definition at line 218 of file disassembler.c.
char* cop2func_name[64] [static] |
Initial value:
{
"msgn", "c.eq", "pickf", "pickt", "c.lt", "c.le", "min", "max",
"c2x8", "c2x9", "sub", "add", "and", "xor", "or", "nor",
"sll", "c2x17", "srl", "sra", "c2x20", "c2x21", "c2x22", "c2x23",
"alni.ob", "alnv.ob", "alni.qh", "alnv.qh", "c2x28", "c2x29", "c2x30", "shfl",
"rzu", "rnau", "rneu", "c2x35", "rzs", "rnas", "rnes", "c2x39",
"c2x40", "c2x41", "c2x42", "c2x43", "c2x44", "c2x45", "c2x46", "c2x47",
"mul", "c2x49", "muls", "mul", "c2x52", "c2x53", "sub", "add",
"c2x56", "c2x57","c2x58", "c2x59", "c2x60", "c2x61", "wac", "rac"
}
Definition at line 229 of file disassembler.c.
| char* dis_reg_names[3][32] |
Initial value:
{
{
"zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
"s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
"t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra"
},
{
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
"r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31"
},
{
"$0", "$at", "$2", "$3", "$4", "$5", "$6", "$7",
"$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15",
"$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23",
"$24", "$25", "$26", "$27", "$gp", "$sp", "$30", "$31"
}
}
Definition at line 243 of file disassembler.c.
char* op_name[64] [static] |
Initial value:
{
"spec", "bcond", "j", "jal", "beq", "bne", "blez", "bgtz",
"addi", "addiu", "slti", "sltiu", "andi", "ori", "xori", "lui",
"cop0", "cop1", "cop2", "op13", "beql", "bnel", "blezl", "bgtzl",
"daddi", "daddiu","ldl", "ldr", "op1c", "op1d", "op1e", "op1f",
"lb", "lh", "lwl", "lw", "lbu", "lhu", "lwr", "lwu",
"sb", "sh", "swl", "sw", "sdl", "sdr", "swr", "cache",
"ll", "lwc1", "lwc2", "pref", "lld", "ldc1", "ldc2", "ld",
"sc", "swc1", "swc2", "op3b", "scd", "sdc1", "sdc2", "sd"
}
Definition at line 133 of file disassembler.c.
Referenced by _dwarf_print_one_locdesc(), c_sizeof_or_alignof_type(), CGEMIT_Print_Inst(), cxx_sizeof_or_alignof_expr(), cxx_sizeof_or_alignof_type(), LNOTARGET_Int_Mult_Res(), and Print_FU_Class().
Definition at line 124 of file disassembler.c.
| char** reg_names |
Definition at line 123 of file disassembler.c.
| private { ... } save |
Referenced by build_array_type(), build_instanceof(), CGGRP_Bundle(), check_init(), cp_parser_begin_omp_structured_block(), cp_parser_omp_for(), cp_parser_omp_parallel(), cp_parser_omp_sections_scope(), cp_parser_omp_structured_block(), dump_region_tree(), dump_wn(), fdump_region_tree(), fdump_tree(), fdump_tree_with_alias(), fdump_tree_with_freq(), fdump_wn(), fdump_wn_no_st(), fei_opaque(), fei_purple_conditional(), fei_purple_unconditional(), find_index_and_offset(), fold_binary_op_with_conditional_arg(), i860_saveregs(), ieee_archive_p(), ieee_object_p(), interpret_constructor(), interpret_reshape_intrinsic(), interpret_struct_construct_opr(), interpret_transfer_intrinsic(), IR_put_func(), Is_Permutation_Vector(), oasys_object_p(), Post_Multi_Branch(), ppc64_elf_hide_symbol(), process_command(), remove_ssa_form(), Save_And_Restore_Stack(), spec_path(), variable_size(), WN_TREE_fdump_tree(), WN_TREE_put_func(), xlt_verdef(), and xlt_verneed().
char* spec_name[64] [static] |
Initial value:
{
"sll", "mov", "srl", "sra", "sllv", "spec05","srlv", "srav",
"jr", "jalr", "movz", "movn", "syscall","break","spim", "sync",
"mfhi", "mthi", "mflo", "mtlo", "dsllv","spec15","dsrlv", "dsrav",
"mult", "multu", "div", "divu", "dmult", "dmultu","ddiv", "ddivu",
"add", "addu", "sub", "subu", "and", "or", "xor", "nor",
"spec28","spec29","slt", "sltu", "dadd", "daddu", "dsub", "dsubu",
"tge", "tgeu", "tlt", "tltu", "teq", "spec35","tne", "spec37",
"dsll", "spec39","dsrl", "dsra", "dsll32", "spec3d","dsrl32", "dsra32"
}
Definition at line 144 of file disassembler.c.
| char* value_format |
Definition at line 122 of file disassembler.c.
1.5.6