Print this page
saveargs: Implement as libsaveargs
saveargs: let disasm do the lifting

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libdisasm/sparc/dis_sparc.c
          +++ new/usr/src/lib/libdisasm/sparc/dis_sparc.c
↓ open down ↓ 21 lines elided ↑ open up ↑
  22   22  /*
  23   23   * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27   27  /*
  28   28   * Copyright 2007 Jason King.  All rights reserved.
  29   29   * Use is subject to license terms.
  30   30   */
  31   31  
  32      -
  33      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  34      -
  35   32  /*
  36   33   * The sparc disassembler is mostly straightforward, each instruction is
  37   34   * represented by an inst_t structure.  The inst_t definitions are organized
  38   35   * into tables.  The tables are correspond to the opcode maps documented in the
  39   36   * various sparc architecture manuals.  Each table defines the bit range of the
  40   37   * instruction whose value act as an index into the array of instructions.  A
  41   38   * table can also refer to another table if needed.  Each table also contains
  42   39   * a function pointer of type format_fcn that knows how to output the
  43   40   * instructions in the table, as well as handle any synthetic instructions
  44   41   *
↓ open down ↓ 177 lines elided ↑ open up ↑
 222  219  {
 223  220          if (n <= 0)
 224  221                  return (pc);
 225  222  
 226  223          if (pc < n)
 227  224                  return (pc);
 228  225  
 229  226          return (pc - n*4);
 230  227  }
 231  228  
      229 +/* ARGSUSED */
      230 +int
      231 +dis_instrlen(dis_handle_t *dhp, uint64_t pc)
      232 +{
      233 +        return (4);
      234 +}
      235 +
 232  236  int
 233  237  dis_disassemble(dis_handle_t *dhp, uint64_t addr, char *buf, size_t buflen)
 234  238  {
 235  239          const table_t *tp = &initial_table;
 236  240          const inst_t *inp = NULL;
 237  241  
 238  242          uint32_t instr;
 239  243          uint32_t idx = 0;
 240  244  
 241  245          if (dhp->dh_read(dhp->dh_data, addr, &instr, sizeof (instr)) !=
↓ open down ↓ 98 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX