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
This commit is contained in:
Bob Feng 2015-05-12 00:58:20 +00:00 committed by bobfeng
parent ad7d95ea48
commit c1b9129c3c
1 changed files with 12 additions and 0 deletions

View File

@ -836,6 +836,9 @@ def BuildExDataBase(Dict):
DbOffset += DbItemTotal[DbIndex].GetInterOffset(Offset) DbOffset += DbItemTotal[DbIndex].GetInterOffset(Offset)
break break
DbOffset += DbItemTotal[DbIndex].GetListSize() DbOffset += DbItemTotal[DbIndex].GetListSize()
if DbIndex + 1 == InitTableNum:
if DbOffset % 8:
DbOffset += (8 - DbOffset % 8)
else: else:
assert(False) assert(False)
@ -867,6 +870,9 @@ def BuildExDataBase(Dict):
DbOffset += DbItemTotal[DbIndex].GetInterOffset(VariableOffset) DbOffset += DbItemTotal[DbIndex].GetInterOffset(VariableOffset)
break break
DbOffset += DbItemTotal[DbIndex].GetListSize() DbOffset += DbItemTotal[DbIndex].GetListSize()
if DbIndex + 1 == InitTableNum:
if DbOffset % 8:
DbOffset += (8 - DbOffset % 8)
else: else:
assert(False) assert(False)
if isinstance(VariableRefTable[0],list): if isinstance(VariableRefTable[0],list):
@ -908,6 +914,8 @@ def BuildExDataBase(Dict):
for Item in (DbUnInitValueUint64, DbUnInitValueUint32, DbUnInitValueUint16, DbUnInitValueUint8, DbUnInitValueBoolean): for Item in (DbUnInitValueUint64, DbUnInitValueUint32, DbUnInitValueUint16, DbUnInitValueUint8, DbUnInitValueBoolean):
UninitDataBaseSize += Item.GetListSize() UninitDataBaseSize += Item.GetListSize()
if (DbTotalLength - UninitDataBaseSize) % 8:
DbTotalLength += (8 - (DbTotalLength - UninitDataBaseSize) % 8)
# Construct the database buffer # Construct the database buffer
Guid = "{0x3c7d193c, 0x682c, 0x4c14, 0xa6, 0x8f, 0x55, 0x2d, 0xea, 0x4f, 0x43, 0x7e}" Guid = "{0x3c7d193c, 0x682c, 0x4c14, 0xa6, 0x8f, 0x55, 0x2d, 0xea, 0x4f, 0x43, 0x7e}"
Guid = StringArrayToList(Guid) Guid = StringArrayToList(Guid)
@ -977,6 +985,10 @@ def BuildExDataBase(Dict):
b = Item.PackData() b = Item.PackData()
Buffer += b Buffer += b
if Index == InitTableNum: if Index == InitTableNum:
if len(Buffer) % 8:
for num in range(8 - len(Buffer) % 8):
b = pack('=B', Pad)
Buffer += b
break break
return Buffer return Buffer