Skip to content

Instantly share code, notes, and snippets.

@yagoernandes
Forked from mcoffin/toggle-db-prochot.py
Created March 21, 2020 12:59
Show Gist options
  • Select an option

  • Save yagoernandes/e74fd94221eaaf5834b5acb2c93f0da9 to your computer and use it in GitHub Desktop.

Select an option

Save yagoernandes/e74fd94221eaaf5834b5acb2c93f0da9 to your computer and use it in GitHub Desktop.
Toggles DB PROCHOT flag on linux
#!/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