summaryrefslogtreecommitdiff
path: root/BaseTools/Source
diff options
context:
space:
mode:
authorBob Feng <bob.c.feng@intel.com>2015-05-12 00:58:20 +0000
committerbobfeng <bobfeng@Edk2>2015-05-12 00:58:20 +0000
commitc1b9129c3c1f09a4847c7ff3179ef2edc475cf56 (patch)
tree369a563151c0e9b483c36cfcbf0bf719dd705a96 /BaseTools/Source
parentad7d95ea4897cd66b2623e8ed7ae40b91dd7bc3c (diff)
downloadedk2-platforms-c1b9129c3c1f09a4847c7ff3179ef2edc475cf56.tar.xz
BaseTools/Build: The PCD value in uninitialized data range should be natural aligned.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: "Bob Feng" <bob.c.feng@intel.com> Reviewed-by: "Liu, Yingke D" <yingke.d.liu@intel.com> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17416 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source')
-rw-r--r--BaseTools/Source/Python/AutoGen/GenPcdDb.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
index 20f4a23371..d07ac60ef3 100644
--- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py
+++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
@@ -836,6 +836,9 @@ def BuildExDataBase(Dict):
DbOffset += DbItemTotal[DbIndex].GetInterOffset(Offset)
break
DbOffset += DbItemTotal[DbIndex].GetListSize()
+ if DbIndex + 1 == InitTableNum:
+ if DbOffset % 8:
+ DbOffset += (8 - DbOffset % 8)
else:
assert(False)
@@ -867,6 +870,9 @@ def BuildExDataBase(Dict):
DbOffset += DbItemTotal[DbIndex].GetInterOffset(VariableOffset)
break
DbOffset += DbItemTotal[DbIndex].GetListSize()
+ if DbIndex + 1 == InitTableNum:
+ if DbOffset % 8:
+ DbOffset += (8 - DbOffset % 8)
else:
assert(False)
if isinstance(VariableRefTable[0],list):
@@ -908,6 +914,8 @@ def BuildExDataBase(Dict):
for Item in (DbUnInitValueUint64, DbUnInitValueUint32, DbUnInitValueUint16, DbUnInitValueUint8, DbUnInitValueBoolean):
UninitDataBaseSize += Item.GetListSize()
+ if (DbTotalLength - UninitDataBaseSize) % 8:
+ DbTotalLength += (8 - (DbTotalLength - UninitDataBaseSize) % 8)
# Construct the database buffer
Guid = "{0x3c7d193c, 0x682c, 0x4c14, 0xa6, 0x8f, 0x55, 0x2d, 0xea, 0x4f, 0x43, 0x7e}"
Guid = StringArrayToList(Guid)
@@ -977,6 +985,10 @@ def BuildExDataBase(Dict):
b = Item.PackData()
Buffer += b
if Index == InitTableNum:
+ if len(Buffer) % 8:
+ for num in range(8 - len(Buffer) % 8):
+ b = pack('=B', Pad)
+ Buffer += b
break
return Buffer