Changeset 108794 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/BaseTools/Source/Python/AutoGen/GenC.py
- Timestamp:
- Mar 31, 2025 11:31:09 AM (2 weeks ago)
- svn:sync-xref-src-repo-rev:
- 168237
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776,129194-164365 /vendor/edk2/current 103735-103757,103769-103776,129194-168232
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/BaseTools/Source/Python/AutoGen/GenC.py
r105670 r108794 21 21 from .GenPcdDb import CreatePcdDatabaseCode 22 22 from .IdfClassObject import * 23 24 import json 25 import secrets 23 26 24 27 ## PCD type string … … 2040 2043 CreateHeaderCode(Info, AutoGenC, AutoGenH) 2041 2044 2045 # The only 32 bit archs we have are IA32 and ARM, everything else is 64 bit 2046 Bitwidth = 32 if Info.Arch == 'IA32' or Info.Arch == 'ARM' else 64 2047 2048 if GlobalData.gStackCookieValues64 == [] and os.path.exists(os.path.join(Info.PlatformInfo.BuildDir, "StackCookieValues64.json")): 2049 with open (os.path.join(Info.PlatformInfo.BuildDir, "StackCookieValues64.json"), "r") as file: 2050 GlobalData.gStackCookieValues64 = json.load(file) 2051 if GlobalData.gStackCookieValues32 == [] and os.path.exists(os.path.join(Info.PlatformInfo.BuildDir, "StackCookieValues32.json")): 2052 with open (os.path.join(Info.PlatformInfo.BuildDir, "StackCookieValues32.json"), "r") as file: 2053 GlobalData.gStackCookieValues32 = json.load(file) 2054 2055 try: 2056 if Bitwidth == 32: 2057 CookieValue = int(GlobalData.gStackCookieValues32[hash(Info.Guid) % len(GlobalData.gStackCookieValues32)]) 2058 else: 2059 CookieValue = int(GlobalData.gStackCookieValues64[hash(Info.Guid) % len(GlobalData.gStackCookieValues64)]) 2060 except: 2061 EdkLogger.warn("build", "Failed to get Stack Cookie Value List! Generating random value.", ExtraData="[%s]" % str(Info)) 2062 if Bitwidth == 32: 2063 CookieValue = secrets.randbelow (0xFFFFFFFF) 2064 else: 2065 CookieValue = secrets.randbelow (0xFFFFFFFFFFFFFFFF) 2066 2067 AutoGenH.Append(( 2068 '#define STACK_COOKIE_VALUE 0x%XULL\n' % CookieValue 2069 if Bitwidth == 64 else 2070 '#define STACK_COOKIE_VALUE 0x%X\n' % CookieValue 2071 )) 2072 2042 2073 CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH) 2043 2074 CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH)
Note:
See TracChangeset
for help on using the changeset viewer.