00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
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;
00045 unsigned partialMask;
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