disasm(3E)
dis_init, dis_init32, dis_init64, dis_regs, dis_regs32, dis_regs64, disasm, disasm32, disasm64, disassembler32, disassembler64 - disassembler functions
As shipped in IRIX 6.5. First release of IRIX 6.5.
NAME dis_init, dis_init32, dis_init64, dis_regs, dis_regs32, dis_regs64, disasm, disasm32, disasm64, disassembler32, disassembler64 - disassembler functions SYNOPSIS #include <disassembler.h> void dis_init (char *addr_format,char *value_format, char *reg_names[],int print_jal_targets); void dis_init32 (char *addr_format,char *value_format, char *reg_names[],int print_jal_targets); void dis_init64 (char *addr_format,char *value_format, char *reg_names[],int print_jal_targets); void dis_regs(char *buffer,unsigned regmask, unsigned reg_values[]); void dis_regs32(char *buffer,unsigned regmask, unsigned reg_values[]); void dis_regs64(char *buffer,unsigned regmask, __uint64_t reg_values[]); int disasm(char *buffer,Elf32_Addr address,Elf32_Addr iword, Elf32_Addr *regmask,Elf32_Addr *symbol_value, Elf32_Addr *ls_register); int disasm32(char *buffer,Elf32_Addr address,Elf32_Addr iword, Elf32_Addr *regmask,Elf32_Addr *symbol_value, Elf32_Addr *ls_register); int disasm64(char *buffer,Elf64_Addr address, Elf32_Addr iword, Elf32_Addr *regmask,Elf64_Addr *symbol_value, Elf32_Addr *ls_register); int disassembler(Elf32_Addr iadr, int regstyle, char *(*get_symname)(),int (*get_regvalue)(), long (*get_bytes)(), void (*print_header)()); int disassembler32(Elf32_Addr iadr, int regstyle, char *(*get_symname)(),int (*get_regvalue)(), long (*get_bytes)(), void (*print_header)()); int disassembler64(__uint64_t iadr, int regstyle, char *(*get_symname)(),int (*get_regvalue)(), long (*get_bytes)(), void (*print_header)()); DESCRIPTION Three sets of register names which people might want to use: compiler: zero, at, v0, ... hardware: r0, r1, r2, ... assembler: $0, $at, $2,... dis_init, dis_init32, and dis_init64 functions initialize disassembler and set options for disassembly. "addr_format" and "value_format" specify in the style of "printf" the null-terminated formats for printing the address and value of the instruction. If nil, they default to "%#010x"; if they are the empty string, we omit to print these items. "reg_names" is a pointer to an array of 32 strings which we will use to represent the general-purpose registers. The *_NAMES macros above give three common choices; if nil, we use compiler names. print_jal_targets tells us whether to print the targets of jal instructions numerically. dis_regs, dis_regs32, and dis_regs64 functions Given a null-terminated buffer (presumably from "disasm"), we append an ascii representation of register values in the form "<$5=0x50,$7=0x44,...>". "regmask" is a bitmask of registers as in "disasm", "reg_values" an array (with empty slots for the registers not indicated in the mask) of their values. disasm, disasm32, and disasm64 functions Disassemble instruction, putting null-terminated result into "buffer" (no trailing newline). Details governed by "dis_init". buffer: array of characters allocated by the caller; 64 bytes should be more than enough. address: byte address. iword: the instruction. regmask: returns a bitmask of the gp registers the instruction uses, with the LSB indicating register 0 regardless of endianness. symbol_value: for a jal instruction, the target value; for a load or store, the immediate value. ls_register: for a load or store, the number of the base register. return value: -1 for a load or store, 1 for a jal, 2 for a j, jr, jalr, or branch, 0 for other. disassembler, disassembler32, and disassembler64 functions Older interface, which always prints on stdout. SEE ALSO disassembler(3X),