2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _LIBDISASM_H
2N/A#define _LIBDISASM_H
2N/A
2N/A#include <sys/types.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/Atypedef struct dis_handle dis_handle_t;
2N/A
2N/A#define DIS_DEFAULT 0x0
2N/A
2N/A/* SPARC disassembler flags */
2N/A#define DIS_SPARC_V8 0x01
2N/A#define DIS_SPARC_V9 0x02
2N/A#define DIS_SPARC_V9_SGI 0x04
2N/A#define DIS_SPARC_V9_OPL 0x08
2N/A
2N/A/* x86 diassembler flags (mutually exclusive) */
2N/A#define DIS_X86_SIZE16 0x08
2N/A#define DIS_X86_SIZE32 0x10
2N/A#define DIS_X86_SIZE64 0x20
2N/A
2N/A/* generic disassembler flags */
2N/A#define DIS_OCTAL 0x40
2N/A#define DIS_NOIMMSYM 0x80
2N/A
2N/Atypedef int (*dis_lookup_f)(void *, uint64_t, char *, size_t, uint64_t *,
2N/A size_t *);
2N/Atypedef int (*dis_read_f)(void *, uint64_t, void *, size_t);
2N/A
2N/Aextern dis_handle_t *dis_handle_create(int, void *, dis_lookup_f, dis_read_f);
2N/Aextern void dis_handle_destroy(dis_handle_t *);
2N/A
2N/Aextern int dis_disassemble(dis_handle_t *, uint64_t, char *, size_t);
2N/Aextern uint64_t dis_previnstr(dis_handle_t *, uint64_t, int n);
2N/Aextern void dis_set_data(dis_handle_t *, void *);
2N/Aextern void dis_flags_set(dis_handle_t *, int f);
2N/Aextern void dis_flags_clear(dis_handle_t *, int f);
2N/Aextern int dis_max_instrlen(dis_handle_t *);
2N/A
2N/A/* libdisasm errors */
2N/A#define E_DIS_NOMEM 1 /* Out of memory */
2N/A#define E_DIS_INVALFLAG 2 /* Invalid flag for this architecture */
2N/A
2N/Aextern int dis_errno(void);
2N/Aextern const char *dis_strerror(int);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _LIBDISASM_H */