#!/usr/bin/perl
# License: WTFPLv2
# minimal "rdmsr" implementation
$msr = shift
or die "need msr as parameter";
$msr = hex($msr) if ($msr =~ m/^0x/i);
open(FD, "/dev/cpu/0/msr")
or die "open /dev/cpu/0/msr: $!";
sysseek(FD, $msr, SEEK_SET)
or die "sysseek: $!";
sysread(FD, $reg, 8 ) == 8
or die "sysread: $!";
$reg = reverse($reg);
$hex = unpack('H*', $reg);
$hex =~s/^0*//;
print "$hex\n";
Yes, i know, my perl is horrible :-) but maybe this is useful for someone else anyway.