#include <byteinfo.h>
Public Methods | |
| ByteInfo & | operator[] (vma_t address) |
| Return info for byte at given address. More... | |
| const ByteInfo & | operator[] (vma_t address) const |
| uchar | GetIstrLen (vma_t) const |
| Get length of instruction at given address do not use for no instruction data. More... | |
| void | SetLen (vma_t address, unsigned len) |
| Set data len (for long data (>32) ). More... | |
| unsigned | GetLen (vma_t address) const |
| Get len of data. More... | |
| bool | IsOccupied (vma_t address) const |
| Check if data at given address is alredy marked. More... | |
| bool | IsOccupied (vma_t address, int bytes) const |
| Check if data at given address is alredy marked. More... | |
Private Types | |
| typedef fix_vector< ByteInfo, PageSize > | TPage |
| typedef std::map< vma_t, freddy77::hp_auto_ptr< TPage >, std::less< vma_t > > | TInfos |
| enum | dummy { PageSize = 4096 } |
Private Attributes | |
| TInfos | map |
Static Private Attributes | |
| ByteInfo | emptyInfo |
Definition at line 113 of file byteinfo.h.
|
|
Definition at line 149 of file byteinfo.h. |
|
|
Definition at line 148 of file byteinfo.h. Referenced by operator[](). |
|
|
Definition at line 147 of file byteinfo.h.
00147 { PageSize = 4096 };
|
|
|
Get length of instruction at given address do not use for no instruction data.
Definition at line 64 of file byteinfo.cpp. References map, PageSize, uchar, and vma_t. Referenced by CodeParser::_ReverseScan(), IsOccupied(), CodeParser::Parse(), CodeParser::ScanCode(), THeuristicMotor::THeuristicMotor(), and CodeParser::WriteCode().
|
|
|
Get len of data.
Definition at line 85 of file byteinfo.cpp. References ByteInfo::Continue(), ByteInfo::len, and vma_t. Referenced by CodeParser::WriteCode().
|
|
||||||||||||
|
Check if data at given address is alredy marked.
Definition at line 125 of file byteinfo.cpp. References _PRG_ASSERT, GetIstrLen(), map, PageSize, and vma_t.
00126 {
00127 _PRG_ASSERT(bytes>0);
00128 // !!! 32 = max istr length
00129 const int maxIstrSize = 32u;
00130 address += --bytes;
00131 TInfos::const_iterator i = map.find(address/unsigned(PageSize));
00132 unsigned int partial = address%unsigned(PageSize);
00133
00134 // caso tutti su una pagina
00135 if (partial>=(unsigned int)(maxIstrSize-1+bytes))
00136 {
00137 if ( i == map.end())
00138 return false;
00139 TPage &page = *(*i).second;
00140 int n = -bytes;
00141 for(;n<0;++n,--partial)
00142 if (page[partial].len > 0)
00143 return true;
00144 for(;n<maxIstrSize;++n,--partial)
00145 if (page[partial].len > n)
00146 return true;
00147 return false;
00148 }
00149
00150 // sfortuna, 2 pagine
00151 int n = -bytes;
00152 address -= bytes;
00153 for(;n<0;++n)
00154 if (GetIstrLen(address-n) > 0)
00155 return true;
00156 for(;n<maxIstrSize;++n)
00157 if (GetIstrLen(address-n) > n)
00158 return true;
00159 return false;
00160 }
|
|
|
Check if data at given address is alredy marked.
Definition at line 99 of file byteinfo.cpp. References GetIstrLen(), map, PageSize, and vma_t. Referenced by CodeParser::CheckForAddress(), CodeParser::ExecuteComplexReferenceMemory(), CodeParser::GetBitStat(), CodeParser::GetPointerArrayStats(), CodeParser::GetStringStats(), CodeParser::ScanCode(), and CodeParser::WriteCode().
00100 {
00101 // !!! 32 = max istr length
00102 const int maxIstrSize = 32;
00103 TInfos::const_iterator i = map.find(address/unsigned(PageSize));
00104 unsigned partial = address%unsigned(PageSize);
00105
00106 // caso tutti su una pagina
00107 if (partial>=(maxIstrSize-1))
00108 {
00109 if ( i == map.end())
00110 return false;
00111 TPage &page = *(*i).second;
00112 for(int n=0;n<maxIstrSize;++n,--partial)
00113 if (page[partial].len > n)
00114 return true;
00115 return false;
00116 }
00117
00118 // sfortuna, 2 pagine
00119 for(int n=0;n<maxIstrSize;++n)
00120 if (GetIstrLen(address-n) > n)
00121 return true;
00122 return false;
00123 }
|
|
|
Definition at line 54 of file byteinfo.cpp. References emptyInfo, map, PageSize, and vma_t.
|
|
|
Return info for byte at given address.
Definition at line 32 of file byteinfo.cpp. References map, PageSize, TPage, and vma_t.
00033 {
00034 TInfos::const_iterator i = map.find(address/unsigned(PageSize));
00035 if ( i != map.end() )
00036 return (*(*i).second)[address%unsigned(PageSize)];
00037
00038 map[address/unsigned(PageSize)] = freddy77::hp_auto_ptr<TPage>(new TPage());
00039 return (*map[address/unsigned(PageSize)])[address%unsigned(PageSize)];
00040 }
|
|
||||||||||||
|
Set data len (for long data (>32) ).
Definition at line 71 of file byteinfo.cpp. References ByteInfo::len, ByteInfo::SetContinue(), and vma_t.
00072 {
00073 while(len>32)
00074 {
00075 ByteInfo &info = (*this)[address];
00076 info.len = 32;
00077 info.SetContinue();
00078 len -= 32;
00079 address += 32;
00080 }
00081 ByteInfo &info = (*this)[address];
00082 info.len = (uchar)len;
00083 }
|
|
|
Definition at line 42 of file byteinfo.cpp. Referenced by operator[](). |
|
|
Definition at line 150 of file byteinfo.h. Referenced by GetIstrLen(), IsOccupied(), and operator[](). |
1.2.15