File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 1- // Copyright 2022 Amazon .com , Inc . or its affiliates . All Rights Reserved .
2- // SPDX - License - Identifier : Apache - 2.0
1+ # Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+ # SPDX-License-Identifier: Apache-2.0
33
4- // Helper script used to read MSR values from ranges known to contain MSRs .
4+ # Helper script used to read MSR values from ranges known to contain MSRs.
55
6+ import os
67import mmap
78
89msr_fd = open ("/dev/cpu/0/msr" , "r+b" )
9- msrs = mmap .mmap (msr_fd .fileno (), 0 )
1010
11- def print_msr (msr ):
12- msr_bytes = msrs [ msr : msr + 8 ]
13- if len ( msr_bytes ) == 8 :
11+ def print_msr (msr : int ):
12+ msr_bytes = os . pread ( msr_fd , 8 , msr )
13+ if msr_bytes :
1414 msr_value = int .from_bytes (msr_bytes )
1515 print ("{msr:#x},{msr_value:#x}" )
1616
You can’t perform that action at this time.
0 commit comments