-
-
Save yagoernandes/e74fd94221eaaf5834b5acb2c93f0da9 to your computer and use it in GitHub Desktop.
Toggles DB PROCHOT flag on linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import subprocess | |
| db_prochot_loc = '0x1fc' | |
| def main(): | |
| p = subprocess.run(['rdmsr', db_prochot_loc], stdout=subprocess.PIPE, encoding='utf8') | |
| orig_str = p.stdout.rstrip() | |
| v = int('0x' + orig_str, 16) ^ 0b1 | |
| new_str = hex(v) | |
| p = subprocess.run(['wrmsr', '-a', db_prochot_loc, new_str]) | |
| if v & 0b1: | |
| print('DB PROCHOT: enabled!') | |
| else: | |
| print('DB PROCHOT: disabled!') | |
| if __name__ == '__main__': | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment