| 37 | } |
| 38 | |
| 39 | def IsAffectedSnapdragon(): |
| 40 | cpuinfo = [] |
| 41 | |
| 42 | with open("/proc/cpuinfo") as cpuinfo_file: |
| 43 | current_implementer = 0 |
| 44 | current_part = 0 |
| 45 | for line in cpuinfo_file: |
| 46 | line = line.strip() |
| 47 | if "CPU implementer" in line: |
| 48 | current_implementer = int(re.findall(r'0x[0-9A-F]+', line, re.I)[0], 16) |
| 49 | if "CPU part" in line: |
| 50 | current_part = int(re.findall(r'0x[0-9A-F]+', line, re.I)[0], 16) |
| 51 | cpuinfo += {tuple([current_implementer, current_part])} |
| 52 | |
| 53 | for core in cpuinfo: |
| 54 | if SnapdragonIDsWithDisabledSVE.get(core): |
| 55 | return True |
| 56 | |
| 57 | return False |
| 58 | |
| 59 | |
| 60 | def main(): |