opdis/model.h File Reference

Data model for libopdis. More...

#include <opdis/metadata.h>
#include <opdis/types.h>

Go to the source code of this file.

Data Structures

struct  opdis_reg_t
 CPU Register operand. More...
struct  opdis_abs_addr_t
 An absolute address operand. More...
struct  opdis_addr_expr_t
 An address expression operand. More...
struct  opdis_op_t
 Operand object. More...
struct  opdis_insn_t
 Instruction object. More...

Defines

#define LIBCALL
#define OPDIS_REG_NAME_SZ   16

Enumerations

enum  opdis_insn_decode_t {
  opdis_decode_invalid = 0, opdis_decode_basic = 1, opdis_decode_mnem = 2, opdis_decode_ops = 4,
  opdis_decode_mnem_flags = 8, opdis_decode_op_flags = 16
}
enum  opdis_addr_expr_elem_t {
  opdis_addr_expr_base = 1, opdis_addr_expr_index = 2, opdis_addr_expr_disp = 4, opdis_addr_expr_disp_u = 8,
  opdis_addr_expr_disp_s = 16, opdis_addr_expr_disp_abs = 32
}
 

Elements present in an address expression.

More...
enum  opdis_addr_expr_shift_t {
  opdis_addr_expr_lsl, opdis_addr_expr_lsr, opdis_addr_expr_asl, opdis_addr_expr_ror,
  opdis_addr_expr_rrx
}
 

Type of shift operation used in address expression.

More...

Functions

opdis_insn_t *LIBCALL opdis_insn_alloc (opdis_off_t num_operands)
 Allocate an instruction object and initialize its contents to zero.
opdis_insn_t *LIBCALL opdis_insn_alloc_fixed (size_t ascii_sz, size_t mnemonic_sz, size_t num_operands, size_t op_ascii_sz)
 Allocate a fixed-size instruction object for use as a buffer.
opdis_insn_t *LIBCALL opdis_insn_dupe (const opdis_insn_t *i)
 Duplicate an instruction object.
void LIBCALL opdis_insn_clear (opdis_insn_t *i)
 Clear the contents of an instruction object.
void LIBCALL opdis_insn_free (opdis_insn_t *i)
 Free an allocated instruction object.
void LIBCALL opdis_insn_set_ascii (opdis_insn_t *i, const char *ascii)
 Set the ascii field of an instruction.
void LIBCALL opdis_insn_set_mnemonic (opdis_insn_t *i, const char *mnemonic)
 Set the mnemonic field of an instruction.
void LIBCALL opdis_insn_add_prefix (opdis_insn_t *i, const char *prefix)
 Append a string to the prefix field.
void LIBCALL opdis_insn_add_comment (opdis_insn_t *i, const char *cmt)
 Append a string to the comment field.
int LIBCALL opdis_insn_add_operand (opdis_insn_t *i, opdis_op_t *op)
 Add an operand to an instruction.
opdis_op_t *LIBCALL opdis_insn_next_avail_op (opdis_insn_t *i)
 Return next available allocated operand.
int LIBCALL opdis_insn_is_branch (opdis_insn_t *insn)
 Determine if the instruction has a branch target operand.
int LIBCALL opdis_insn_fallthrough (opdis_insn_t *insn)
 Determine if the execution falls through to the next instruction.
int LIBCALL opdis_insn_isa_str (const opdis_insn_t *i, char *buf, int buf_len)
 Generate a string representation of instruction isa field.
int LIBCALL opdis_insn_cat_str (const opdis_insn_t *i, char *buf, int buf_len)
 Generate a string representation of instruction category field.
int LIBCALL opdis_insn_flags_str (const opdis_insn_t *i, char *buf, int buf_len, const char *delim)
 Generate a string representation of instruction flags field.
opdis_op_t *LIBCALL opdis_op_alloc (void)
 Allocate an operand object.
opdis_op_t *LIBCALL opdis_op_alloc_fixed (size_t ascii_sz)
 Allocate a fixed-size operand object for use as a buffer.
opdis_op_t *LIBCALL opdis_op_dupe (opdis_op_t *op)
 Duplicate an operand object.
void LIBCALL opdis_op_clear (opdis_op_t *o)
 Clear the contents of an operand object.
void LIBCALL opdis_op_free (opdis_op_t *op)
 Free an allocated operand object.
void LIBCALL opdis_op_set_ascii (opdis_op_t *op, const char *ascii)
 Set the ascii field of an operand.
int LIBCALL opdis_op_cat_str (const opdis_op_t *op, char *buf, int buf_len)
 Generate a string representation of operand category field.
int LIBCALL opdis_op_flags_str (const opdis_op_t *op, char *buf, int buf_len, const char *delim)
 Generate a string representation of operand flags field.
int LIBCALL opdis_reg_flags_str (const opdis_reg_t *reg, char *buf, int buf_len, const char *delim)
 Generate a string representation of register flags field.
int LIBCALL opdis_addr_expr_shift_str (const opdis_addr_expr_t *exp, char *buf, int buf_len)
 Generate a string representation of addr expression shift field.

Detailed Description

Data model for libopdis.

This defines the data model for libopdis.

Author:
TG Community Developers <community@thoughtgang.org>
Note:
Copyright (c) 2010 ThoughtGang. Released under the GNU Public License, version 3. See http://www.gnu.org/licenses/gpl.txt for details.

Define Documentation

#define OPDIS_REG_NAME_SZ   16

Max size of an operand register name.


Enumeration Type Documentation

Enumerator:
opdis_decode_invalid 

invalid instruction

opdis_decode_basic 

ascii, offset, vma, size, bytes

opdis_decode_mnem 

mnemonic, prefixes parsed

opdis_decode_ops 

operand list and dest/src/tgt

opdis_decode_mnem_flags 

insn category, flags decoded

opdis_decode_op_flags 

operand category, flags decoded


Generated on Wed Mar 10 14:30:45 2010 for Opdis Disassembly Library by  doxygen 1.6.1