Skip to content

Instantly share code, notes, and snippets.

@mcoffin
Created March 14, 2018 01:46
Show Gist options
  • Select an option

  • Save mcoffin/755bafe39df4a76d23366021af4b598b to your computer and use it in GitHub Desktop.

Select an option

Save mcoffin/755bafe39df4a76d23366021af4b598b 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