@@ -57,11 +57,7 unsigned int MemTester::measureMemSize(s | |||
|
57 | 57 | testAddress = (unsigned int)(address+(1<<size)); |
|
58 | 58 | curVal = (unsigned int)(1<<size); |
|
59 | 59 | plugin->Write(&curVal,1,testAddress); |
|
60 | plugin->Read(&curVal,1,testAddress); | |
|
61 | if((unsigned int)curVal!=(unsigned int)(1<<size)) | |
|
62 | return (1<<(size)); | |
|
63 | plugin->Read(&curVal,1,address); | |
|
64 | if((curVal==(unsigned int)(1<<size)) && (size!=0)) | |
|
60 | if(!MemTester::m_check_space(plugin,address,size)) | |
|
65 | 61 | return (1<<(size)); |
|
66 | 62 | } |
|
67 | 63 | return (1<<(size+1)); |
@@ -72,4 +68,18 unsigned int MemTester::measureMemSize(c | |||
|
72 | 68 | return measureMemSize(socexplorerproxy::findPlugin(plugin),address,maxSize); |
|
73 | 69 | } |
|
74 | 70 | |
|
71 | bool MemTester::m_check_space(socexplorerplugin *plugin,unsigned int address, unsigned int pow) | |
|
72 | { | |
|
73 | unsigned int currentAddress=4; | |
|
74 | unsigned int curVal=0xffffff; | |
|
75 | while (currentAddress<=(1<<pow)) | |
|
76 | { | |
|
77 | plugin->Read(&curVal,1,address+currentAddress); | |
|
78 | if(curVal!=currentAddress) | |
|
79 | return false; | |
|
80 | currentAddress = currentAddress <<1; | |
|
81 | } | |
|
82 | return true; | |
|
83 | } | |
|
75 | 84 | |
|
85 |
@@ -14,6 +14,8 public: | |||
|
14 | 14 | static unsigned int measureMemSize(const QString& plugin, unsigned int address,unsigned int maxSize=0xFFFFFFFF); |
|
15 | 15 | public slots: |
|
16 | 16 | |
|
17 | private: | |
|
18 | static bool m_check_space(socexplorerplugin* plugin,unsigned int address, unsigned int pow); | |
|
17 | 19 | }; |
|
18 | 20 | |
|
19 | 21 | #endif // MEMTESTER_H |
General Comments 0
You need to be logged in to leave comments.
Login now