mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
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 <michael.d.kinney@intel.com>
This commit is contained in:
parent
76406ef119
commit
11a89ec030
4 changed files with 26 additions and 22 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -8,4 +8,4 @@
|
|||
;------------------------------------------------------------------------------
|
||||
|
||||
|
||||
%include "Ia16/ResetVec.asm16"
|
||||
%include "Ia16/ResetVec.nasm"
|
||||
|
|
@ -8,15 +8,19 @@
|
|||
|
||||
import sys
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print('Usage: %s <raw_file>' % 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('<Q', i)
|
||||
return s
|
||||
|
||||
def PageDirectoryPointerTable4GbOf2MbPages(pdeBase):
|
||||
s = ''
|
||||
s = b''
|
||||
for i in range(0x200):
|
||||
i = (
|
||||
pdeBase +
|
||||
|
|
@ -65,11 +69,11 @@ else:
|
|||
PAGE_READ_WRITE +
|
||||
PAGE_PRESENT
|
||||
)
|
||||
s += pack('Q', i)
|
||||
s += pack('<Q', i)
|
||||
return s
|
||||
|
||||
def PageMapLevel4Table4GbOf2MbPages(pdptBase):
|
||||
s = ''
|
||||
s = b''
|
||||
for i in range(0x200):
|
||||
i = (
|
||||
pdptBase +
|
||||
|
|
@ -79,11 +83,11 @@ else:
|
|||
PAGE_READ_WRITE +
|
||||
PAGE_PRESENT
|
||||
)
|
||||
s += pack('Q', i)
|
||||
s += pack('<Q', i)
|
||||
return s
|
||||
|
||||
def First4GbPageEntries(topAddress):
|
||||
PDE = PageDirectoryEntries4GbOf2MbPages(0L)
|
||||
PDE = PageDirectoryEntries4GbOf2MbPages(0)
|
||||
pml4tBase = topAddress - 0x1000
|
||||
pdptBase = pml4tBase - 0x1000
|
||||
pdeBase = pdptBase - len(PDE)
|
||||
|
|
@ -92,11 +96,11 @@ else:
|
|||
return PDE + PDPT + PML4T
|
||||
|
||||
def AlignAndAddPageTables():
|
||||
d = open(sys.argv[1], 'rb').read()
|
||||
d = open(filename, 'rb').read()
|
||||
code = NopAlign4k(d)
|
||||
topAddress = 0x100000000 - len(code)
|
||||
d = ('\x90' * 4) + First4GbPageEntries(topAddress) + code
|
||||
f = open(sys.argv[1], 'wb')
|
||||
d = (b'\x90' * 4) + First4GbPageEntries(topAddress) + code
|
||||
f = open(filename, 'wb')
|
||||
f.write(d)
|
||||
f.close()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue