home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / standard / disasm.z / disasm
Encoding:
Text File  |  1998-10-30  |  5.9 KB  |  199 lines

  1.  
  2.  
  3.  
  4. DDDDIIIISSSSAAAASSSSMMMM((((3333EEEE))))                                                          DDDDIIIISSSSAAAASSSSMMMM((((3333EEEE))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      dis_init, dis_init32, dis_init64, dis_regs, dis_regs32, dis_regs64,
  10.      disasm, disasm32, disasm64, disassembler32, disassembler64 - disassembler
  11.      functions
  12.  
  13. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  14.      ####iiiinnnncccclllluuuuddddeeee <<<<ddddiiiissssaaaasssssssseeeemmmmbbbblllleeeerrrr....hhhh>>>>
  15.  
  16.      void dis_init (char *addr_format,char *value_format,
  17.                     char *reg_names[],int print_jal_targets);
  18.  
  19.      void dis_init32 (char *addr_format,char *value_format,
  20.                     char *reg_names[],int print_jal_targets);
  21.  
  22.      void dis_init64 (char *addr_format,char *value_format,
  23.                     char *reg_names[],int print_jal_targets);
  24.  
  25.      void dis_regs(char *buffer,unsigned regmask,
  26.                     unsigned reg_values[]);
  27.  
  28.      void dis_regs32(char *buffer,unsigned regmask,
  29.                     unsigned reg_values[]);
  30.  
  31.      void dis_regs64(char *buffer,unsigned regmask,
  32.                      __uint64_t reg_values[]);
  33.  
  34.      int disasm(char *buffer,Elf32_Addr address,Elf32_Addr iword,
  35.                 Elf32_Addr *regmask,Elf32_Addr *symbol_value,
  36.                 Elf32_Addr *ls_register);
  37.  
  38.      int disasm32(char *buffer,Elf32_Addr address,Elf32_Addr iword,
  39.                   Elf32_Addr *regmask,Elf32_Addr *symbol_value,
  40.                   Elf32_Addr *ls_register);
  41.  
  42.      int disasm64(char *buffer,Elf64_Addr address, Elf32_Addr iword,
  43.                   Elf32_Addr *regmask,Elf64_Addr *symbol_value,
  44.                   Elf32_Addr *ls_register);
  45.  
  46.      int disassembler(Elf32_Addr iadr, int regstyle,
  47.                 char *(*get_symname)(),int (*get_regvalue)(),
  48.                       long (*get_bytes)(), void (*print_header)());
  49.  
  50.      int disassembler32(Elf32_Addr iadr, int regstyle,
  51.                 char *(*get_symname)(),int (*get_regvalue)(),
  52.                       long (*get_bytes)(), void (*print_header)());
  53.  
  54.      int disassembler64(__uint64_t iadr, int regstyle,
  55.                   char *(*get_symname)(),int (*get_regvalue)(),
  56.                         long (*get_bytes)(), void (*print_header)());
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. DDDDIIIISSSSAAAASSSSMMMM((((3333EEEE))))                                                          DDDDIIIISSSSAAAASSSSMMMM((((3333EEEE))))
  71.  
  72.  
  73.  
  74. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  75.      Three sets of register names which people might want to use:
  76.      ccccoooommmmppppiiiilllleeeerrrr:::: zzzzeeeerrrroooo,,,, aaaatttt,,,, vvvv0000,,,, ............
  77.      hhhhaaaarrrrddddwwwwaaaarrrreeee:::: rrrr0000,,,, rrrr1111,,,, rrrr2222,,,, ............
  78.      aaaasssssssseeeemmmmbbbblllleeeerrrr:::: $$$$0000,,,, $$$$aaaatttt,,,, $$$$2222,,,,............
  79.  
  80.      _d_i_s__i_n_i_t, _d_i_s__i_n_i_t_3_2, and _d_i_s__i_n_i_t_6_4 functions initialize disassembler
  81.      and set options for disassembly.  "addr_format" and "value_format"
  82.      specify in the style of "printf" the null-terminated formats for printing
  83.      the address and value of the instruction. If nil, they default to
  84.      "%#010x"; if they are the empty string, we omit to print these items.
  85.  
  86.      "reg_names" is a pointer to an array of 32 strings which we will use to
  87.      represent the general-purpose registers. The *_NAMES macros above give
  88.      three common choices; if nil, we use compiler names.
  89.  
  90.      print_jal_targets tells us whether to print the targets of jal
  91.      instructions numerically.
  92.  
  93.      _d_i_s__r_e_g_s, _d_i_s__r_e_g_s_3_2, and _d_i_s__r_e_g_s_6_4 functions Given a null-terminated
  94.      buffer (presumably from "disasm"), we append an ascii representation of
  95.      register values in the form "<$5=0x50,$7=0x44,...>".
  96.  
  97.      "regmask" is a bitmask of registers as in "disasm", "reg_values" an array
  98.      (with empty slots for the registers not indicated in the mask) of their
  99.      values.
  100.  
  101.      _d_i_s_a_s_m, _d_i_s_a_s_m_3_2, and _d_i_s_a_s_m_6_4 functions Disassemble instruction, putting
  102.      null-terminated result into "buffer" (no trailing newline). Details
  103.      governed by "dis_init".
  104.  
  105.      buffer: array of characters allocated by the caller; 64 bytes should be
  106.      more than enough.
  107.  
  108.      address: byte address.
  109.  
  110.      iword: the instruction.
  111.  
  112.      regmask: returns a bitmask of the gp registers the instruction uses, with
  113.      the LSB indicating register 0 regardless of endianness.
  114.  
  115.      symbol_value: for a jal instruction, the target value; for a load or
  116.      store, the immediate value.
  117.  
  118.      ls_register: for a load or store, the number of the base register.
  119.  
  120.      return value: -1 for a load or store, 1 for a jal, 2 for a j, jr, jalr,
  121.      or branch, 0 for other.
  122.  
  123.      _d_i_s_a_s_s_e_m_b_l_e_r, _d_i_s_a_s_s_e_m_b_l_e_r_3_2, and _d_i_s_a_s_s_e_m_b_l_e_r_6_4 functions Older
  124.      interface, which always prints on stdout.
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. DDDDIIIISSSSAAAASSSSMMMM((((3333EEEE))))                                                          DDDDIIIISSSSAAAASSSSMMMM((((3333EEEE))))
  137.  
  138.  
  139.  
  140. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  141.      disassembler(3X),
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.