Il 10/09/2012 13:52, Peter Lieven ha scritto:
>> dd if=/dev/cpu/0/msr skip=$((0x194)) bs=8 count=1 | xxd
>> dd if=/dev/cpu/0/msr skip=$((0xCE)) bs=8 count=1 | xxd
> it only works without the skip. but the msr device returns all zeroes.
Hmm, the strange API of the MSR device doesn't work well with dd (dd
skips to 0x194 * 8 because bs is 8. You can try this program:
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
int rdmsr(int fd, long reg)
{
char msg[40];
long long val;
sprintf(msg, "rdmsr(%#x)", reg);
if (pread(fd, &val, 8, reg) < 0) {
perror(msg);
} else {
printf("%s: %#016llx\n", msg, val);
fflush(stdout);
}
}
int main()
{
int fd = open("/dev/cpu/0/msr", O_RDONLY);
if (fd < 0) { perror("open"); exit(1); }
rdmsr(fd, 0x194);
rdmsr(fd, 0xCE);
}
Paolo