Print this page
3317 dis(1) should support cross-target disassembly

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libdisasm/common/libdisasm_impl.h
          +++ new/usr/src/lib/libdisasm/common/libdisasm_impl.h
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
       25 + * Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
  25   26   */
  26   27  
  27   28  #ifndef _LIBDISASM_IMPL_H
  28   29  #define _LIBDISASM_IMPL_H
  29   30  
  30      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  31      -
  32   31  #ifdef  __cplusplus
  33   32  extern "C" {
  34   33  #endif
  35   34  
       35 +typedef struct dis_arch {
       36 +        int (*da_supports_flags)(int);
       37 +        int (*da_handle_attach)(dis_handle_t *);
       38 +        void (*da_handle_detach)(dis_handle_t *);
       39 +        int (*da_disassemble)(dis_handle_t *, uint64_t, char *, size_t);
       40 +        uint64_t (*da_previnstr)(dis_handle_t *, uint64_t, int n);
       41 +        int (*da_min_instrlen)(dis_handle_t *);
       42 +        int (*da_max_instrlen)(dis_handle_t *);
       43 +        int (*da_instrlen)(dis_handle_t *, uint64_t);
       44 +} dis_arch_t;
       45 +
       46 +struct dis_handle {
       47 +        void            *dh_data;
       48 +        int             dh_flags;
       49 +        dis_lookup_f    dh_lookup;
       50 +        dis_read_f      dh_read;
       51 +        uint64_t        dh_addr;
       52 +
       53 +        dis_arch_t      *dh_arch;
       54 +        void            *dh_arch_private;
       55 +};
       56 +
  36   57  extern int dis_seterrno(int);
  37   58  
  38   59  extern void *dis_zalloc(size_t);
  39   60  extern void dis_free(void *, size_t);
  40   61  
  41   62  #ifdef  __cplusplus
  42   63  }
  43   64  #endif
  44   65  
  45   66  #endif  /* _LIBDISASM_IMPL_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX