Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

registers.h

Go to the documentation of this file.
00001 /*
00002 PeRdr - PE file disassembler
00003 Copyright (C) 1999-2002 Frediano Ziglio
00004 -----
00005 
00006 This program is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2 of the License, or
00009 (at your option) any later version.
00010 
00011 This program is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with this program; if not, write to the Free Software
00018 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 -----
00020 
00021 INFORMATION
00022   www: https://freddy77.tripod.com/perdr/
00023   e-mail: freddy77@angelfire.com
00024 */
00025 #ifndef FILE_REGISTERS_H
00026 #define FILE_REGISTERS_H
00027 
00028 #define DEFINE_REG(size,type,name,string,complete,mask) \
00029   __reg_##name,
00030 typedef enum _reg_t {
00031   null_reg = -1,
00032 #include "x86regs.h"
00033   __reg_Count
00034 } reg_t;
00035 #undef DEFINE_REG
00036 
00037 typedef struct reg_info
00038 {
00039   enum reg_size { bit = 0,byte = 1,word = 2,dword = 4,packetI = 8,packetF = 16,floating = 10};
00040   enum reg_size size;
00041   enum reg_type { flag,byte_low_low,byte_low_high,word_low,general,segment,special };
00042   enum reg_type type;
00043   const char* name;
00044   int completeReg;      // valido per parziali, uguale a reg se non parziale
00045   unsigned partialMask; // !!! quanti bits ?
00046   unsigned char GetByteSize() const
00047   { return (unsigned char)size; }
00048 } reg_info;
00049 
00050 #ifdef DEBUG
00051 #include <stdexcept>
00052 #endif
00053 
00054 class RegistryInfo
00055 {
00056 public:
00057   static const reg_info* GetInfo(const char* name);
00058   static const reg_info* GetInfo(reg_t i);
00059   static reg_t GetIndex(const char* name);
00060 #ifdef DEBUG
00061   static reg_t GetRegSafe(const char* name)
00062   {
00063     reg_t reg = GetIndex(name);
00064     if (reg == null_reg)
00065       throw std::runtime_error(name);
00066     return reg;
00067   }
00068 #endif
00069 };
00070 
00071 #define REG(s) __reg_##s
00072 
00073 #endif //FILE_REGISTERS_H

Generated on Mon Jan 13 22:20:34 2003 for perdr by doxygen1.2.15