]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Change "BA" to "BaseAddress" and "EP" to "EntryPoint".
authorbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 16 Jan 2007 08:11:09 +0000 (08:11 +0000)
committerbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 16 Jan 2007 08:11:09 +0000 (08:11 +0000)
2. Sort modules by their preferred load address in ascending order.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2254 6f19259b-4bc3-4df7-8a09-765794883524

Tools/CCode/Source/GenFvMap/GenFvMap.cpp

index 881251f03e521308da92a6fa393c4cb3ca66e67f..5da45abbbd900582d51071c678f1f49d83c70d04 100644 (file)
@@ -13,6 +13,7 @@
 #include <stdexcept>\r
 #include <list>\r
 #include <map>\r
+#include <vector>\r
 #include <iomanip>\r
 #include <fstream>\r
 #include <sstream>\r
@@ -349,31 +350,47 @@ CFvMapFile::CFvMapFile(const CIdAddressPathMap& idAddrPath)
     }\r
 }\r
 \r
+CFvMapFile::~CFvMapFile(void)\r
+{\r
+    Cleanup();\r
+}\r
+\r
 void CFvMapFile::Cleanup(void)\r
 {\r
     for (iterator i = begin(); i != end(); i++)\r
         delete i->second;\r
 }\r
 \r
+static bool map_less(const CFvMapFile::const_iterator& l, const CFvMapFile::const_iterator& r)\r
+{\r
+    return l->second->m_ullLoadAddr < r->second->m_ullLoadAddr;\r
+}\r
+\r
 ostream& operator << (ostream& os, const CFvMapFile& fvMap)\r
 {\r
-    for (CFvMapFile::const_iterator i = fvMap.begin(); !!os && i != fvMap.end(); i++)\r
+    vector<CFvMapFile::const_iterator> rgIter;\r
+    rgIter.reserve(fvMap.size());\r
+    for (CFvMapFile::const_iterator i = fvMap.begin(); i != fvMap.end(); i++)\r
+        rgIter.push_back(i);\r
+    sort(rgIter.begin(), rgIter.end(), map_less);\r
+\r
+    for (vector<CFvMapFile::const_iterator>::const_iterator i = rgIter.begin(); i != rgIter.end(); i++)\r
     {\r
-        CMapFile::const_iterator j = i->second->begin();\r
-        while (j != i->second->end() && j->m_strAddress != i->second->m_strEntryPoint) j++;\r
-        if (j == i->second->end())\r
+        CMapFile::const_iterator j = (*i)->second->begin();\r
+        while (j != (*i)->second->end() && j->m_strAddress != (*i)->second->m_strEntryPoint) j++;\r
+        if (j == (*i)->second->end())\r
             throw runtime_error(\r
                 __FUNCTION__ ":Entry point not found for module " +\r
-                i->second->m_strModuleName);\r
+                (*i)->second->m_strModuleName);\r
 \r
         os << hex\r
-            << i->second->m_strModuleName\r
-            << " (EP=" << j->m_ullRva\r
-            << ", BA=" << i->second->m_ullLoadAddr\r
-            << ", GUID=" << i->first\r
+            << (*i)->second->m_strModuleName\r
+            << " (EntryPoint=" << j->m_ullRva\r
+            << ", BaseAddress=" << (*i)->second->m_ullLoadAddr\r
+            << ", GUID=" << (*i)->first\r
             << ")" << endl << endl;\r
 \r
-        for (j = i->second->begin(); j != i->second->end(); j++)\r
+        for (j = (*i)->second->begin(); j != (*i)->second->end(); j++)\r
             os << "  " << *j << endl;\r
 \r
         os << endl << endl;\r
@@ -382,11 +399,6 @@ ostream& operator << (ostream& os, const CFvMapFile& fvMap)
     return os;\r
 }\r
 \r
-CFvMapFile::~CFvMapFile(void)\r
-{\r
-    Cleanup();\r
-}\r
-\r
 class CGenFvMapUsage : public invalid_argument\r
 {\r
 public:\r