diff options
-rw-r--r-- | Tools/CCode/Source/GenFvMap/GenFvMap.cpp | 783 | ||||
-rw-r--r-- | Tools/CCode/Source/PeiRebase/PeiRebaseExe.c | 45 | ||||
-rw-r--r-- | Tools/Conf/BuildMacro.xml | 207 |
3 files changed, 611 insertions, 424 deletions
diff --git a/Tools/CCode/Source/GenFvMap/GenFvMap.cpp b/Tools/CCode/Source/GenFvMap/GenFvMap.cpp index 9934d3c..8c8910c 100644 --- a/Tools/CCode/Source/GenFvMap/GenFvMap.cpp +++ b/Tools/CCode/Source/GenFvMap/GenFvMap.cpp @@ -8,453 +8,640 @@ //** from the company.
//**
//****************************************************************************
-#include "ProcessorBind.h"
+#include <cstdio>
#include <iostream>
-#include <stdexcept>
-#include <list>
-#include <map>
-#include <vector>
-#include <iomanip>
#include <fstream>
-#include <sstream>
+#include <iomanip>
+#include <stdexcept>
+#include <set>
#include <string>
-#include <utility>
+#include <sstream>
+#include <vector>
+#include <map>
#include <algorithm>
-#include <functional>
using namespace std;
-typedef UINT64 ulonglong_t;
-
-#ifdef __GNUC__
-#if __STDC_VERSION__ < 199901L
-#define __FUNCTION__ __FILE__
-#endif
-#endif
+#include "ProcessorBind.h"
-template <class T>
-class CMemoryLeakChecker : public list<T*>
+class putUINT64
{
public:
- static CMemoryLeakChecker<T>& GetInstance(void);
+ putUINT64(UINT64 ullVal) : m_ull(ullVal) {}
+ putUINT64(const putUINT64& r) : m_ull(r.m_ull) {}
+
+ template <class _E, class _Tr>
+ friend basic_ostream<_E, _Tr>& operator << (basic_ostream<_E, _Tr>&, putUINT64);
private:
- CMemoryLeakChecker(void)
+ UINT64 m_ull;
+};
+
+template <class _E, class _Tr>
+basic_ostream<_E, _Tr>& operator << (basic_ostream<_E, _Tr>& os, putUINT64 ull)
+{
+ static const char cDigits[] = "0123456789abcdef";
+
+ UINT64 base = 10;
+ if (os.flags() & ios_base::hex)
+ base = 16;
+ else if (os.flags() & ios_base::oct)
+ base = 8;
+
+ ostringstream ostr;
+ UINT64 ullVal = ull.m_ull;
+ while (ullVal != 0)
{
+ ostr << cDigits[ullVal % base];
+ ullVal /= base;
}
- ~CMemoryLeakChecker(void);
+ string s1(ostr.str());
+ string s2(s1.rbegin(), s1.rend());
+ return os << s2;
+}
+
+class getUINT64
+{
+public:
+ getUINT64(UINT64& ullVal) : m_ull(ullVal) {}
+ getUINT64(const getUINT64& r) : m_ull(r.m_ull) {}
+
+ template <class _E, class _Tr>
+ friend basic_istream<_E, _Tr>& operator >> (basic_istream<_E, _Tr>&, getUINT64);
+
+private:
+ UINT64& m_ull;
+
+private:
+ getUINT64& operator = (const getUINT64&);
};
-template <class T>
-CMemoryLeakChecker<T>& CMemoryLeakChecker<T>::GetInstance(void)
+template <class _E, class _Tr>
+basic_istream<_E, _Tr>& operator >> (basic_istream<_E, _Tr>& is, getUINT64 ull)
{
- static CMemoryLeakChecker<T> s_memLeakChecker;
- return s_memLeakChecker;
+ string strBuf;
+ is >> strBuf;
+
+ UINT64 base = 10;
+ if (is.flags() & ios_base::hex)
+ base = 16;
+ else if (is.flags() & ios_base::oct)
+ base = 8;
+
+ UINT64 ullVal = 0;
+ for (string::iterator i = strBuf.begin(); i != strBuf.end(); i++)
+ {
+ if (*i <= '9' && *i >= '0')
+ *i -= '0';
+ else if (*i <= 'F' && *i >= 'A')
+ *i -= 'A' - '\x0a';
+ else if (*i <= 'f' && *i >= 'a')
+ *i -= 'a' - '\x0a';
+ else throw runtime_error("Invalid number format");
+
+ ullVal = ullVal * base + *i;
+ }
+ ull.m_ull = ullVal;
+ return is;
}
-template <class T>
-CMemoryLeakChecker<T>::~CMemoryLeakChecker(void)
+class EMemoryLeak : public logic_error
{
- if (!list<T*>::empty())
- throw logic_error(__FUNCTION__ ": Memory leak detected!");
-}
+public:
+ EMemoryLeak() : logic_error("Memory leak detected") {}
+};
-class CObjRoot
+class EInvalidGuidString : public invalid_argument
+{
+public:
+ EInvalidGuidString() : invalid_argument("Unexpected format of GUID string") {}
+};
+
+class ELogFileError : public logic_error
+{
+public:
+ ELogFileError(const string& strMsg) : logic_error(strMsg) {}
+};
+
+class EDuplicatedFfsFile : public ELogFileError
+{
+public:
+ EDuplicatedFfsFile() : ELogFileError("Duplicated FFS found in LOG file") {}
+};
+
+class EUnexpectedLogFileToken : public ELogFileError
+{
+public:
+ EUnexpectedLogFileToken() : ELogFileError("Unexpected LOG file token") {}
+};
+
+class EFileNotFound : public invalid_argument
+{
+public:
+ EFileNotFound(const string& strFName) : invalid_argument("File not found - " + strFName) {}
+};
+
+class EUnexpectedMapFile : public logic_error
+{
+public:
+ EUnexpectedMapFile(const string& strKeyWord) : logic_error("Unexpected map file format - " + strKeyWord) {}
+};
+
+class EUsage : public invalid_argument
+{
+public:
+ EUsage() : invalid_argument("Usage: GenFvMap <FV.LOG> <FV.INF> <FV.MAP>") {}
+};
+
+template <class T>
+class CMemoryLeakChecker : public set<T*>
{
protected:
- CObjRoot(void);
- virtual ~CObjRoot(void);
+ CMemoryLeakChecker()
+ {
+ }
+
+public:
+ virtual ~CMemoryLeakChecker();
+ static CMemoryLeakChecker<T>& GetInstance();
+
+private:
+ CMemoryLeakChecker(const CMemoryLeakChecker<T>&);
};
-CObjRoot::CObjRoot(void)
+template <class T>
+CMemoryLeakChecker<T>::~CMemoryLeakChecker()
{
- CMemoryLeakChecker<CObjRoot>::GetInstance().push_back(this);
+ if (!CMemoryLeakChecker<T>::empty())
+ throw EMemoryLeak();
}
-CObjRoot::~CObjRoot(void)
+template <class T>
+CMemoryLeakChecker<T>& CMemoryLeakChecker<T>::GetInstance()
{
- CMemoryLeakChecker<CObjRoot>::GetInstance().remove(this);
+ static CMemoryLeakChecker<T> s_instance;
+ return s_instance;
}
+class CObjRoot
+{
+protected:
+ CObjRoot()
+ {
+#ifdef _CHK_MEM_LEAK
+ CMemoryLeakChecker<CObjRoot>::GetInstance().insert(this);
+#endif
+ }
+
+public:
+ virtual ~CObjRoot()
+ {
+#ifdef _CHK_MEM_LEAK
+ CMemoryLeakChecker<CObjRoot>::GetInstance().erase(this);
+#endif
+ }
+
+private:
+ CObjRoot(const CObjRoot&);
+};
+
class CIdentity : public CObjRoot
{
public:
- CIdentity(void);
CIdentity(const string&);
- CIdentity(const CIdentity&);
+ operator string (void) const;
+
+ bool operator < (const CIdentity& id) const
+ {
+ return memcmp(this, &id, sizeof(*this)) < 0;
+ }
+
+ CIdentity() : ulD1(0), wD2(0), wD3(0), wD4(0), ullD5(0)
+ {
+ }
- bool operator < (const CIdentity&) const;
- friend istream& operator >> (istream&, CIdentity&);
- friend ostream& operator << (ostream&, const CIdentity&);
+ CIdentity(const CIdentity& r) : ulD1(r.ulD1), wD2(r.wD2), wD3(r.wD3), wD4(r.wD4), ullD5(r.ullD5)
+ {
+ }
- static const string::size_type s_nIdStrLen;
+ template <class _E, class _Tr>
+ basic_istream<_E, _Tr>& ReadId(basic_istream<_E, _Tr>&);
+ template <class _E, class _Tr>
+ basic_ostream<_E, _Tr>& WriteId(basic_ostream<_E, _Tr>&);
-protected:
- ulonglong_t m_ullId[2];
-};
+ template <class _E, class _Tr>
+ friend basic_istream<_E, _Tr>& operator >> (basic_istream<_E, _Tr>&, CIdentity&);
+ template <class _E, class _Tr>
+ friend basic_ostream<_E, _Tr>& operator << (basic_ostream<_E, _Tr>&, CIdentity);
-const string::size_type CIdentity::s_nIdStrLen = 36;
+private:
+ UINT32 ulD1;
+ UINT16 wD2, wD3, wD4;
+ UINT64 ullD5;
+};
-CIdentity::CIdentity(void)
+CIdentity::CIdentity(const string& strGuid)
{
- memset(m_ullId, 0, sizeof(m_ullId));
+ try
+ {
+ string str(strGuid);
+ str.erase(0, str.find_first_not_of(" {"));
+ str.resize(str.find_last_not_of(" }") + 1);
+ str[str.find('-')] = ' ';
+ str[str.find('-')] = ' ';
+ str[str.find('-')] = ' ';
+ str[str.find('-')] = ' ';
+
+ istringstream is(str);
+ is >> hex >> ulD1 >> wD2 >> wD3 >> wD4 >> getUINT64(ullD5);
+ }
+ catch (const exception&)
+ {
+ throw EInvalidGuidString();
+ }
}
-CIdentity::CIdentity(const string& strId)
+CIdentity::operator string(void) const
{
- if (strId.length() != CIdentity::s_nIdStrLen ||
- strId[8] != '-' ||
- strId[13] != '-' ||
- strId[18] != '-' ||
- strId[23] != '-')
- throw runtime_error(
- __FUNCTION__ ": Error GUID format " + strId);
-
- string strIdCopy(strId);
- strIdCopy.erase(23, 1);
- strIdCopy[18] = ' ';
- strIdCopy.erase(13, 1);
- strIdCopy.erase(8, 1);
-
- istringstream is(strIdCopy);
- is >> hex >> m_ullId[0] >> m_ullId[1];
- if (!is)
- throw runtime_error(
- __FUNCTION__ ": GUID contains invalid characters" + strId);
+ ostringstream os;
+ os << hex << setfill('0')
+ << setw(8) << ulD1 << '-'
+ << setw(4) << wD2 << '-'
+ << setw(4) << wD3 << '-'
+ << setw(4) << wD4 << '-'
+ << setw(12) << putUINT64(ullD5);
+ return os.str();
}
-CIdentity::CIdentity(const CIdentity& idRight)
+template <class _E, class _Tr>
+basic_istream<_E, _Tr>& CIdentity::ReadId(basic_istream<_E, _Tr>& is)
{
- memmove(m_ullId, idRight.m_ullId, sizeof(m_ullId));
+ string str;
+ if (!!(is >> str))
+ *this = CIdentity(str);
+ return is;
}
-bool CIdentity::operator < (const CIdentity& idRight) const
+template <class _E, class _Tr>
+basic_ostream<_E, _Tr>& CIdentity::WriteId(basic_ostream<_E, _Tr>& os)
{
- return memcmp(m_ullId, idRight.m_ullId, sizeof(m_ullId)) < 0;
+ return os << (string)(*this);
}
-istream& operator >> (istream& is, CIdentity& idRight)
+template <class _E, class _Tr>
+basic_istream<_E, _Tr>& operator >> (basic_istream<_E, _Tr>& is, CIdentity& id)
{
- string strId;
- is >> strId;
- if (!!is)
- idRight = CIdentity(strId);
- return is;
+ return id.ReadId(is);
}
-ostream& operator << (ostream& os, const CIdentity& idRight)
+template <class _E, class _Tr>
+basic_ostream<_E, _Tr>& operator << (basic_ostream<_E, _Tr>& os, CIdentity id)
{
- return os << hex << setfill('0')
- << setw(8) << (unsigned long)(idRight.m_ullId[0] >> 32) << '-'
- << setw(4) << (unsigned short)(idRight.m_ullId[0] >> 16) << '-'
- << setw(4) << (unsigned short)idRight.m_ullId[0] << '-'
- << setw(4) << (unsigned short)(idRight.m_ullId[1] >> 48) << '-'
- << setw(12) << (idRight.m_ullId[1] & 0xffffffffffffULL);
+ return id.WriteId(os);
}
-class CInputFile : public CObjRoot
+template <class T>
+class IVectorContainerByReference : virtual public CObjRoot, public vector<T*>
{
-protected:
- CInputFile(const string&);
- CInputFile(istream&);
- istream& GetLine(string&);
+};
-private:
- CInputFile(const CInputFile&);
- CInputFile& operator = (const CInputFile&);
+template <class T>
+class IMapContainer : virtual public CObjRoot, public map<CIdentity, T>
+{
+};
-private:
- auto_ptr<istream> m_pIs;
+struct ISymbol : virtual public CObjRoot
+{
+ string strAddress;
+ string strName;
+ string strFrom;
+ UINT64 ullRva;
+ bool bStatic;
+ bool bFunction;
+ virtual void Relocate(UINT64)=0;
+};
-protected:
- istream& m_is;
+class IModule : public IVectorContainerByReference<ISymbol>
+{
+public:
+ string strName;
+ CIdentity id;
+ virtual UINT64 BaseAddress(void) const=0;
+ virtual UINT64 BaseAddress(UINT64)=0;
+ virtual const ISymbol *EntryPoint(void) const=0;
};
-CInputFile::CInputFile(const string& strFName)
-: m_pIs(new ifstream(strFName.c_str()))
-, m_is(*m_pIs)
+class IFirmwareVolume : public IVectorContainerByReference<IModule>
{
- if (!m_is)
- throw runtime_error(__FUNCTION__ ": Error opening input file " + strFName);
-}
+};
-CInputFile::CInputFile(istream& is)
-: m_is(is)
+class IMapFileSet : public IMapContainer<istream*>
{
- if (!m_is)
- throw runtime_error(__FUNCTION__ ": Error opening input stream");
-}
+};
-istream& CInputFile::GetLine(string& strALine)
+class IFfsSet : public IMapContainer<UINT64>
{
- if (!!m_is)
- while (!!getline(m_is, strALine))
- {
- string::size_type pos = strALine.find_last_not_of(' ');
- if (pos != string::npos)
- {
- strALine.erase(pos + 1);
- strALine.erase(0, strALine.find_first_not_of(' '));
- break;
- }
- }
- return m_is;
-}
+};
-class CIdAddressPathMap : public CInputFile, public map<CIdentity, pair<ulonglong_t, string> >
+class CFfsSetFromLogFile : public IFfsSet
{
public:
- CIdAddressPathMap(istream&);
+ CFfsSetFromLogFile(const string&);
};
-CIdAddressPathMap::CIdAddressPathMap(istream& is)
-: CInputFile(is)
+CFfsSetFromLogFile::CFfsSetFromLogFile(const string& strFName)
{
- key_type k;
- mapped_type m;
- while (!!(m_is >> hex >> k >> m.first) && !!GetLine(m.second))
- if (!insert(value_type(k, m)).second)
- throw runtime_error(__FUNCTION__ ": Duplicated files");
+ ifstream ifs(strFName.c_str());
+ if (!ifs)
+ throw EFileNotFound(strFName);
+
+ CIdentity ffsId;
+ while (!!ffsId.ReadId(ifs))
+ {
+ UINT64 ullBase;
+ if (!(ifs >> hex >> getUINT64(ullBase)))
+ throw EUnexpectedLogFileToken();
+ if (!insert(value_type(ffsId, ullBase)).second)
+ throw EDuplicatedFfsFile();
+ }
}
-class CSymbol : public CObjRoot
+class CMapFileSetFromInfFile : public IMapFileSet
{
public:
- string m_strAddress;
- string m_strName;
- ulonglong_t m_ullRva;
- string m_strFrom;
- bool m_bStatic;
- bool m_bFunction;
-
- CSymbol()
+ CMapFileSetFromInfFile(const string&);
+ ~CMapFileSetFromInfFile();
+};
+
+CMapFileSetFromInfFile::CMapFileSetFromInfFile(const string& strFName)
+{
+ static const char cszEfiFileName[] = "EFI_FILE_NAME";
+
+ ifstream ifs(strFName.c_str());
+ if (!ifs)
+ throw EFileNotFound(strFName);
+
+ string strFile;
+ getline(ifs, strFile, ifstream::traits_type::to_char_type(ifstream::traits_type::eof()));
+ strFile.erase(0, strFile.find("[files]"));
+
+ istringstream is(strFile);
+ string strTmp;
+ while (!!getline(is, strTmp))
{
+ string::size_type pos = strTmp.find(cszEfiFileName);
+ if (pos == string::npos)
+ continue;
+
+ strTmp.erase(0, strTmp.find_first_not_of(" =", pos + sizeof(cszEfiFileName) - 1));
+ pos = strTmp.find_last_of("\\/");
+ string strId(
+ strTmp.begin() + pos + 1,
+ strTmp.begin() + strTmp.find('-', strTmp.find('-', strTmp.find('-', strTmp.find('-', strTmp.find('-') + 1) + 1) + 1) + 1)
+ );
+ strTmp.erase(pos + 1, strId.length() + 1);
+ strTmp.replace(strTmp.rfind('.'), string::npos, ".map");
+
+ istream *ifmaps = new ifstream(strTmp.c_str());
+ if (ifmaps && !!*ifmaps &&
+ !insert(value_type(CIdentity(strId), ifmaps)).second)
+ throw EDuplicatedFfsFile();
}
- CSymbol(const string&, bool = false);
- friend ostream& operator << (ostream&, const CSymbol&);
+}
+
+CMapFileSetFromInfFile::~CMapFileSetFromInfFile()
+{
+ for (iterator i = begin(); i != end(); i++)
+ delete i->second;
+}
+
+class CSymbolFromString : public ISymbol
+{
+public:
+ CSymbolFromString(const string&, bool = false);
+ void Relocate(UINT64);
};
-CSymbol::CSymbol(const string& strALine, bool bStatic)
-: m_bStatic(bStatic)
+CSymbolFromString::CSymbolFromString(const string& strSymbol, bool b)
{
- istringstream is(strALine);
+ bStatic = b;
- is >> m_strAddress >> m_strName >> hex >> m_ullRva >> m_strFrom;
- if (m_strFrom == "F" || m_strFrom == "f")
+ istringstream is(strSymbol);
+ is >> strAddress >> strName >> getUINT64(ullRva) >> strFrom;
+ if (strFrom == "f")
{
- m_bFunction = true;
- is >> m_strFrom;
- } else m_bFunction = false;
+ bFunction = true;
+ is >> strFrom;
+ }
+ else bFunction = false;
+ if (!is)
+ throw EUnexpectedMapFile("Symbol line format");
}
-ostream& operator << (ostream& os, const CSymbol& symbol)
+void CSymbolFromString::Relocate(UINT64 ullDelta)
{
- os << hex << setw(16) << setfill('0') << symbol.m_ullRva << setw(0);
- os << ' ' << (symbol.m_bFunction ? 'F' : ' ')
- << (symbol.m_bStatic ? 'S' : ' ') << ' ';
- return os << symbol.m_strName;
+ if (ullRva > 0)
+ ullRva += ullDelta;
}
-class CMapFile : public CInputFile, public list<CSymbol>
+class CModuleFromMap : public IModule
{
public:
- CMapFile(const string&);
+ CModuleFromMap(istream&);
+ ~CModuleFromMap();
+
+ UINT64 BaseAddress() const;
+ UINT64 BaseAddress(UINT64);
+ const ISymbol *EntryPoint() const;
- void SetLoadAddress(ulonglong_t);
+private:
+ UINT64 m_ullLoadAddress;
+ iterator m_iEntryPoint;
- string m_strModuleName;
- ulonglong_t m_ullLoadAddr;
- string m_strEntryPoint;
+ static pair<string, string::size_type> FindToken(istream&, const string&);
};
-CMapFile::CMapFile(const string& strFName)
-: CInputFile(strFName)
+pair<string, string::size_type> CModuleFromMap::FindToken(istream& is, const string& strToken)
+{
+ for (string strTmp; !!getline(is, strTmp);)
+ {
+ string::size_type pos = strTmp.find(strToken);
+ if (pos != string::npos)
+ return pair<string, string::size_type>(strTmp, pos);
+ }
+ throw EUnexpectedMapFile(strToken);
+}
+
+CModuleFromMap::CModuleFromMap(istream& imaps)
{
static const char cszLoadAddr[] = "Preferred load address is";
static const char cszGlobal[] = "Address";
static const char cszEntryPoint[] = "entry point at";
static const char cszStatic[] = "Static symbols";
- string strALine;
-
- GetLine(m_strModuleName);
-
- while (!!GetLine(strALine) && strALine.compare(0, sizeof(cszLoadAddr) - 1, cszLoadAddr));
- if (!m_is)
- throw runtime_error(__FUNCTION__ ": Load Address not listed in map file");
-
- istringstream is(strALine.substr(sizeof(cszLoadAddr) - 1));
- if (!(is >> hex >> m_ullLoadAddr))
- throw runtime_error(__FUNCTION__ ": Unexpected Load Address format");
-
- while (!!GetLine(strALine) && strALine.compare(0, sizeof(cszGlobal) - 1, cszGlobal));
- if (!m_is)
- throw runtime_error(__FUNCTION__ ": Global symbols not found in map file");
-
- while (!!GetLine(strALine) && strALine.compare(0, sizeof(cszEntryPoint) - 1, cszEntryPoint))
- push_back(CSymbol(strALine));
- if (!m_is)
- throw runtime_error(__FUNCTION__ ": Entry Point not listed in map file");
+ pair<string, string::size_type> pairTmp;
+ istringstream iss;
+
+ getline(imaps, strName);
+ strName.erase(0, strName.find_first_not_of(' '));
+
+ pairTmp = FindToken(imaps, cszLoadAddr);
+ iss.str(pairTmp.first.substr(pairTmp.second + sizeof(cszLoadAddr) - 1));
+ iss >> getUINT64(m_ullLoadAddress);
+
+ pairTmp = FindToken(imaps, cszGlobal);
+ while (!!getline(imaps, pairTmp.first) &&
+ pairTmp.first.find(cszEntryPoint) == string::npos)
+ if (pairTmp.first.find_first_not_of(' ') != string::npos)
+ push_back(new CSymbolFromString(pairTmp.first));
+
+ iss.str(pairTmp.first.substr(pairTmp.first.find(cszEntryPoint) + sizeof(cszEntryPoint) - 1));
+ iss.clear();
+ string strEntryPoint;
+ iss >> strEntryPoint;
+
+ pairTmp = FindToken(imaps, cszStatic);
+ if (pairTmp.second)
+ while (!!getline(imaps, pairTmp.first))
+ if (pairTmp.first.find_first_not_of(' ') != string::npos)
+ push_back(new CSymbolFromString(pairTmp.first, true));
+
+ for (m_iEntryPoint = begin();
+ m_iEntryPoint != end() && (*m_iEntryPoint)->strAddress != strEntryPoint;
+ m_iEntryPoint++);
+ if (m_iEntryPoint == end())
+ throw EUnexpectedMapFile("Entry point not found");
+}
- is.str(strALine.substr(strALine.find_first_not_of(' ', sizeof(cszEntryPoint) - 1)));
- is.clear();
- if (!getline(is, m_strEntryPoint))
- throw runtime_error(__FUNCTION__ ": Unexpected Entry Point format");
+CModuleFromMap::~CModuleFromMap()
+{
+ for (iterator i = begin(); i != end(); i++)
+ delete *i;
+}
- while (!!GetLine(strALine) && strALine.compare(0, sizeof(cszStatic) - 1, cszStatic));
- while (!!GetLine(strALine))
- push_back(CSymbol(strALine, true));
+UINT64 CModuleFromMap::BaseAddress(void) const
+{
+ return m_ullLoadAddress;
}
-void CMapFile::SetLoadAddress(ulonglong_t ullLoadAddr)
+UINT64 CModuleFromMap::BaseAddress(UINT64 ullNewBase)
{
+ ullNewBase -= m_ullLoadAddress;
for (iterator i = begin(); i != end(); i++)
- if (i->m_ullRva >= m_ullLoadAddr)
- i->m_ullRva += ullLoadAddr - m_ullLoadAddr;
- m_ullLoadAddr = ullLoadAddr;
+ (*i)->Relocate(ullNewBase);
+ m_ullLoadAddress += ullNewBase;
+ return m_ullLoadAddress - ullNewBase;
}
-class COutputFile : public CObjRoot
+const ISymbol *CModuleFromMap::EntryPoint(void) const
{
-protected:
- COutputFile(ostream&);
- ostream& m_os;
-
-private:
- COutputFile(const COutputFile&);
- COutputFile& operator = (const COutputFile&);
-};
+ return *m_iEntryPoint;
+}
-class CFvMapFile : public CObjRoot, public map<CIdentity, CMapFile*>
+class CFvMap : public IFirmwareVolume
{
public:
- CFvMapFile(const CIdAddressPathMap&);
- ~CFvMapFile(void);
-
- friend ostream& operator << (ostream&, const CFvMapFile&);
+ CFvMap(IFfsSet*, IMapFileSet*);
+ ~CFvMap();
private:
- void Cleanup(void);
+ CFvMap(const CFvMap&);
};
-CFvMapFile::CFvMapFile(const CIdAddressPathMap& idAddrPath)
+CFvMap::CFvMap(IFfsSet *pFfsSet, IMapFileSet *pMapSet)
{
- for (CIdAddressPathMap::const_iterator i = idAddrPath.begin(); i != idAddrPath.end(); i++)
+ for (IFfsSet::iterator i = pFfsSet->begin(); i != pFfsSet->end(); i++)
{
- if (i->second.second == "*")
- continue;
-
- try
- {
- pair<iterator, bool> r = insert(value_type(i->first,
- new CMapFile(i->second.second.substr(0, i->second.second.rfind('.')) + ".map")));
- r.first->second->SetLoadAddress(i->second.first);
- }
- catch (const runtime_error& e)
+ IMapFileSet::iterator j = pMapSet->find(i->first);
+ if (j != pMapSet->end())
{
+ IModule *pModule = new CModuleFromMap(*j->second);
+ pModule->id = i->first;
+ pModule->BaseAddress(i->second);
+ push_back(pModule);
}
}
}
-CFvMapFile::~CFvMapFile(void)
-{
- Cleanup();
-}
-
-void CFvMapFile::Cleanup(void)
+CFvMap::~CFvMap()
{
for (iterator i = begin(); i != end(); i++)
- delete i->second;
+ delete *i;
}
-static bool map_less(const CFvMapFile::const_iterator& l, const CFvMapFile::const_iterator& r)
+class CFvMapFormatter : public CObjRoot
{
- return l->second->m_ullLoadAddr < r->second->m_ullLoadAddr;
-}
+public:
+ CFvMapFormatter(const IFirmwareVolume *pFv) : m_pFv(pFv) {}
+ CFvMapFormatter(const CFvMapFormatter& r) : m_pFv(r.m_pFv) {}
-ostream& operator << (ostream& os, const CFvMapFile& fvMap)
-{
- vector<CFvMapFile::const_iterator> rgIter;
- rgIter.reserve(fvMap.size());
- for (CFvMapFile::const_iterator i = fvMap.begin(); i != fvMap.end(); i++)
- rgIter.push_back(i);
- sort(rgIter.begin(), rgIter.end(), map_less);
+ template <class _E, class _Tr>
+ friend basic_ostream<_E, _Tr>& operator << (basic_ostream<_E, _Tr>&, CFvMapFormatter);
- for (vector<CFvMapFile::const_iterator>::const_iterator i = rgIter.begin(); i != rgIter.end(); i++)
+private:
+ static bool Less(const IModule*, const IModule*);
+
+private:
+ const IFirmwareVolume *m_pFv;
+};
+
+template <class _E, class _Tr>
+basic_ostream<_E, _Tr>& operator << (basic_ostream<_E, _Tr>& os, CFvMapFormatter fvMapFmt)
+{
+ vector<IModule*> rgMods(fvMapFmt.m_pFv->begin(), fvMapFmt.m_pFv->end());
+ sort(rgMods.begin(), rgMods.end(), CFvMapFormatter::Less);
+ for (vector<IModule*>::iterator i = rgMods.begin(); i != rgMods.end(); i++)
{
- CMapFile::const_iterator j = (*i)->second->begin();
- while (j != (*i)->second->end() && j->m_strAddress != (*i)->second->m_strEntryPoint) j++;
- if (j == (*i)->second->end())
- throw runtime_error(
- __FUNCTION__ ":Entry point not found for module " +
- (*i)->second->m_strModuleName);
-
- os << hex
- << (*i)->second->m_strModuleName
- << " (EntryPoint=" << j->m_ullRva
- << ", BaseAddress=" << (*i)->second->m_ullLoadAddr
- << ", GUID=" << (*i)->first
- << ")" << endl << endl;
-
- for (j = (*i)->second->begin(); j != (*i)->second->end(); j++)
- os << " " << *j << endl;
+ os << (*i)->strName << hex << " (BaseAddress=" << putUINT64((*i)->BaseAddress());
+ os << ", EntryPoint=" << hex << putUINT64((*i)->EntryPoint()->ullRva);
+ os << ", GUID=";
+ (*i)->id.WriteId(os);
+ os << ")" << endl << endl;
+
+ for (IModule::iterator j = (*i)->begin(); j != (*i)->end(); j++)
+ {
+ os << hex << " " << setw(16) << setfill('0') << putUINT64((*j)->ullRva);
+ os << ((*j)->bFunction ? " F" : " ")
+ << ((*j)->bStatic ? "S " : " ")
+ << (*j)->strName << endl;
+ }
os << endl << endl;
}
-
return os;
}
-class CGenFvMapUsage : public invalid_argument
+bool CFvMapFormatter::Less(const IModule *pModL, const IModule *pModR)
{
-public:
- CGenFvMapUsage(void) : invalid_argument(s_szUsage)
- {
- }
-
-private:
- static const char s_szUsage[];
-};
-
-const char CGenFvMapUsage::s_szUsage[] = "Usage: GenFvMap <LOG> <MAP>";
+ return pModL->BaseAddress() < pModR->BaseAddress();
+}
-class CGenFvMapApp : public CObjRoot
+class CApplication : public CObjRoot
{
public:
- CGenFvMapApp(int, char *[]);
- ~CGenFvMapApp(void);
-
+ CApplication(int, char**);
int Run(void);
private:
- int m_cArgc;
- char **m_ppszArgv;
+ char **m_ppszArg;
+private:
+ CApplication(const CApplication&);
};
-CGenFvMapApp::CGenFvMapApp(int cArgc, char *ppszArgv[])
-: m_cArgc(cArgc)
-, m_ppszArgv(ppszArgv)
+CApplication::CApplication(int cArg, char *ppszArg[])
+: m_ppszArg(ppszArg)
{
- if (cArgc != 3)
- throw CGenFvMapUsage();
+ if (cArg != 4)
+ throw EUsage();
}
-CGenFvMapApp::~CGenFvMapApp(void)
+int CApplication::Run(void)
{
-}
-
-int CGenFvMapApp::Run(void)
-{
- ifstream isLog(m_ppszArgv[1]);
- CIdAddressPathMap idAddrPath(isLog);
- CFvMapFile fvMap(idAddrPath);
-
- ofstream osMap(m_ppszArgv[2], ios_base::out | ios_base::trunc);
- osMap << fvMap;
-
- if (!osMap)
- throw runtime_error(__FUNCTION__ ": Error writing output file");
-
+ CFfsSetFromLogFile ffsSet(m_ppszArg[1]);
+ CMapFileSetFromInfFile mapSet(m_ppszArg[2]);
+ ofstream ofs(m_ppszArg[3]);
+ CFvMap fvMap(&ffsSet, &mapSet);
+ ofs << CFvMapFormatter(&fvMap);
return 0;
}
@@ -462,7 +649,7 @@ int main(int argc, char *argv[]) {
try
{
- CGenFvMapApp app(argc, argv);
+ CApplication app(argc, argv);
return app.Run();
}
catch (const exception& e)
@@ -471,3 +658,9 @@ int main(int argc, char *argv[]) return -1;
}
}
+
+#ifdef _DDK3790x1830_WORKAROUND
+extern "C" void __fastcall __security_check_cookie(int)
+{
+}
+#endif
diff --git a/Tools/CCode/Source/PeiRebase/PeiRebaseExe.c b/Tools/CCode/Source/PeiRebase/PeiRebaseExe.c index 93acb63..459d8db 100644 --- a/Tools/CCode/Source/PeiRebase/PeiRebaseExe.c +++ b/Tools/CCode/Source/PeiRebase/PeiRebaseExe.c @@ -104,27 +104,22 @@ Returns: // Set utility name for error/warning reporting purposes.
//
SetUtilityName (UTILITY_NAME);
-
- if (argc == 1) {
- Usage();
- return STATUS_ERROR;
- }
-
+
if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
(strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
Usage();
return STATUS_ERROR;
}
-
+
if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
Version();
return STATUS_ERROR;
}
-
+
//
// Verify the correct number of arguments
//
- if (argc != MAX_ARGS) {
+ if (argc < MAX_ARGS) {
Usage ();
return STATUS_ERROR;
}
@@ -147,7 +142,7 @@ Returns: //
// Parse the command line arguments
//
- for (Index = 1; Index < MAX_ARGS; Index += 2) {
+ for (Index = 1; Index < argc; Index += 2) {
//
// Make sure argument pair begin with - or /
//
@@ -293,7 +288,7 @@ Returns: // Open the log file
//
strcat (InputFileName, ".log");
- LogFile = fopen (InputFileName, "a");
+ LogFile = fopen (InputFileName, "w");
if (LogFile == NULL) {
Error (NULL, 0, 0, InputFileName, "could not append to log file");
}
@@ -552,7 +547,7 @@ Returns: --*/
{
Version();
-
+
printf (
"Usage: %s -I InputFileName -O OutputFileName -B BaseAddress [-F InputFvInfName]\n",
UTILITY_NAME
@@ -612,7 +607,7 @@ Returns: EFI_FFS_FILE_TAIL TailValue;
EFI_PHYSICAL_ADDRESS *BaseToUpdate;
EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
-
+
//
// Verify input parameters
@@ -687,14 +682,14 @@ Returns: PeHdr = (EFI_IMAGE_NT_HEADERS *)((UINTN)ImageContext.ImageAddress + ImageContext.PeCoffHeaderOffset);
if (PeHdr->OptionalHeader.SectionAlignment != PeHdr->OptionalHeader.FileAlignment) {
//
- // Nor XIP module can be ignored.
+ // Nor XIP module can be ignored.
//
if ((Flags & 1) == 0) {
continue;
}
Error (NULL, 0, 0, "Section-Alignment and File-Alignment does not match", FileGuidString);
return EFI_ABORTED;
- }
+ }
//
// Update CodeView and PdbPointer in ImageContext
@@ -703,8 +698,8 @@ Returns: ImageContext.ImageAddress +
ImageContext.DebugDirectoryEntryRva
);
- ImageContext.CodeView = (VOID *)(UINTN)(
- ImageContext.ImageAddress +
+ ImageContext.CodeView = (VOID *)(UINTN)(
+ ImageContext.ImageAddress +
DebugEntry->RVA
);
switch (*(UINT32 *) ImageContext.CodeView) {
@@ -803,10 +798,9 @@ Returns: //
fprintf (
LogFile,
- "%s %016I64X %s\n",
+ "%s %016I64X\n",
FileGuidString,
- ImageContext.DestinationAddress,
- ImageContext.PdbPointer == NULL ? "*" : ImageContext.PdbPointer
+ ImageContext.DestinationAddress
);
*BaseToUpdate += EFI_SIZE_TO_PAGES (ImageContext.ImageSize) * EFI_PAGE_SIZE;
@@ -855,7 +849,7 @@ Returns: //
return EFI_SUCCESS;
}
-
+
//
// Now process TE sections
//
@@ -921,7 +915,7 @@ Returns: //
// Reloacate TeImage
- //
+ //
ImageContext.DestinationAddress = XipBase + (UINTN) TEImageHeader + sizeof (EFI_TE_IMAGE_HEADER) \
- TEImageHeader->StrippedSize - (UINTN) FfsFile;
Status = PeCoffLoaderRelocateImage (&ImageContext);
@@ -963,13 +957,12 @@ Returns: fprintf (
LogFile,
- "%s %016I64X %s\n",
+ "%s %016I64X\n",
FileGuidString,
- ImageContext.DestinationAddress,
- ImageContext.PdbPointer == NULL ? "*" : ImageContext.PdbPointer
+ ImageContext.DestinationAddress
);
}
-
+
return EFI_SUCCESS;
}
diff --git a/Tools/Conf/BuildMacro.xml b/Tools/Conf/BuildMacro.xml index e1f5381..1ddcbc0 100644 --- a/Tools/Conf/BuildMacro.xml +++ b/Tools/Conf/BuildMacro.xml @@ -14,12 +14,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <import file="UserExtension.xml" optional="true"/>
<!--
- Macro for intialize some properties. This Macro build will be called before source file build.
+ Macro for intialize some properties. This Macro build will be called before source file build.
-->
<macrodef name="Build_Init">
<element name="EXTRA.INC" optional="yes"/>
<element name="EXTRA.ARG" optional="yes"/>
-
+
<sequential>
<var name="OBJECTS" value="" />
<var name="SDB_FILES" value="" />
@@ -35,12 +35,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. </not>
</and>
<then>
- <makedeps DepsFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"
+ <makedeps DepsFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"
TargetFile="${DEST_DIR_OUTPUT}/AutoGen.h.gch">
<input file="${DEST_DIR_DEBUG}/AutoGen.h"/>
<EXTRA.INC/>
</makedeps>
-
+
<OnDependency>
<sourcefiles>
<file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
@@ -48,12 +48,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <targetfiles>
<file Name="${DEST_DIR_OUTPUT}/AutoGen.h.gch"/>
</targetfiles>
-
+
<sequential>
<!-- Generate pre-compiled header -->
<cc userdefine="on">
<command type="CC" cmd="${PCH}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
- outputFile="${DEST_DIR_OUTPUT}/AutoGen.h.obj" dpath="${CC_DPATH}" libpath="${CC_LIBPATH}"
+ outputFile="${DEST_DIR_OUTPUT}/AutoGen.h.obj" dpath="${CC_DPATH}" libpath="${CC_LIBPATH}"
include="${CC_INCLUDEPATH}">
<EXTRA.INC/>
<argument value="${PCH_FLAGS}"/>
@@ -101,10 +101,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <attribute name="FILEPATH"/>
<attribute name="FILENAME"/>
<attribute name="FILEEXT" default="c"/>
-
+
<element name="EXTRA.INC" optional="yes"/>
<element name="EXTRA.ARG" optional="yes"/>
-
+
<sequential>
<var name="FILE_BASENAME" value="@{FILENAME}" />
<var name="FILE_PATH" value="@{FILEPATH}" />
@@ -128,7 +128,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <sequential>
<cc userdefine="on">
<command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
- outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${CC_DPATH}"
+ outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${CC_DPATH}"
libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}">
<EXTRA.INC/>
<argument value="${CC_FLAGS}"/>
@@ -213,7 +213,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <element name="EXTRA.INC" optional="yes"/>
<element name="EXTRA.ARG" optional="yes"/>
-
+
<sequential>
<var name="FILE_BASENAME" value="@{FILENAME}" />
@@ -246,13 +246,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
</command>
</cc>
-
+
<gendepex inputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i" outputFile="${DEST_DIR_OUTPUT}/${BASE_NAME}.depex"/>
</sequential>
</OnDependency>
</sequential>
</macrodef>
-
+
<macrodef name="Build_ASM">
<attribute name="FILEPATH"/>
<attribute name="FILENAME"/>
@@ -260,8 +260,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <element name="EXTRA.INC" optional="yes"/>
<element name="EXTRA.ARG" optional="yes"/>
-
- <!-- Dispath ASM file, there are three type.
+
+ <!-- Dispath ASM file, there are three type.
asm - Build_Assembly
S - Build_Gcc_Assembly
s - Build_Ipf_Assembly -->
@@ -295,7 +295,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. </if>
</sequential>
</macrodef>
-
+
<!--
IA32/x64 Assembly
-->
@@ -329,7 +329,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <sequential>
<cc userdefine="on">
- <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}"
+ <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}"
dpath="${PP_DPATH}" libpath="${PP_LIBPATH}" include="${PP_INCLUDEPATH}">
<EXTRA.INC.1/>
<argument value="${PP_FLAGS}"/>
@@ -356,10 +356,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${ASM_DPATH}"
libpath="${ASM_LIBPATH}" include="${ASM_INCLUDEPATH}">
<EXTRA.INC.1/>
-
+
<argument value="${ASM_FLAGS}"/>
<EXTRA.ARG.1/>
-
+
<fileset casesensitive="on" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"/>
</command>
</cc>
@@ -415,10 +415,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${ASM_DPATH}"
libpath="${ASM_LIBPATH}" include="${ASM_INCLUDEPATH}">
<EXTRA.INC.1/>
-
+
<argument value="${ASM_FLAGS}"/>
<EXTRA.ARG.1/>
-
+
<fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
</command>
</cc>
@@ -468,14 +468,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <sequential>
<cc userdefine="on">
- <command type="PP" cmd="${APP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${APP_FAMILY}"
+ <command type="PP" cmd="${APP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${APP_FAMILY}"
dpath="${APP_DPATH}" libpath="${APP_LIBPATH}" include="${APP_INCLUDEPATH}">
<EXTRA.INC.1/>
<argument value="${APP_FLAGS}"/>
<fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
</command>
</cc>
-
+
<cc userdefine="on">
<command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"
includepathDelimiter="-I" outputDelimiter="-o" dpath="${ASM_DPATH}"
@@ -503,7 +503,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. </macrodef>
- <!--
+ <!--
Assembly the preprocessed IPF assembly code
-->
<macrodef name="Build_IPF_PP_Code">
@@ -516,7 +516,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <sequential>
<mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
-
+
<cc userdefine="on">
<command type="ASM" includepathDelimiter="-I" dpath="${ASM_DPATH}"
libpath="${ASM_LIBPATH}" include="${ASM_INCLUDEPATH}">
@@ -524,25 +524,25 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <includepath path="${MODULE_DIR}"/>
<includepath path="${MODULE_DIR}/${ARCH}"/>
<EXTRA.INC/>
-
+
<argument value="${ASM_FLAGS}"/>
<EXTRA.ARG/>
<OutputFile File="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
-
+
<fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
</command>
</cc>
</sequential>
</macrodef>
-
-
+
+
<!--
Library
-->
<macrodef name="Build_Library">
<attribute name="FILENAME" />
<attribute name="FILEEXT" default="obj"/>
-
+
<sequential>
<var name="FILE_BASENAME" value="@{FILENAME}" />
<var name="FILE_PATH" value="." />
@@ -641,7 +641,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <targetfiles>
<file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
</targetfiles>
-
+
<sequential>
<strgather commandtype="scan" outputdatabase="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb" verbose="read">
<skipext name=".uni"/>
@@ -661,7 +661,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.hpk"/>
<file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.c"/>
</targetfiles>
-
+
<sequential>
<strgather basename="@{FILENAME}Strings" commandtype="dump"
outputdefines="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}StrDefs.h"
@@ -680,7 +680,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <targetfiles>
<file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Strings.obj"/>
</targetfiles>
-
+
<sequential>
<cc userdefine="on">
<command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
@@ -738,39 +738,39 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. </targetfiles>
<sequential>
- <!-- if "TOOLCHIAN FAMILY" is "GCC", it should point the ouput file for preprocess compiler -->
+ <!-- if "TOOLCHIAN FAMILY" is "GCC", it should point the ouput file for preprocess compiler -->
<if>
<equals arg1="${CC_FAMILY}" arg2="GCC"/>
<then>
<cc userdefine="on">
- <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}"
+ <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}"
dpath="${PP_DPATH}" libpath="${PP_LIBPATH}" include="${PP_INCLUDEPATH}">
<argument value="${VFRPP_FLAGS} -o ${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"/>
- <!-- Output file of the preprocess -->
- <EXTRA.INC/>
- <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
+ <!-- Output file of the preprocess -->
+ <EXTRA.INC/>
+ <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
</command>
</cc>
</then>
<else>
<cc userdefine="on">
- <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}"
+ <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}"
dpath="${PP_DPATH}" libpath="${PP_LIBPATH}" include="${PP_INCLUDEPATH}">
<argument value="${VFRPP_FLAGS}"/>
- <!-- Output file of the preprocess -->
- <EXTRA.INC/>
- <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
+ <!-- Output file of the preprocess -->
+ <EXTRA.INC/>
+ <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
</command>
</cc>
</else>
</if>
-
+
<vfrcompile createIfrBinFile="on" createListFile="on" outPutDir="${DEST_DIR_DEBUG}/@{FILEPATH}" vfrFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i">
<EXTRA.INC/>
</vfrcompile>
-
+
<cc userdefine="on">
- <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}"
+ <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}"
includepathDelimiter="-I" family="${CC_FAMILY}" dpath="${CC_DPATH}"
libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}"
outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" >
@@ -805,7 +805,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <element name="EXTRA.INC" optional="yes"/>
<element name="EXTRA.ARG" optional="yes"/>
-
+
<sequential>
<OnDependency>
<sourcefiles>
@@ -814,7 +814,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <targetfiles>
<file name="${DEST_DIR_OUTPUT}/@{FILENAME}.cat"/>
</targetfiles>
-
+
<sequential>
<exec dir="${DEST_DIR_OUTPUT}" executable="${ASM}" failonerror="true">
<arg line="/nologo /omf ${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT} /Bl${ASMLINK} ${ASMLINK_FLAGS}"/>
@@ -838,7 +838,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <element name="EXTRA.INC" optional="yes"/>
<element name="EXTRA.ARG" optional="yes"/>
-
+
<sequential>
<mkdir dir="${DEST_DIR_OUTPUT}"/>
@@ -852,10 +852,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <sequential>
<cc userdefine="on">
- <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}" family="${PP_FAMILY}"
+ <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}" family="${PP_FAMILY}"
dpath="${PP_DPATH}" libpath="${PP_LIBPATH}" include="${PP_INCLUDEPATH}">
<argument value="${APP_FLAGS}"/>
- <EXTRA.INC/>
+ <EXTRA.INC/>
<fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
</command>
</cc>
@@ -875,11 +875,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. </if>
<EFI_SECTION_RAW FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="aml"/>
-
+
</sequential>
</OnDependency>
</sequential>
- </macrodef>
+ </macrodef>
<!--
Build Asl table c file
@@ -891,7 +891,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <element name="EXTRA.INC" optional="yes"/>
<element name="EXTRA.ARG" optional="yes"/>
-
+
<sequential>
<mkdir dir="${DEST_DIR_OUTPUT}"/>
@@ -907,7 +907,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <cc userdefine="on">
<command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
- outputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.obj" dpath="${CC_DPATH}"
+ outputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.obj" dpath="${CC_DPATH}"
libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}">
<EXTRA.INC/>
<argument value="${CC_FLAGS}"/>
@@ -917,20 +917,20 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. </cc>
<cc userdefine="on">
- <command type="DLINK" cmd="${DLINK}" family="${DLINK_FAMILY}"
+ <command type="DLINK" cmd="${DLINK}" family="${DLINK_FAMILY}"
outputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.exe" dpath="${DLINK_DPATH}" >
<argument value="${SLINK_FLAGS}"/>
<fileset casesensitive="on" file="${DEST_DIR_OUTPUT}/@{FILENAME}.obj"/>
</command>
</cc>
-
- <genacpitable inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.exe" outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.acpi" />
-
+
+ <genacpitable inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.exe" outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.acpi" />
+
<EFI_SECTION_RAW FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="acpi"/>
</sequential>
</OnDependency>
</sequential>
- </macrodef>
+ </macrodef>
<!--
Build ACPI Bin File
-->
@@ -941,7 +941,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <element name="EXTRA.INC" optional="yes"/>
<element name="EXTRA.ARG" optional="yes"/>
-
+
<sequential>
<mkdir dir="${DEST_DIR_OUTPUT}"/>
@@ -955,7 +955,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <sequential>
<copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" tofile="${DEST_DIR_OUTPUT}/@{FILENAME}.acpi" />
-
+
<exec executable="attrib">
<arg line="-r ${DEST_DIR_OUTPUT}/@{FILENAME}.acpi"/>
</exec>
@@ -964,8 +964,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. </sequential>
</OnDependency>
</sequential>
- </macrodef>
-
+ </macrodef>
+
<!--
DUMMY - for skipping the source file which should not be built
-->
@@ -1020,7 +1020,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <!-- Link the temporary lib file with dependent libraries -->
<cc userdefine="on">
<command type="DLINK" cmd="${DLINK}" family="${DLINK_FAMILY}"
- outputFile="${DEST_DIR_DEBUG}/@{FILENAME}.dll" dpath="${DLINK_DPATH}"
+ outputFile="${DEST_DIR_DEBUG}/@{FILENAME}.dll" dpath="${DLINK_DPATH}"
libpath="${DLINK_LIBPATH}" include="${DLINK_INCLUDEPATH}">
<argument value="${DLINK_FLAGS}"/>
<libset libs="${DEST_DIR_OUTPUT}/@{FILENAME}Local.lib ${LIBS} ${DLINK_SPATH}"/>
@@ -1029,12 +1029,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. </cc>
<!-- Convert the dll file to efi file -->
- <fwimage componentType="${MODULE_TYPE}" outImage="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
+ <fwimage componentType="${MODULE_TYPE}" outImage="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
peImage="${DEST_DIR_DEBUG}/@{FILENAME}.dll" time="0"/>
<!-- Copy the efi file to BIN and OUTPUT directory -->
<copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />
- <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />
+ <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />
+ <copy file="${DEST_DIR_DEBUG}/@{FILENAME}.map" tofile="${BIN_DIR}/@{FILENAME}.map" />
</sequential>
</OnDependency>
</sequential>
@@ -1052,11 +1053,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <element name="EXTRA.ARG" optional="yes"/>
<sequential>
- <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
+ <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
</sequential>
</macrodef>
-
+
<!--
Microcode
-->
@@ -1072,24 +1073,24 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <mkdir dir="${TARGET_DIR}/Microcode"/>
<flashmap MCIFile="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" MCOFILE="${TARGET_DIR}/Microcode/@{FILENAME}.bin"/>
</sequential>
- </macrodef>
+ </macrodef>
<!--
Graphics (bmp, ...)
-->
<macrodef name="Build_BMP">
<attribute name="FILEPATH"/>
- <attribute name="FILENAME"/>
+ <attribute name="FILENAME"/>
<attribute name="FILEEXT" default="bmp"/>
<element name="EXTRA.INC" optional="yes"/>
<element name="EXTRA.ARG" optional="yes"/>
<sequential>
- <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
+ <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
</sequential>
- </macrodef>
+ </macrodef>
<!--
build EFI file
@@ -1103,13 +1104,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <element name="EXTRA.ARG" optional="yes"/>
<sequential>
- <mkdir dir="${MODULE_DIR}/@{FILEPATH}" />
- <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
+ <mkdir dir="${MODULE_DIR}/@{FILEPATH}" />
+ <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
tofile="${DEST_DIR_OUTPUT}/${BASE_NAME}.efi"/>
</sequential>
</macrodef>
-
- <!--
+
+ <!--
Build macro for Apriori
-->
<macrodef name="Build_Apriori">
@@ -1120,15 +1121,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <sequential>
<mkdir dir="${FV_DIR}/Apriori" />
- <gensection inputfile="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
- outputfile="${FV_DIR}/Apriori/@{FILENAME}.sec"
+ <gensection inputfile="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
+ outputfile="${FV_DIR}/Apriori/@{FILENAME}.sec"
sectiontype="EFI_SECTION_RAW"/>
- <genffsfile BaseName="@{FILENAME}" ffsATTRIBCHECKSUM="TRUE" ffsFILETYPE="EFI_FV_FILETYPE_FREEFORM"
+ <genffsfile BaseName="@{FILENAME}" ffsATTRIBCHECKSUM="TRUE" ffsFILETYPE="EFI_FV_FILETYPE_FREEFORM"
fileGuid="@{GUID}" moduleType="BASE" outputDir="${FV_DIR}">
<sectFile fileName="${FV_DIR}/Apriori/@{FILENAME}.sec"/>
</genffsfile>
-
+
</sequential>
</macrodef>
@@ -1160,8 +1161,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <PRE.PROCESS/>
<genteimage Dump="false" Verbose="false" OutputDir="" OutputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.te" InputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
- <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.te"
- outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.tes"
+ <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.te"
+ outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.tes"
sectiontype="EFI_SECTION_TE"/>
<POST.PROCESS/>
@@ -1193,10 +1194,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <sequential>
<PRE.PROCESS/>
- <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
- outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"
+ <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
+ outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"
sectiontype="EFI_SECTION_PE32"/>
-
+
<POST.PROCESS/>
</sequential>
</OnDependency>
@@ -1223,7 +1224,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <then>
<PRE.PROCESS/>
- <gensection outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"
+ <gensection outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"
versionnum="@{VERSION}"
sectiontype="EFI_SECTION_VERSION"/>
<POST.PROCESS/>
@@ -1253,7 +1254,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <then>
<PRE.PROCESS/>
<gensection interfacestring="@{UI}"
- outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"
+ outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"
sectiontype="EFI_SECTION_USER_INTERFACE"/>
<POST.PROCESS/>
</then>
@@ -1286,8 +1287,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
</targetfiles>
<sequential>
- <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"
- outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
+ <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"
+ outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
sectiontype="EFI_SECTION_DXE_DEPEX"/>
</sequential>
</OnDependency>
@@ -1332,12 +1333,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. </targetfiles>
<sequential>
- <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"
- outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
+ <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"
+ outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
sectiontype="EFI_SECTION_PEI_DEPEX"/>
</sequential>
</OnDependency>
-
+
</then>
<else>
<if>
@@ -1377,8 +1378,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <sequential>
<PRE.PROCESS/>
- <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
- outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"
+ <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
+ outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"
sectiontype="EFI_SECTION_RAW"/>
<POST.PROCESS/>
</sequential>
@@ -1411,16 +1412,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <PRE.PROCESS/>
<secfixup secexefile="${DEST_DIR_OUTPUT}/@{FILENAME}.te" resetvectorDatafile="${DEST_DIR_OUTPUT}/ResetVec.@{FILEEXT}"
outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.bin"/>
-
- <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.bin"
- outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"
+
+ <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.bin"
+ outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"
sectiontype="EFI_SECTION_RAW"/>
<POST.PROCESS/>
</sequential>
</OnDependency>
</sequential>
</macrodef>
-
+
<!--
EFI_SECTION_FIRMWARE_VOLUME_IMAGE
-->
@@ -1443,14 +1444,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <sequential>
<PRE.PROCESS/>
-
- <copy file="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
- tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
+
+ <copy file="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
+ tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
overwrite="true"/>
- <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
- outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"
+ <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
+ outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"
sectiontype="EFI_SECTION_FIRMWARE_VOLUME_IMAGE"/>
-
+
<POST.PROCESS/>
</sequential>
</OnDependency>
|