Ñò s×6Xc @sÛddkZddkZddkZd„Zdd„Zd„ZedjoˆddkZddkZd„Zei i dƒpei d ƒnei d d ƒZ e id d eddƒe idddd eddƒe idd eddƒe idd eddƒe idd eddddƒe iƒZei o2ei o'ei odeeieiƒGHq×eioeeieidƒq×eioeeieidƒq×eeieiƒndS(iÿÿÿÿNcCstidƒ}xb|D]Z}ti|tiƒ}ti||tiƒti|tid|ƒƒti |ƒqW|pt dƒ‚ndS(Ns/dev/cpu/[0-9]*/msrtQs(msr module not loaded (run modprobe msr)( tglobtostopentO_WRONLYtlseektSEEK_SETtwritetstructtpacktclosetOSError(tmsrtvaltntctf((s/root/pmu-tools/msr.pytwritemsrsicCsetid|ftiƒ}ti||tiƒtidti|dƒƒd}ti|ƒ|S(Ns/dev/cpu/%d/msrRii( RRtO_RDONLYRRRtunpacktreadR (R tcpuRR ((s/root/pmu-tools/msr.pytreadmsrs " cCsïtidƒ}xÂ|D]º}ti|tiƒ}ti||tiƒtidti|dƒƒd}|o|d|>B}n|d|>@}ti||tiƒti |ti d|ƒƒti |ƒqW|pt dƒ‚ndS(Ns/dev/cpu/[0-9]*/msrRiiis(msr module not loaded (run modprobe msr)( RRRtO_RDWRRRRRRRR R R (R tbitR RRRtv((s/root/pmu-tools/msr.pyt changebits"t__main__cCs>yt|dƒSWn&tj otid|ƒ‚nXdS(NisBad hex number %s(tintt ValueErrortargparset ArgumentError(ts((s/root/pmu-tools/msr.pyt parse_hex,ss/dev/cpu/0/msrs/sbin/modprobe msrt descriptions$Access x86 model specific registers.R ttypethelpsnumber of the MSR to accesstvaluetnargst?s&value to write (if not specified read)s--setbitsBit number to sets --clearbitsBit number to clears--cputdefaults)CPU to read on (writes always change all)s%xi(RRRRRRt__name__RR!tpathtexiststsystemtArgumentParsertpt add_argumentRt parse_argstargsR%tsetbittclearbitR R(((s/root/pmu-tools/msr.pyts0        !