00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef IA64DIS_H
00022 #define IA64DIS_H
00023
00024 #include "asm.h"
00025 #include "global.h"
00026 #include "ia64opc.h"
00027
00028 #define IA64_OPERAND_NO 0
00029 #define IA64_OPERAND_EQUALS 1
00030 #define IA64_OPERAND_1 2
00031 #define IA64_OPERAND_REG 3
00032 #define IA64_OPERAND_AREG 4
00033 #define IA64_OPERAND_BREG 5
00034 #define IA64_OPERAND_FREG 6
00035 #define IA64_OPERAND_PREG 7
00036 #define IA64_OPERAND_AR_PFS 8
00037 #define IA64_OPERAND_AR_CCV 9
00038 #define IA64_OPERAND_MEM_REG 10
00039 #define IA64_OPERAND_IMM 11
00040 #define IA64_OPERAND_ADDRESS 12
00041 #define IA64_OPERAND_REG_FILE 13
00042 #define IA64_OPERAND_PRALL 14
00043 #define IA64_OPERAND_PRROT 15
00044 #define IA64_OPERAND_IP 16
00045
00046 struct IA64Op {
00047 int type;
00048 union {
00049 int reg;
00050 qword imm;
00051 qword ofs;
00052 struct {
00053 int db;
00054 int idx;
00055 } regfile;
00056 };
00057 };
00058
00059 struct IA64SlotDisInsn {
00060 bool valid;
00061 int next;
00062 qword data;
00063 dword qp;
00064 IA64OpcodeEntry *opcode;
00065 IA64Op op[7];
00066 };
00067
00068 struct IA64DisInsn {
00069 bool valid;
00070 int size;
00071 byte data[16];
00072 IA64Template *tmplt;
00073 byte tmplt_idx;
00074
00075 int selected;
00076 IA64SlotDisInsn slot[3];
00077 };
00078
00079
00080
00081
00082
00083 class IA64Disassembler: public Disassembler {
00084 protected:
00085 CPU_ADDR cpu_addr;
00086 char insnstr[256];
00087 IA64DisInsn insn;
00088 public:
00089 IA64Disassembler();
00090 virtual ~IA64Disassembler();
00091
00092 virtual dis_insn *decode(byte *code, int maxlen, CPU_ADDR addr);
00093 virtual dis_insn *duplicateInsn(dis_insn *disasm_insn);
00094 virtual void getOpcodeMetrics(int &min_length, int &max_length, int &min_look_ahead, int &avg_look_ahead, int &addr_align);
00095 virtual byte getSize(dis_insn *disasm_insn);
00096 virtual char *getName();
00097 virtual bool selectNext(dis_insn *disasm_insn);
00098 virtual char *str(dis_insn *disasm_insn, int style);
00099 virtual char *strf(dis_insn *disasm_insn, int style, char *format);
00100 virtual OBJECT_ID object_id() const;
00101 virtual bool validInsn(dis_insn *disasm_insn);
00102 private:
00103 void decodeSlot(int slot_nb);
00104 qword signExtend(qword a, int length);
00105 };
00106
00107 #endif