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) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A/*
2N/A * Copyright 2007 Jason King. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _DIS_SPARC_FMT_H
2N/A#define _DIS_SPARC_FMT_H
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#include <sys/types.h>
2N/A#include "libdisasm.h"
2N/A#include "dis_sparc.h"
2N/A
2N/A/* which set of registers are used with an instruction */
2N/A#define REG_INT 0x00 /* regular integer registers */
2N/A#define REG_FP 0x01 /* single-precision fp registers */
2N/A#define REG_FPD 0x02 /* double-precision fp registers */
2N/A#define REG_FPQ 0x03 /* quad-precision fp registers */
2N/A#define REG_CP 0x04 /* coprocessor registers (v8) */
2N/A#define REG_ICC 0x05 /* %icc / % xcc */
2N/A#define REG_FCC 0x06 /* %fccn */
2N/A#define REG_FSR 0x07 /* %fsr */
2N/A#define REG_CSR 0x08 /* %csr */
2N/A#define REG_CQ 0x09 /* %cq */
2N/A#define REG_NONE 0x0a /* no registers */
2N/A
2N/A/* the size fo the displacement for branches */
2N/A#define DISP22 0x00
2N/A#define DISP19 0x01
2N/A#define DISP16 0x02
2N/A#define CONST22 0x03
2N/A
2N/A/* get/set the register set name for the rd field of an instruction */
2N/A#define FLG_RD(x) (x)
2N/A#define FLG_RD_VAL(x) (x & 0xfL)
2N/A
2N/A#define FLG_STORE (0x1L << 24) /* the instruction is not a load */
2N/A#define FLG_ASI (0x2L << 24) /* the load/store includes an asi value */
2N/A
2N/A
2N/A/* flags for ALU instructions */
2N/A
2N/A/* set/get register set name for 1st argument position */
2N/A#define FLG_P1(x) (x << 8)
2N/A#define FLG_P1_VAL(x) ((x >> 8) & 0xfL)
2N/A
2N/A/* get/set reg set for 2nd argument position */
2N/A#define FLG_P2(x) (x << 4)
2N/A#define FLG_P2_VAL(x) ((x >> 4) & 0xfL)
2N/A
2N/A/* get/set for 3rd argument position */
2N/A#define FLG_P3(x) (x)
2N/A#define FLG_P3_VAL(x) (x & 0xfL)
2N/A
2N/A/* set if the arguments do not contain immediate values */
2N/A#define FLG_NOIMM (0x01L << 24)
2N/A
2N/A
2N/A
2N/A/* flags for branch instructions */
2N/A
2N/A/* has branch prediction */
2N/A#define FLG_PRED (0x01L << 24)
2N/A
2N/A/* get/set condition code register set -- usually REG_NONE */
2N/A#define FLG_RS1(x) (x)
2N/A#define FLG_RS1_VAL(x) (x & 0xfL)
2N/A
2N/A/* get/set displacement size */
2N/A#define FLG_DISP(x) (x << 4L)
2N/A#define FLG_DISP_VAL(x) ((x >> 4L) & 0x0fL)
2N/A
2N/A
2N/Aint fmt_call(dis_handle_t *, uint32_t, const inst_t *, int);
2N/Aint fmt_ls(dis_handle_t *, uint32_t, const inst_t *, int);
2N/Aint fmt_alu(dis_handle_t *, uint32_t, const inst_t *, int);
2N/Aint fmt_branch(dis_handle_t *, uint32_t, const inst_t *, int);
2N/Aint fmt_sethi(dis_handle_t *, uint32_t, const inst_t *, int);
2N/Aint fmt_fpop1(dis_handle_t *, uint32_t, const inst_t *, int);
2N/Aint fmt_fpop2(dis_handle_t *, uint32_t, const inst_t *, int);
2N/Aint fmt_vis(dis_handle_t *, uint32_t, const inst_t *, int);
2N/Aint fmt_trap(dis_handle_t *, uint32_t, const inst_t *, int);
2N/Aint fmt_regwin(dis_handle_t *, uint32_t, const inst_t *, int);
2N/Aint fmt_trap_ret(dis_handle_t *, uint32_t, const inst_t *, int);
2N/Aint fmt_movcc(dis_handle_t *, uint32_t, const inst_t *, int);
2N/Aint fmt_movr(dis_handle_t *, uint32_t, const inst_t *, int);
2N/Aint fmt_fused(dis_handle_t *, uint32_t, const inst_t *, int);
2N/Aint fmt_cbcond(dis_handle_t *, uint32_t, const inst_t *, int);
2N/Aint fmt_crypto(dis_handle_t *, uint32_t, const inst_t *, int);
2N/Aint fmt_crypto4op(dis_handle_t *, uint32_t, const inst_t *, int);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _DIS_SPARC_FMT_H */