From 11a89ec0305fe816330a0ae61978cdf7be88eb53 Mon Sep 17 00:00:00 2001 From: Michael D Kinney Date: Fri, 27 Mar 2026 16:48:09 -0700 Subject: [PATCH] IntelFsp2Pkg/FspSecCore/Vtf0: NASM and Python 3 fixes Update NASM files to use NASM file extensions. Also update VTF0 Python scripts to Python 3. Signed-off-by: Michael D Kinney --- IntelFsp2Pkg/FspSecCore/Vtf0/Build.py | 10 +++--- .../Ia16/{ResetVec.asm16 => ResetVec.nasm} | 0 ...etVectorCode.asm => ResetVectorCode.nasmb} | 2 +- .../Vtf0/Tools/FixupForRawSection.py | 36 ++++++++++--------- 4 files changed, 26 insertions(+), 22 deletions(-) rename IntelFsp2Pkg/FspSecCore/Vtf0/Ia16/{ResetVec.asm16 => ResetVec.nasm} (100%) rename IntelFsp2Pkg/FspSecCore/Vtf0/{ResetVectorCode.asm => ResetVectorCode.nasmb} (89%) diff --git a/IntelFsp2Pkg/FspSecCore/Vtf0/Build.py b/IntelFsp2Pkg/FspSecCore/Vtf0/Build.py index 66b8083f2e..be61c22c1f 100644 --- a/IntelFsp2Pkg/FspSecCore/Vtf0/Build.py +++ b/IntelFsp2Pkg/FspSecCore/Vtf0/Build.py @@ -12,7 +12,7 @@ import subprocess import sys def RunCommand(commandLine): - #print ' '.join(commandLine) + #print(' '.join(commandLine)) return subprocess.call(commandLine) for filename in glob.glob(os.path.join('Bin', '*.raw')): @@ -30,18 +30,18 @@ commandLine = ( '-D', 'ARCH_%s' % arch.upper(), '-D', 'DEBUG_%s' % str(debugType).upper(), '-o', output, - 'ResetVectorCode.asm', + 'ResetVectorCode.nasmb', ) ret = RunCommand(commandLine) -print '\tASM\t' + output +print('\tASM\t' + output) if ret != 0: sys.exit(ret) commandLine = ( - 'python', + sys.executable, 'Tools/FixupForRawSection.py', output, ) -print '\tFIXUP\t' + output +print('\tFIXUP\t' + output) ret = RunCommand(commandLine) if ret != 0: sys.exit(ret) diff --git a/IntelFsp2Pkg/FspSecCore/Vtf0/Ia16/ResetVec.asm16 b/IntelFsp2Pkg/FspSecCore/Vtf0/Ia16/ResetVec.nasm similarity index 100% rename from IntelFsp2Pkg/FspSecCore/Vtf0/Ia16/ResetVec.asm16 rename to IntelFsp2Pkg/FspSecCore/Vtf0/Ia16/ResetVec.nasm diff --git a/IntelFsp2Pkg/FspSecCore/Vtf0/ResetVectorCode.asm b/IntelFsp2Pkg/FspSecCore/Vtf0/ResetVectorCode.nasmb similarity index 89% rename from IntelFsp2Pkg/FspSecCore/Vtf0/ResetVectorCode.asm rename to IntelFsp2Pkg/FspSecCore/Vtf0/ResetVectorCode.nasmb index 42c3a9c8ae..64dbccf67f 100644 --- a/IntelFsp2Pkg/FspSecCore/Vtf0/ResetVectorCode.asm +++ b/IntelFsp2Pkg/FspSecCore/Vtf0/ResetVectorCode.nasmb @@ -8,4 +8,4 @@ ;------------------------------------------------------------------------------ -%include "Ia16/ResetVec.asm16" +%include "Ia16/ResetVec.nasm" diff --git a/IntelFsp2Pkg/FspSecCore/Vtf0/Tools/FixupForRawSection.py b/IntelFsp2Pkg/FspSecCore/Vtf0/Tools/FixupForRawSection.py index 7765c22036..1bcf670822 100644 --- a/IntelFsp2Pkg/FspSecCore/Vtf0/Tools/FixupForRawSection.py +++ b/IntelFsp2Pkg/FspSecCore/Vtf0/Tools/FixupForRawSection.py @@ -8,15 +8,19 @@ import sys +if len(sys.argv) < 2: + print('Usage: %s ' % sys.argv[0], file=sys.stderr) + sys.exit(1) + filename = sys.argv[1] -if filename.lower().find('ia32') >= 0: - d = open(sys.argv[1], 'rb').read() +if 'ia32' in filename.lower(): + d = open(filename, 'rb').read() c = ((len(d) + 4 + 7) & ~7) - 4 if c > len(d): c -= len(d) - f = open(sys.argv[1], 'wb') - f.write('\x90' * c) + f = open(filename, 'wb') + f.write(b'\x90' * c) f.write(d) f.close() else: @@ -36,14 +40,14 @@ else: def NopAlign4k(s): c = ((len(s) + 0xfff) & ~0xfff) - len(s) - return ('\x90' * c) + s + return (b'\x90' * c) + s def PageDirectoryEntries4GbOf2MbPages(baseAddress): - s = '' + s = b'' for i in range(0x800): i = ( - baseAddress + long(i << 21) + + baseAddress + (i << 21) + PAGE_2M_MBO + PAGE_CACHE_DISABLE + PAGE_ACCESSED + @@ -51,11 +55,11 @@ else: PAGE_READ_WRITE + PAGE_PRESENT ) - s += pack('Q', i) + s += pack('