00001 /* 00002 * Copyright (C) 1996-2001, The University of Queensland 00003 * Copyright (C) 2001, Sun Microsystems, Inc 00004 * 00005 * See the file "LICENSE.TERMS" for information on usage and 00006 * redistribution of this file, and for a DISCLAIMER OF ALL 00007 * WARRANTIES. 00008 * 00009 */ 00010 00011 /*============================================================================== 00012 * FILE: pentdecoder.h 00013 * OVERVIEW: The implementation of the instruction decoder for Pentium. 00014 *============================================================================*/ 00015 00016 /* 00017 * $Revision: 1.6 $ 00018 * 06 Jun 02 - Trent: Created. 00019 * 00020 */ 00021 00022 #ifndef PENTDECODER 00023 #define PENTDECODER 00024 00025 class Prog; 00026 class NJMCDecoder; 00027 struct DecodeResult; 00028 00029 class PentiumDecoder : public NJMCDecoder 00030 { 00031 public: 00032 /* Default constructor 00033 */ 00034 PentiumDecoder(Prog* prog); 00035 00036 /* 00037 * Decodes the machine instruction at pc and returns an RTL instance for 00038 * the instruction. 00039 */ 00040 virtual DecodeResult& decodeInstruction (ADDRESS pc, int delta); 00041 00042 /* 00043 * Disassembles the machine instruction at pc and returns the number of 00044 * bytes disassembled. Assembler output goes to global _assembly 00045 */ 00046 virtual int decodeAssemblyInstruction (ADDRESS pc, int delta); 00047 00048 private: 00049 /* 00050 * Various functions to decode the operands of an instruction into 00051 * a SemStr representation. 00052 */ 00053 Exp* dis_Eaddr(ADDRESS pc, int size = 0); 00054 Exp* dis_Mem(ADDRESS ps); 00055 Exp* addReloc(Exp *e); 00056 00057 void unused(int x); 00058 bool isFuncPrologue(ADDRESS hostPC); 00059 00060 Byte getByte(unsigned lc); 00061 SWord getWord(unsigned lc); 00062 DWord getDword(unsigned lc); 00063 00064 unsigned lastDwordLc; 00065 }; 00066 00067 #endif